sandynz commented on code in PR #20111:
URL: https://github.com/apache/shardingsphere/pull/20111#discussion_r944175260
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/task/MySQLIncrementTask.java:
##########
@@ -61,14 +62,16 @@ public void run() {
private Object insertOrder() {
ThreadLocalRandom random = ThreadLocalRandom.current();
String status = random.nextInt() % 2 == 0 ? null : "NOT-NULL";
- Object[] orderInsertDate = new
Object[]{keyGenerateAlgorithm.generateKey(), random.nextInt(0, 6),
random.nextInt(0, 6), random.nextInt(1, 99), status};
+ Object[] orderInsertDate = new
Object[]{keyGenerateAlgorithm.generateKey(),
ScalingCaseHelper.SNOWFLAKE_KEY_GENERATE_ALGORITHM.generateKey(),
random.nextInt(0, 6),
+ random.nextInt(1, 99), status};
Review Comment:
1, There're 2 key generate algorithm, could we just use one? Just like
general IT.
2, It's better to encapsulate
`ScalingCaseHelper.SNOWFLAKE_KEY_GENERATE_ALGORITHM.generateKey()` if it's
necessary.
##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/dumper/AbstractInventoryDumper.java:
##########
@@ -167,12 +167,11 @@ private Optional<Object> dump0(final Connection conn,
final String sql, final in
record.setType(IngestDataChangeType.INSERT);
record.setTableName(logicTableName);
for (int i = 1; i <= metaData.getColumnCount(); i++) {
- boolean isUniqueKey = tableMetaData.isUniqueKey(i - 1);
Object value = readValue(resultSet, i);
- if (isUniqueKey) {
+ if (tableMetaData.isPrimaryKey(i - 1)) {
maxUniqueKeyValue = value;
}
- record.addColumn(new Column(metaData.getColumnName(i),
value, true, isUniqueKey));
+ record.addColumn(new Column(metaData.getColumnName(i),
value, true, tableMetaData.isUniqueKey(i - 1)));
}
Review Comment:
Rollback might be not enough, since we need to support unique key (without
primary key) table migration
--
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]