Skip to content

Commit

Permalink
Add debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Sep 30, 2023
1 parent 56fba6c commit 164c7d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ public static Map<String, ShardingSphereSchema> build(final Collection<String> t
}

private static Collection<String> getAllTableNames(final Collection<ShardingSphereRule> rules) {
log.error("======getAllTableNames rules======" + rules);
for (ShardingSphereRule each : rules) {
log.error("======getAllTableNames each======" + each.getClass().getName());
if (each instanceof TableContainedRule) {
log.error("======getAllTableNames getLogicTableMapper======" + ((TableContainedRule) each).getLogicTableMapper());
log.error("======getAllTableNames getLogicTableMapper.getTableNames======" + ((TableContainedRule) each).getLogicTableMapper().getTableNames());
}
}
return rules.stream().filter(TableContainedRule.class::isInstance).flatMap(each -> ((TableContainedRule) each).getLogicTableMapper().getTableNames().stream()).collect(Collectors.toSet());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.shardingsphere.single.rule;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.binder.context.type.IndexAvailable;
import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
Expand Down Expand Up @@ -56,6 +57,7 @@
/**
* Single rule.
*/
@Slf4j
public final class SingleRule implements DatabaseRule, DataNodeContainedRule, TableContainedRule, MutableDataNodeRule, ExportableRule {

@Getter
Expand All @@ -81,7 +83,10 @@ public SingleRule(final SingleRuleConfiguration ruleConfig, final String databas
dataSourceNames = aggregateDataSourceMap.keySet();
databaseType = DatabaseTypeEngine.getStorageType(enabledDataSources.values());
singleTableDataNodes = SingleTableDataNodeLoader.load(databaseName, databaseType, aggregateDataSourceMap, builtRules, configuration.getTables());
log.error("=====SingleRule singleTableDataNodes keySet=====" + singleTableDataNodes.keySet());
log.error("=====SingleRule singleTableDataNodes values=====" + singleTableDataNodes.values());
singleTableDataNodes.forEach((key, value) -> tableNamesMapper.put(value.iterator().next().getTableName()));
log.error("=====SingleRule tableNamesMapper=====" + tableNamesMapper.getTableNames());
}

/**
Expand Down

0 comments on commit 164c7d9

Please sign in to comment.