@@ -104,10 +104,24 @@ protected String logProxyOptionsString() {
104
104
+ String .format (" 'rootserver-list' = '%s'" , METADATA .getRsList ());
105
105
}
106
106
107
+ /**
108
+ * Current OceanBase connector uses timestamp (in seconds) to mark the offset during the
109
+ * transition from {@code SNAPSHOT} to {@code STREAMING} mode. Thus, if some snapshot inserting
110
+ * events are too close to the transitioning offset, snapshot inserting events might be emitted
111
+ * multiple times. <br>
112
+ * This could be safely removed after switching to incremental snapshot framework which provides
113
+ * Exactly-once guarantee.
114
+ */
115
+ private void waitForTableInitialization () throws InterruptedException {
116
+ Thread .sleep (5000L );
117
+ }
118
+
107
119
@ Test
108
120
public void testTableList () throws Exception {
109
121
inventoryDatabase = new UniqueDatabase (OB_SERVER , "inventory" );
110
122
inventoryDatabase .createAndInitialize ("mysql" );
123
+ waitForTableInitialization ();
124
+
111
125
String sourceDDL =
112
126
String .format (
113
127
"CREATE TABLE ob_source ("
@@ -212,6 +226,8 @@ public void testTableList() throws Exception {
212
226
public void testMetadataColumns () throws Exception {
213
227
inventoryDatabase = new UniqueDatabase (OB_SERVER , "inventory" );
214
228
inventoryDatabase .createAndInitialize ("mysql" );
229
+ waitForTableInitialization ();
230
+
215
231
String sourceDDL =
216
232
String .format (
217
233
"CREATE TABLE ob_source ("
@@ -297,6 +313,7 @@ public void testAllDataTypes() throws Exception {
297
313
298
314
columnTypesDatabase = new UniqueDatabase (OB_SERVER , "column_type_test" );
299
315
columnTypesDatabase .createAndInitialize ("mysql" );
316
+ waitForTableInitialization ();
300
317
301
318
String sourceDDL =
302
319
String .format (
@@ -488,6 +505,7 @@ public void testTimeDataTypes(String serverTimeZone) throws Exception {
488
505
489
506
columnTypesDatabase = new UniqueDatabase (OB_SERVER , "column_type_test" );
490
507
columnTypesDatabase .createAndInitialize ("mysql" );
508
+ waitForTableInitialization ();
491
509
492
510
String sourceDDL =
493
511
String .format (
@@ -559,6 +577,7 @@ public void testTimeDataTypes(String serverTimeZone) throws Exception {
559
577
public void testSnapshotOnly () throws Exception {
560
578
inventoryDatabase = new UniqueDatabase (OB_SERVER , "inventory" );
561
579
inventoryDatabase .createAndInitialize ("mysql" );
580
+ waitForTableInitialization ();
562
581
563
582
String sourceDDL =
564
583
String .format (
@@ -611,7 +630,7 @@ public void testSnapshotOnly() throws Exception {
611
630
612
631
while (result .getJobClient ().get ().getJobStatus ().get ().equals (JobStatus .RUNNING )) {
613
632
Thread .sleep (100 );
614
- // Waiting for job to quit, in case if
633
+ // Waiting for job to finish (SNAPSHOT job will end spontaneously)
615
634
}
616
635
}
617
636
}
0 commit comments