justbk2015 commented on a change in pull request #12749:
URL: https://github.com/apache/shardingsphere/pull/12749#discussion_r716383952



##########
File path: 
shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/common/sqlbuilder/ScalingSQLBuilder.java
##########
@@ -44,6 +47,17 @@
      */
     String buildUpdateSQL(DataRecord dataRecord, Collection<Column> 
conditionColumns);
     
+    /**
+     * Extract need updated columns.
+     *
+     * @param columns the input columns
+     * @param record the input datarecord
+     * @return the filtered columns.
+     */
+    default List<Column> extractUpdatedColumns(Collection<Column> columns, 
DataRecord record) {
+        return new ArrayList<>(RecordUtil.extractUpdatedColumns(record));
+    }

Review comment:
       no we can't, this interface I have used in openGuassScalingSQLBuilder, 
and I skip to update sharding-key value.this is default behaive to filter the 
isUpdate setted attribute.

##########
File path: 
shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/OpenGaussWalDumper.java
##########
@@ -57,6 +61,8 @@
     private final OpenGaussLogicalReplication logicalReplication = new 
OpenGaussLogicalReplication();
 
     private final WalEventConverter walEventConverter;
+    
+    private String slotName = OpenGaussLogicalReplication.SLOT_NAME_PREFIX;

Review comment:
       no, this slotName is changable in initReplication function. to set 
default to SLOT_NAME_PREFIX just to avoid NPE issue when getUniqueSlotName 
throw EXception.

##########
File path: 
shardingsphere-scaling/shardingsphere-scaling-dialect/shardingsphere-scaling-opengauss/src/main/java/org/apache/shardingsphere/scaling/opengauss/component/OpenGaussWalDumper.java
##########
@@ -123,6 +131,21 @@ private void dump() {
         }
     }
 
+    private void updateRecordOldValue(final Record record) {
+        if (!(record instanceof DataRecord)) {
+            return;
+        }
+        DataRecord dataRecord = (DataRecord) record;
+        if (!ScalingConstant.UPDATE.equals(dataRecord.getType())) {
+            return;
+        }
+        for (Column col: dataRecord.getColumns()) {
+            if (col.isPrimaryKey() && col.isUpdated()) {
+                col.setOldValue(col.getValue());
+            }

Review comment:
       The Column constructor was called in WalEventConverter::convert,  modify 
will influence pg. so I moved here ,and only effect on openGuass.




-- 
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]


Reply via email to