azexcy commented on code in PR #30498:
URL: https://github.com/apache/shardingsphere/pull/30498#discussion_r1527759236


##########
kernel/data-pipeline/dialect/opengauss/src/test/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/wal/decode/MppdbDecodingPluginTest.java:
##########
@@ -237,21 +238,41 @@ void assertDecodeWithXid() {
         tableData.setColumnsVal(new String[]{"'7D'"});
         List<String> dataList = Arrays.asList("BEGIN 1", 
JsonUtils.toJsonString(tableData), JsonUtils.toJsonString(tableData),
                 "COMMIT 1 (at 2022-10-27 04:19:39.476261+00) CSN 3468");
-        MppdbDecodingPlugin mppdbDecodingPlugin = new 
MppdbDecodingPlugin(null, true);
+        MppdbDecodingPlugin mppdbDecodingPlugin = new 
MppdbDecodingPlugin(null, true, 2);
         List<AbstractWALEvent> expectedEvent = new LinkedList<>();
         for (String each : dataList) {
             
expectedEvent.add(mppdbDecodingPlugin.decode(ByteBuffer.wrap(each.getBytes()), 
logSequenceNumber));
         }
         assertThat(expectedEvent.size(), is(4));
         AbstractWALEvent actualFirstEvent = expectedEvent.get(0);
         assertInstanceOf(BeginTXEvent.class, actualFirstEvent);
-        assertThat(((BeginTXEvent) actualFirstEvent).getXid(), is(1L));
         AbstractWALEvent actualLastEvent = 
expectedEvent.get(expectedEvent.size() - 1);
         assertInstanceOf(CommitTXEvent.class, actualLastEvent);
         assertThat(((CommitTXEvent) actualLastEvent).getCsn(), is(3468L));
         assertThat(((CommitTXEvent) actualLastEvent).getXid(), is(1L));
     }
     
+    @Test
+    void assertParallelDecodeWithTx() {
+        MppTableData tableData = new MppTableData();
+        tableData.setTableName("public.test");
+        tableData.setOpType("INSERT");
+        tableData.setColumnsName(new String[]{"data"});
+        tableData.setColumnsType(new String[]{"raw"});
+        tableData.setColumnsVal(new String[]{"'7D'"});
+        List<String> dataList = Arrays.asList("BEGIN CSN: 951909 first_lsn: 
5/59825858", JsonUtils.toJsonString(tableData), 
JsonUtils.toJsonString(tableData), "commit xid: 1006076");
+        MppdbDecodingPlugin mppdbDecodingPlugin = new 
MppdbDecodingPlugin(null, true, 3);
+        List<AbstractWALEvent> expectedEvents = new LinkedList<>();
+        for (String each : dataList) {
+            
expectedEvents.add(mppdbDecodingPlugin.decode(ByteBuffer.wrap(each.getBytes()), 
logSequenceNumber));
+        }
+        assertThat(expectedEvents.size(), is(4));
+        assertInstanceOf(BeginTXEvent.class, expectedEvents.get(0));
+        assertThat(((BeginTXEvent) expectedEvents.get(0)).getCsn(), 
is(951909L));
+        assertThat(((CommitTXEvent) expectedEvents.get(3)).getXid(), 
is(1006076L));
+        assertNull(((CommitTXEvent) expectedEvents.get(3)).getCsn());

Review Comment:
   AbstractRowEvent set CSN at OpenGaussWALDumper, so at `decode` method , CSN 
is always null



-- 
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: notifications-unsubscr...@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to