Skip to content

Commit

Permalink
Bind Metastore Cache Invalidation Procedure with Delta Connector
Browse files Browse the repository at this point in the history
  • Loading branch information
imjalpreet committed Nov 11, 2024
1 parent b86a4a6 commit 01c1ed9
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package com.facebook.presto.delta;

import com.facebook.airlift.configuration.AbstractConfigurationAwareModule;
import com.facebook.presto.cache.CacheConfig;
import com.facebook.presto.cache.CacheFactory;
import com.facebook.presto.cache.CacheStats;
Expand All @@ -30,6 +31,7 @@
import com.facebook.presto.hive.HdfsEnvironment;
import com.facebook.presto.hive.HiveClientConfig;
import com.facebook.presto.hive.HiveHdfsConfiguration;
import com.facebook.presto.hive.InvalidateMetastoreCacheProcedure;
import com.facebook.presto.hive.MetastoreClientConfig;
import com.facebook.presto.hive.PartitionMutator;
import com.facebook.presto.hive.cache.HiveCachingHdfsConfiguration;
Expand All @@ -42,12 +44,13 @@
import com.facebook.presto.hive.metastore.InMemoryCachingHiveMetastore;
import com.facebook.presto.hive.metastore.MetastoreCacheStats;
import com.facebook.presto.hive.metastore.MetastoreConfig;
import com.facebook.presto.spi.procedure.Procedure;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.FromStringDeserializer;
import com.google.inject.Binder;
import com.google.inject.Module;
import com.google.inject.Provides;
import com.google.inject.Scopes;
import com.google.inject.multibindings.Multibinder;

import javax.inject.Inject;
import javax.inject.Singleton;
Expand All @@ -67,7 +70,7 @@
import static org.weakref.jmx.guice.ExportBinder.newExporter;

public class DeltaModule
implements Module
extends AbstractConfigurationAwareModule
{
private final String connectorId;
private final TypeManager typeManager;
Expand All @@ -79,7 +82,7 @@ public DeltaModule(String connectorId, TypeManager typeManager)
}

@Override
public void configure(Binder binder)
public void setup(Binder binder)
{
binder.bind(TypeManager.class).toInstance(typeManager);
configBinder(binder).bindConfig(FileMergeCacheConfig.class);
Expand Down Expand Up @@ -120,6 +123,11 @@ public void configure(Binder binder)

binder.bind(FileFormatDataSourceStats.class).in(Scopes.SINGLETON);
newExporter(binder).export(FileFormatDataSourceStats.class).as(generatedNameOf(FileFormatDataSourceStats.class, connectorId));

Multibinder<Procedure> procedures = newSetBinder(binder, Procedure.class);
if (buildConfigObject(HiveClientConfig.class).isInvalidateMetastoreCacheProcedureEnabled()) {
procedures.addBinding().toProvider(InvalidateMetastoreCacheProcedure.class).in(Scopes.SINGLETON);
}
}

public static final class TypeDeserializer
Expand Down

0 comments on commit 01c1ed9

Please sign in to comment.