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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hdds.utils.BackgroundService
org.apache.hadoop.hdds.utils.BackgroundService.PeriodicalTask -
Constructor Summary
ConstructorsConstructorDescriptionOMRangerBGSyncService(OzoneManager ozoneManager, OMMultiTenantManager omMultiTenantManager, MultiTenantAccessController accessController, long interval, TimeUnit unit, long serviceTimeout) -
Method Summary
Modifier and TypeMethodDescriptionlongReturn the number of runs the sync is triggered.org.apache.hadoop.hdds.utils.BackgroundTaskQueuegetTasks()voidsetOMDBRangerServiceVersion(long version) voidshutdown()voidstart()booleanTrigger the sync once.Methods inherited from class org.apache.hadoop.hdds.utils.BackgroundService
execTaskCompletion, getExecutorService, getFuture, getIntervalMillis, getThreadCount, runPeriodicalTaskNow, setInterval, setPoolSize, setServiceTimeoutInNanos
-
Constructor Details
-
OMRangerBGSyncService
public OMRangerBGSyncService(OzoneManager ozoneManager, OMMultiTenantManager omMultiTenantManager, MultiTenantAccessController accessController, long interval, TimeUnit unit, long serviceTimeout)
-
-
Method Details
-
getTasks
public org.apache.hadoop.hdds.utils.BackgroundTaskQueue getTasks()- Specified by:
getTasksin classorg.apache.hadoop.hdds.utils.BackgroundService
-
start
public void start()- Overrides:
startin classorg.apache.hadoop.hdds.utils.BackgroundService
-
shutdown
public void shutdown()- Overrides:
shutdownin classorg.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.
-