Skip to content

Commit

Permalink
Rename InventoryIncrementalRule to TransmissionRule (#29148)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Nov 24, 2023
1 parent da8368c commit 8a18cdf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void assertSwapWithFullConfig() {
}

@Test
void assertSwapWithoutInventoryIncremental() {
void assertSwapWithoutTransmission() {
YamlTransmissionJobItemProgress yamlProgress = YamlEngine.unmarshal(ConfigurationFileUtils.readFile("job-progress-failure.yaml"), YamlTransmissionJobItemProgress.class);
TransmissionJobItemProgress progress = SWAPPER.swapToObject(yamlProgress);
assertNotNull(progress.getInventory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ showStreamingRule
;

alterStreamingRule
: ALTER STREAMING RULE inventoryIncrementalRule?
: ALTER STREAMING RULE transmissionRule?
;

inventoryIncrementalRule
transmissionRule
: LP_ readDefinition? (COMMA_? writeDefinition)? (COMMA_? streamChannel)? RP_
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.AlterStreamingRuleContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.BatchSizeContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.DropStreamingContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.InventoryIncrementalRuleContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.PropertiesDefinitionContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.PropertyContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.RateLimiterContext;
Expand All @@ -37,11 +36,12 @@
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.ShowStreamingRuleContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.ShowStreamingStatusContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.StreamChannelContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.TransmissionRuleContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.WorkerThreadContext;
import org.apache.shardingsphere.distsql.parser.autogen.CDCDistSQLStatementParser.WriteDefinitionContext;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import org.apache.shardingsphere.distsql.segment.TransmissionRuleSegment;
import org.apache.shardingsphere.distsql.segment.ReadOrWriteSegment;
import org.apache.shardingsphere.distsql.segment.TransmissionRuleSegment;
import org.apache.shardingsphere.distsql.statement.ral.updatable.AlterTransmissionRuleStatement;
import org.apache.shardingsphere.sql.parser.api.ASTNode;
import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
Expand Down Expand Up @@ -80,13 +80,13 @@ public ASTNode visitShowStreamingRule(final ShowStreamingRuleContext ctx) {

@Override
public ASTNode visitAlterStreamingRule(final AlterStreamingRuleContext ctx) {
TransmissionRuleSegment segment = null == ctx.inventoryIncrementalRule() ? null
: (TransmissionRuleSegment) visit(ctx.inventoryIncrementalRule());
TransmissionRuleSegment segment = null == ctx.transmissionRule() ? null
: (TransmissionRuleSegment) visit(ctx.transmissionRule());
return new AlterTransmissionRuleStatement("STREAMING", segment);
}

@Override
public ASTNode visitInventoryIncrementalRule(final InventoryIncrementalRuleContext ctx) {
public ASTNode visitTransmissionRule(final TransmissionRuleContext ctx) {
TransmissionRuleSegment result = new TransmissionRuleSegment();
if (null != ctx.readDefinition()) {
result.setReadSegment((ReadOrWriteSegment) visit(ctx.readDefinition()));
Expand Down
4 changes: 2 additions & 2 deletions parser/distsql/engine/src/main/antlr4/imports/RALStatement.g4
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ showMigrationRule
;

alterMigrationRule
: ALTER MIGRATION RULE inventoryIncrementalRule?
: ALTER MIGRATION RULE transmissionRule?
;

lockCluster
Expand All @@ -115,7 +115,7 @@ unlockCluster
: UNLOCK CLUSTER
;

inventoryIncrementalRule
transmissionRule
: LP_ readDefinition? (COMMA_? writeDefinition)? (COMMA_? streamChannel)? RP_
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ImportDatabaseConfigurationContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ImportMetaDataContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.InstanceIdContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.InventoryIncrementalRuleContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.LabelComputeNodeContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.LockClusterContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.PasswordContext;
Expand All @@ -63,6 +62,7 @@
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowTableMetadataContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.StorageUnitDefinitionContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.StreamChannelContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.TransmissionRuleContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.UnlabelComputeNodeContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.UnlockClusterContext;
import org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.UnregisterStorageUnitContext;
Expand All @@ -71,8 +71,8 @@
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import org.apache.shardingsphere.distsql.segment.DataSourceSegment;
import org.apache.shardingsphere.distsql.segment.HostnameAndPortBasedDataSourceSegment;
import org.apache.shardingsphere.distsql.segment.TransmissionRuleSegment;
import org.apache.shardingsphere.distsql.segment.ReadOrWriteSegment;
import org.apache.shardingsphere.distsql.segment.TransmissionRuleSegment;
import org.apache.shardingsphere.distsql.segment.URLBasedDataSourceSegment;
import org.apache.shardingsphere.distsql.statement.ral.queryable.ConvertYamlConfigurationStatement;
import org.apache.shardingsphere.distsql.statement.ral.queryable.ExportDatabaseConfigurationStatement;
Expand Down Expand Up @@ -312,13 +312,13 @@ public ASTNode visitShowMigrationRule(final ShowMigrationRuleContext ctx) {

@Override
public ASTNode visitAlterMigrationRule(final AlterMigrationRuleContext ctx) {
TransmissionRuleSegment segment = null == ctx.inventoryIncrementalRule() ? null
: (TransmissionRuleSegment) visit(ctx.inventoryIncrementalRule());
TransmissionRuleSegment segment = null == ctx.transmissionRule() ? null
: (TransmissionRuleSegment) visit(ctx.transmissionRule());
return new AlterTransmissionRuleStatement("MIGRATION", segment);
}

@Override
public ASTNode visitInventoryIncrementalRule(final InventoryIncrementalRuleContext ctx) {
public ASTNode visitTransmissionRule(final TransmissionRuleContext ctx) {
TransmissionRuleSegment result = new TransmissionRuleSegment();
if (null != ctx.readDefinition()) {
result.setReadSegment((ReadOrWriteSegment) visit(ctx.readDefinition()));
Expand Down

0 comments on commit 8a18cdf

Please sign in to comment.