Skip to content

Commit

Permalink
HDDS-11472. Avoid recreating external access authorizer on OM state r…
Browse files Browse the repository at this point in the history
…eload (apache#7238)

(cherry picked from commit d0ad836)
  • Loading branch information
devabhishekpal authored Oct 3, 2024
1 parent 2874c52 commit f3fca14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
Expand All @@ -19,7 +19,7 @@
import org.apache.hadoop.ozone.om.exceptions.OMException;

/**
* Default implementation for {@link IAccessAuthorizer}.
* No-op implementation for {@link IAccessAuthorizer}, allows everything.
* */
public class OzoneAccessAuthorizer implements IAccessAuthorizer {

Expand All @@ -35,4 +35,9 @@ public boolean checkAccess(IOzoneObj ozoneObject, RequestContext context)
throws OMException {
return true;
}

@Override
public boolean isNative() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,13 @@ private void instantiateServices(boolean withNewSnapshot) throws IOException {
prefixManager = new PrefixManagerImpl(this, metadataManager, isRatisEnabled);
keyManager = new KeyManagerImpl(this, scmClient, configuration,
perfMetrics);
accessAuthorizer = OzoneAuthorizerFactory.forOM(this);
// If authorizer is not initialized or the authorizer is Native
// re-initialize the authorizer, else for non-native authorizer
// like ranger we can reuse previous value if it is initialized
if (null == accessAuthorizer || accessAuthorizer.isNative()) {
accessAuthorizer = OzoneAuthorizerFactory.forOM(this);
}

omMetadataReader = new OmMetadataReader(keyManager, prefixManager,
this, LOG, AUDIT, metrics, accessAuthorizer);
// Active DB's OmMetadataReader instance does not need to be reference
Expand Down

0 comments on commit f3fca14

Please sign in to comment.