Skip to content

Commit

Permalink
Refactor RuleItemManager
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Dec 15, 2024
1 parent 79e413d commit bf580ac
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public MetaDataChangedSubscriber(final ContextManager contextManager) {
@Subscribe
public synchronized void renew(final SchemaAddedEvent event) {
contextManager.getMetaDataContextManager().getSchemaMetaDataManager().addSchema(event.getDatabaseName(), event.getSchemaName());
refreshShardingSphereStatisticsData();
refreshStatisticsData();
}

/**
Expand All @@ -68,7 +68,7 @@ public synchronized void renew(final SchemaAddedEvent event) {
@Subscribe
public synchronized void renew(final SchemaDeletedEvent event) {
contextManager.getMetaDataContextManager().getSchemaMetaDataManager().dropSchema(event.getDatabaseName(), event.getSchemaName());
refreshShardingSphereStatisticsData();
refreshStatisticsData();
}

/**
Expand All @@ -84,7 +84,7 @@ public synchronized void renew(final TableCreatedOrAlteredEvent event) {
ShardingSphereTable table = contextManager.getPersistServiceFacade().getMetaDataPersistService().getDatabaseMetaDataFacade().getTable()
.load(event.getDatabaseName(), event.getSchemaName(), event.getTableName());
contextManager.getMetaDataContextManager().getSchemaMetaDataManager().alterSchema(event.getDatabaseName(), event.getSchemaName(), table, null);
refreshShardingSphereStatisticsData();
refreshStatisticsData();
}

/**
Expand All @@ -95,7 +95,7 @@ public synchronized void renew(final TableCreatedOrAlteredEvent event) {
@Subscribe
public synchronized void renew(final TableDroppedEvent event) {
contextManager.getMetaDataContextManager().getSchemaMetaDataManager().alterSchema(event.getDatabaseName(), event.getSchemaName(), event.getTableName(), null);
refreshShardingSphereStatisticsData();
refreshStatisticsData();
}

/**
Expand All @@ -111,7 +111,7 @@ public synchronized void renew(final ViewCreatedOrAlteredEvent event) {
ShardingSphereView view = contextManager.getPersistServiceFacade().getMetaDataPersistService().getDatabaseMetaDataFacade().getView()
.load(event.getDatabaseName(), event.getSchemaName(), event.getViewName());
contextManager.getMetaDataContextManager().getSchemaMetaDataManager().alterSchema(event.getDatabaseName(), event.getSchemaName(), null, view);
refreshShardingSphereStatisticsData();
refreshStatisticsData();
}

/**
Expand All @@ -122,10 +122,10 @@ public synchronized void renew(final ViewCreatedOrAlteredEvent event) {
@Subscribe
public synchronized void renew(final ViewDroppedEvent event) {
contextManager.getMetaDataContextManager().getSchemaMetaDataManager().alterSchema(event.getDatabaseName(), event.getSchemaName(), null, event.getViewName());
refreshShardingSphereStatisticsData();
refreshStatisticsData();
}

private void refreshShardingSphereStatisticsData() {
private void refreshStatisticsData() {
if (contextManager.getComputeNodeInstanceContext().getModeConfiguration().isCluster()
&& InstanceType.PROXY == contextManager.getComputeNodeInstanceContext().getInstance().getMetaData().getType()) {
new ShardingSphereStatisticsRefreshEngine(contextManager, new GlobalLockContext(new GlobalLockPersistService(repository))).asyncRefresh();
Expand Down

0 comments on commit bf580ac

Please sign in to comment.