Class OMRangerBGSyncService

java.lang.Object
org.apache.hadoop.hdds.utils.BackgroundService
org.apache.hadoop.ozone.om.service.OMRangerBGSyncService

public class OMRangerBGSyncService extends org.apache.hadoop.hdds.utils.BackgroundService
Background Sync thread that reads Multi-Tenancy state from OM DB and applies it to Ranger. This recovers or cleans up (Multi-Tenant related) Ranger policies and roles in case of OM crashes or Ranger failure. Multi-Tenant related Ranger policies and roles are *eventually* consistent with OM DB tenant state. OM DB is the source of truth. While the sync thread is updating Ranger, user or other applications editing Ranger Ozone policies or roles could interfere with the update. In this case, a sync run might leave Ranger in a de-synced state, due to limited maximum number of update attempts for each run. But this should eventually be corrected in future sync runs. See the comment block in triggerRangerSyncOnce() for more on the core logic.
  • Constructor Details

  • Method Details

    • getTasks

      public org.apache.hadoop.hdds.utils.BackgroundTaskQueue getTasks()
      Specified by:
      getTasks in class org.apache.hadoop.hdds.utils.BackgroundService
    • start

      public void start()
      Overrides:
      start in class org.apache.hadoop.hdds.utils.BackgroundService
    • shutdown

      public void shutdown()
      Overrides:
      shutdown in class org.apache.hadoop.hdds.utils.BackgroundService
    • triggerRangerSyncOnce

      public boolean triggerRangerSyncOnce()
      Trigger the sync once.
      Returns:
      true if completed successfully, false if any exception is thrown.
    • setOMDBRangerServiceVersion

      public void setOMDBRangerServiceVersion(long version) throws com.google.protobuf.ServiceException
      Throws:
      com.google.protobuf.ServiceException
    • getRangerSyncRunCount

      public long getRangerSyncRunCount()
      Return the number of runs the sync is triggered. This doesn't count attempts inside each sync run.