6060import java .util .Objects ;
6161import java .util .concurrent .atomic .AtomicReference ;
6262
63+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_DATABASE_KEY ;
64+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_DATABASE_NAME_KEY ;
6365import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_END_TIME_KEY ;
6466import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_HISTORY_ENABLE_DEFAULT_VALUE ;
6567import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_HISTORY_ENABLE_KEY ;
7779import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_MODE_STRICT_KEY ;
7880import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_MODS_ENABLE_KEY ;
7981import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_MODS_KEY ;
82+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_PATH_KEY ;
8083import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_PATTERN_FORMAT_IOTDB_VALUE ;
8184import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_PATTERN_FORMAT_KEY ;
8285import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_PATTERN_FORMAT_PREFIX_VALUE ;
86+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_PATTERN_KEY ;
8387import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE ;
8488import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_REALTIME_ENABLE_KEY ;
8589import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_REALTIME_LOOSE_RANGE_KEY ;
9195import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_REALTIME_MODE_LOG_VALUE ;
9296import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_REALTIME_MODE_STREAM_MODE_VALUE ;
9397import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_START_TIME_KEY ;
98+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_TABLE_KEY ;
99+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_TABLE_NAME_KEY ;
94100import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_WATERMARK_INTERVAL_DEFAULT_VALUE ;
95101import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .EXTRACTOR_WATERMARK_INTERVAL_KEY ;
102+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_DATABASE_KEY ;
103+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_DATABASE_NAME_KEY ;
96104import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_END_TIME_KEY ;
97105import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_HISTORY_ENABLE_KEY ;
98106import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_HISTORY_END_TIME_KEY ;
104112import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_MODE_STRICT_KEY ;
105113import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_MODS_ENABLE_KEY ;
106114import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_MODS_KEY ;
115+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_PATH_KEY ;
107116import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_PATTERN_FORMAT_KEY ;
117+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_PATTERN_KEY ;
108118import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_REALTIME_ENABLE_KEY ;
109119import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_REALTIME_LOOSE_RANGE_KEY ;
110120import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_REALTIME_MODE_KEY ;
111121import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_START_TIME_KEY ;
122+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_TABLE_KEY ;
123+ import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_TABLE_NAME_KEY ;
112124import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant .SOURCE_WATERMARK_INTERVAL_KEY ;
113125import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant ._EXTRACTOR_WATERMARK_INTERVAL_KEY ;
114126import static org .apache .iotdb .commons .pipe .config .constant .PipeExtractorConstant ._SOURCE_WATERMARK_INTERVAL_KEY ;
@@ -174,25 +186,22 @@ public void validate(final PipeParameterValidator validator) throws Exception {
174186 && validator
175187 .getParameters ()
176188 .hasAnyAttributes (
177- PipeExtractorConstant .EXTRACTOR_PATH_KEY ,
178- PipeExtractorConstant .SOURCE_PATH_KEY ,
179- PipeExtractorConstant .EXTRACTOR_PATTERN_KEY ,
180- PipeExtractorConstant .SOURCE_PATTERN_KEY )) {
189+ EXTRACTOR_PATH_KEY , SOURCE_PATH_KEY , EXTRACTOR_PATTERN_KEY , SOURCE_PATTERN_KEY )) {
181190 throw new PipeException (
182191 "The pipe cannot extract tree model data when sql dialect is set to table." );
183192 }
184193 if (!isTableModelDataAllowedToBeCaptured
185194 && validator
186195 .getParameters ()
187196 .hasAnyAttributes (
188- PipeExtractorConstant . EXTRACTOR_DATABASE_NAME_KEY ,
189- PipeExtractorConstant . SOURCE_DATABASE_NAME_KEY ,
190- PipeExtractorConstant . EXTRACTOR_TABLE_NAME_KEY ,
191- PipeExtractorConstant . SOURCE_TABLE_NAME_KEY ,
192- PipeExtractorConstant . EXTRACTOR_DATABASE_KEY ,
193- PipeExtractorConstant . SOURCE_DATABASE_KEY ,
194- PipeExtractorConstant . EXTRACTOR_TABLE_KEY ,
195- PipeExtractorConstant . SOURCE_TABLE_KEY )) {
197+ EXTRACTOR_DATABASE_NAME_KEY ,
198+ SOURCE_DATABASE_NAME_KEY ,
199+ EXTRACTOR_TABLE_NAME_KEY ,
200+ SOURCE_TABLE_NAME_KEY ,
201+ EXTRACTOR_DATABASE_KEY ,
202+ SOURCE_DATABASE_KEY ,
203+ EXTRACTOR_TABLE_KEY ,
204+ SOURCE_TABLE_KEY )) {
196205 throw new PipeException (
197206 "The pipe cannot extract table model data when sql dialect is set to tree." );
198207 }
@@ -287,7 +296,7 @@ public void validate(final PipeParameterValidator validator) throws Exception {
287296 EXTRACTOR_REALTIME_MODE_BATCH_MODE_VALUE );
288297 }
289298
290- checkInvalidParameters (validator . getParameters () );
299+ checkInvalidParameters (validator );
291300
292301 constructHistoricalExtractor ();
293302 constructRealtimeExtractor (validator .getParameters ());
@@ -319,7 +328,9 @@ private void validatePattern(final TreePattern treePattern, final TablePattern t
319328 }
320329 }
321330
322- private void checkInvalidParameters (final PipeParameters parameters ) {
331+ private void checkInvalidParameters (final PipeParameterValidator validator ) {
332+ final PipeParameters parameters = validator .getParameters ();
333+
323334 // Enable history and realtime if specifying start-time or end-time
324335 if (parameters .hasAnyAttributes (
325336 SOURCE_START_TIME_KEY ,
@@ -343,87 +354,66 @@ private void checkInvalidParameters(final PipeParameters parameters) {
343354 EXTRACTOR_HISTORY_END_TIME_KEY );
344355 }
345356
357+ // Check coexistence of database-name and database
358+ validator .validateSynonymAttributes (
359+ Arrays .asList (EXTRACTOR_DATABASE_NAME_KEY , SOURCE_DATABASE_NAME_KEY ),
360+ Arrays .asList (EXTRACTOR_DATABASE_KEY , SOURCE_DATABASE_KEY ),
361+ false );
362+
363+ // Check coexistence of table-name and table
364+ validator .validateSynonymAttributes (
365+ Arrays .asList (EXTRACTOR_TABLE_NAME_KEY , SOURCE_TABLE_NAME_KEY ),
366+ Arrays .asList (EXTRACTOR_TABLE_KEY , SOURCE_TABLE_KEY ),
367+ false );
368+
346369 // Check coexistence of mode.snapshot and mode
347- if (parameters .hasAnyAttributes (EXTRACTOR_MODE_SNAPSHOT_KEY , SOURCE_MODE_SNAPSHOT_KEY )
348- && parameters .hasAnyAttributes (EXTRACTOR_MODE_KEY , SOURCE_MODE_KEY )) {
349- LOGGER .warn (
350- "When {} or {} is specified, specifying {} and {} is invalid." ,
351- EXTRACTOR_MODE_SNAPSHOT_KEY ,
352- SOURCE_MODE_SNAPSHOT_KEY ,
353- EXTRACTOR_MODE_KEY ,
354- SOURCE_MODE_KEY );
355- }
370+ validator .validateSynonymAttributes (
371+ Arrays .asList (EXTRACTOR_MODE_SNAPSHOT_KEY , SOURCE_MODE_SNAPSHOT_KEY ),
372+ Arrays .asList (EXTRACTOR_MODE_KEY , SOURCE_MODE_KEY ),
373+ false );
356374
357375 // Check coexistence of mode.streaming and realtime.mode
358- if (parameters .hasAnyAttributes (EXTRACTOR_MODE_STREAMING_KEY , SOURCE_MODE_STREAMING_KEY )
359- && parameters .hasAnyAttributes (EXTRACTOR_REALTIME_MODE_KEY , SOURCE_REALTIME_MODE_KEY )) {
360- LOGGER .warn (
361- "When {} or {} is specified, specifying {} and {} is invalid." ,
362- EXTRACTOR_MODE_STREAMING_KEY ,
363- SOURCE_MODE_STREAMING_KEY ,
364- EXTRACTOR_REALTIME_MODE_KEY ,
365- SOURCE_REALTIME_MODE_KEY );
366- }
376+ validator .validateSynonymAttributes (
377+ Arrays .asList (EXTRACTOR_MODE_STREAMING_KEY , SOURCE_MODE_STREAMING_KEY ),
378+ Arrays .asList (EXTRACTOR_REALTIME_MODE_KEY , SOURCE_REALTIME_MODE_KEY ),
379+ false );
367380
368381 // Check coexistence of mode.strict, history.loose-range and realtime.loose-range
369- if (parameters .hasAnyAttributes (EXTRACTOR_MODE_STRICT_KEY , SOURCE_MODE_STRICT_KEY )) {
370- if (parameters .hasAnyAttributes (
371- EXTRACTOR_HISTORY_LOOSE_RANGE_KEY , SOURCE_HISTORY_LOOSE_RANGE_KEY )) {
372- LOGGER .warn (
373- "When {} or {} is specified, specifying {} and {} is invalid." ,
374- EXTRACTOR_MODE_STRICT_KEY ,
375- SOURCE_MODE_STRICT_KEY ,
382+ validator .validateSynonymAttributes (
383+ Arrays .asList (EXTRACTOR_MODE_STRICT_KEY , SOURCE_MODE_STRICT_KEY ),
384+ Arrays .asList (
376385 EXTRACTOR_HISTORY_LOOSE_RANGE_KEY ,
377- SOURCE_HISTORY_LOOSE_RANGE_KEY );
378- }
379- if (parameters .hasAnyAttributes (
380- EXTRACTOR_REALTIME_LOOSE_RANGE_KEY , SOURCE_REALTIME_LOOSE_RANGE_KEY )) {
381- LOGGER .warn (
382- "When {} or {} is specified, specifying {} and {} is invalid." ,
383- EXTRACTOR_MODE_STRICT_KEY ,
384- SOURCE_MODE_STRICT_KEY ,
386+ SOURCE_HISTORY_LOOSE_RANGE_KEY ,
385387 EXTRACTOR_REALTIME_LOOSE_RANGE_KEY ,
386- SOURCE_REALTIME_LOOSE_RANGE_KEY );
387- }
388- }
388+ SOURCE_REALTIME_LOOSE_RANGE_KEY ),
389+ false );
389390
390391 // Check coexistence of mods and mods.enable
391- if (parameters .hasAnyAttributes (EXTRACTOR_MODS_ENABLE_KEY , SOURCE_MODS_ENABLE_KEY )
392- && parameters .hasAnyAttributes (EXTRACTOR_MODS_KEY , SOURCE_MODS_KEY )) {
393- LOGGER .warn (
394- "When {} or {} is specified, specifying {} and {} is invalid." ,
395- EXTRACTOR_MODS_KEY ,
396- SOURCE_MODS_KEY ,
397- EXTRACTOR_MODS_ENABLE_KEY ,
398- SOURCE_MODS_ENABLE_KEY );
399- }
392+ validator .validateSynonymAttributes (
393+ Arrays .asList (EXTRACTOR_MODS_ENABLE_KEY , SOURCE_MODS_ENABLE_KEY ),
394+ Arrays .asList (EXTRACTOR_MODS_KEY , SOURCE_MODS_KEY ),
395+ false );
400396
401397 // Check coexistence of watermark.interval-ms and watermark-interval-ms
402- if (parameters .hasAnyAttributes (EXTRACTOR_WATERMARK_INTERVAL_KEY , SOURCE_WATERMARK_INTERVAL_KEY )
403- && parameters .hasAnyAttributes (
404- _EXTRACTOR_WATERMARK_INTERVAL_KEY , _SOURCE_WATERMARK_INTERVAL_KEY )) {
405- LOGGER .warn (
406- "When {} or {} is specified, specifying {} and {} is invalid." ,
407- EXTRACTOR_WATERMARK_INTERVAL_KEY ,
408- SOURCE_WATERMARK_INTERVAL_KEY ,
409- _EXTRACTOR_WATERMARK_INTERVAL_KEY ,
410- _SOURCE_WATERMARK_INTERVAL_KEY );
411- }
398+ validator .validateSynonymAttributes (
399+ Arrays .asList (EXTRACTOR_WATERMARK_INTERVAL_KEY , SOURCE_WATERMARK_INTERVAL_KEY ),
400+ Arrays .asList (_EXTRACTOR_WATERMARK_INTERVAL_KEY , _SOURCE_WATERMARK_INTERVAL_KEY ),
401+ false );
412402
413403 // Check if specifying mode.snapshot or mode.streaming when disable realtime extractor
414404 if (!parameters .getBooleanOrDefault (
415405 Arrays .asList (EXTRACTOR_REALTIME_ENABLE_KEY , SOURCE_REALTIME_ENABLE_KEY ),
416406 EXTRACTOR_REALTIME_ENABLE_DEFAULT_VALUE )) {
417407 if (parameters .hasAnyAttributes (EXTRACTOR_MODE_SNAPSHOT_KEY , SOURCE_MODE_SNAPSHOT_KEY )) {
418- LOGGER .info (
408+ LOGGER .warn (
419409 "When '{}' ('{}') is set to false, specifying {} and {} is invalid." ,
420410 EXTRACTOR_REALTIME_ENABLE_KEY ,
421411 SOURCE_REALTIME_ENABLE_KEY ,
422412 EXTRACTOR_MODE_SNAPSHOT_KEY ,
423413 SOURCE_MODE_SNAPSHOT_KEY );
424414 }
425415 if (parameters .hasAnyAttributes (EXTRACTOR_MODE_STREAMING_KEY , SOURCE_MODE_STREAMING_KEY )) {
426- LOGGER .info (
416+ LOGGER .warn (
427417 "When '{}' ('{}') is set to false, specifying {} and {} is invalid." ,
428418 EXTRACTOR_REALTIME_ENABLE_KEY ,
429419 SOURCE_REALTIME_ENABLE_KEY ,
0 commit comments