@@ -89,6 +89,7 @@ public class DynamoDBSourceTask extends SourceTask {
89
89
private SourceInfo sourceInfo ;
90
90
private TableDescription tableDesc ;
91
91
private int initSyncDelay ;
92
+ private boolean initSyncEnabled = false ;
92
93
93
94
@ SuppressWarnings ("unused" )
94
95
//Used by Confluent platform to initialize connector
@@ -123,6 +124,7 @@ public void start(Map<String, String> configProperties) {
123
124
tableDesc = client .describeTable (config .getTableName ()).getTable ();
124
125
125
126
initSyncDelay = config .getInitSyncDelay ();
127
+ initSyncEnabled = config .getInitSyncEnable ();
126
128
127
129
LOGGER .debug ("Getting offset for table: {}" , tableDesc .getTableName ());
128
130
setStateFromOffset ();
@@ -163,7 +165,11 @@ private void setStateFromOffset() {
163
165
} else {
164
166
LOGGER .debug ("No stored offset found for table: {}" , tableDesc .getTableName ());
165
167
sourceInfo = new SourceInfo (tableDesc .getTableName (), clock );
166
- sourceInfo .startInitSync (); // InitSyncStatus always needs to run after adding new table
168
+ if (initSyncEnabled ) {
169
+ sourceInfo .startInitSync (); // InitSyncStatus always needs to run after adding new table
170
+ } else {
171
+ sourceInfo .initSyncStatus = InitSyncStatus .FINISHED ;
172
+ }
167
173
}
168
174
}
169
175
@@ -296,7 +302,7 @@ private List<SourceRecord> sync() throws Exception {
296
302
//
297
303
// NOTE2: KCL worker reads from multiple shards at the same time in a loop.
298
304
// Which means that there can be messages from various time instances (before and after init sync start instance).
299
- if (isPreInitSyncRecord (arrivalTimestamp )) {
305
+ if (initSyncEnabled && isPreInitSyncRecord (arrivalTimestamp )) {
300
306
LOGGER .debug (
301
307
"Dropping old record to prevent another INIT_SYNC. ShardId: {} " +
302
308
"ApproximateArrivalTimestamp: {} CurrentTime: {}" ,
@@ -315,7 +321,7 @@ private List<SourceRecord> sync() throws Exception {
315
321
// * connector was down for some time
316
322
// * connector is lagging
317
323
// * connector failed to finish init sync in acceptable time frame
318
- if (recordIsInDangerZone (arrivalTimestamp )) {
324
+ if (initSyncEnabled && recordIsInDangerZone (arrivalTimestamp )) {
319
325
sourceInfo .startInitSync ();
320
326
321
327
LOGGER .info (
0 commit comments