roryqi commented on code in PR #10116:
URL: https://github.com/apache/gravitino/pull/10116#discussion_r2871276338
##########
iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/RESTService.java:
##########
@@ -95,32 +98,43 @@ private void initServer(IcebergConfig icebergConfig) {
Map<String, String> configProperties = icebergConfig.getAllConfig();
this.configProvider =
IcebergConfigProviderFactory.create(configProperties);
configProvider.initialize(configProperties);
- String metalakeName = configProvider.getMetalakeName();
+ Optional<String> metalakeOpt = configProvider.getMetalakeName();
Boolean enableAuth =
GravitinoEnv.getInstance().config().get(Configs.ENABLE_AUTHORIZATION);
+ Preconditions.checkArgument(
+ metalakeOpt.isPresent() || !enableAuth,
+ "Authorization requires a metalake, but the configured catalog config
provider does not"
+ + " support metalake. Please use a provider that supports metalake
(e.g. dynamic-config-provider)");
EventBus eventBus = GravitinoEnv.getInstance().eventBus();
+
+ String metalakeName = metalakeOpt.orElse(null);
this.icebergCatalogWrapperManager =
new IcebergCatalogWrapperManager(configProperties, configProvider,
auxMode, metalakeName);
IcebergRESTServerContext authorizationContext =
IcebergRESTServerContext.create(
configProvider, enableAuth, auxMode, icebergCatalogWrapperManager);
this.icebergMetricsManager = new IcebergMetricsManager(icebergConfig);
+
+ // Events need a metalake name so just use the default if it's not provided
+ String metalakeForEvents =
metalakeOpt.orElse(IcebergConstants.ICEBERG_REST_DEFAULT_METALAKE);
Review Comment:
Maybe this should be optional, too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]