Skip to content

Commit 5d5e047

Browse files
authored
Pipe: Set WAL to uncompressed when using real-time sync (#15733)
1 parent ca2ad11 commit 5d5e047

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/extractor/dataregion/IoTDBDataRegionExtractor.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.apache.iotdb.pipe.api.exception.PipeException;
5454
import org.apache.iotdb.pipe.api.exception.PipeParameterNotValidException;
5555

56+
import org.apache.tsfile.file.metadata.enums.CompressionType;
5657
import org.apache.tsfile.utils.Pair;
5758
import org.slf4j.Logger;
5859
import org.slf4j.LoggerFactory;
@@ -468,7 +469,7 @@ private void constructRealtimeExtractor(final PipeParameters parameters)
468469
// Use hybrid mode by default
469470
if (!parameters.hasAnyAttributes(EXTRACTOR_MODE_STREAMING_KEY, SOURCE_MODE_STREAMING_KEY)
470471
&& !parameters.hasAnyAttributes(EXTRACTOR_REALTIME_MODE_KEY, SOURCE_REALTIME_MODE_KEY)) {
471-
checkWalEnable(parameters);
472+
checkWalEnableAndSetUncompressed(parameters);
472473
realtimeExtractor = new PipeRealtimeDataRegionHybridExtractor();
473474
LOGGER.info(
474475
"Pipe: '{}' ('{}') and '{}' ('{}') is not set, use hybrid mode by default.",
@@ -485,7 +486,7 @@ private void constructRealtimeExtractor(final PipeParameters parameters)
485486
Arrays.asList(EXTRACTOR_MODE_STREAMING_KEY, SOURCE_MODE_STREAMING_KEY),
486487
EXTRACTOR_MODE_STREAMING_DEFAULT_VALUE);
487488
if (isStreamingMode) {
488-
checkWalEnable(parameters);
489+
checkWalEnableAndSetUncompressed(parameters);
489490
realtimeExtractor = new PipeRealtimeDataRegionHybridExtractor();
490491
} else {
491492
realtimeExtractor = new PipeRealtimeDataRegionTsFileExtractor();
@@ -501,15 +502,15 @@ private void constructRealtimeExtractor(final PipeParameters parameters)
501502
case EXTRACTOR_REALTIME_MODE_HYBRID_VALUE:
502503
case EXTRACTOR_REALTIME_MODE_LOG_VALUE:
503504
case EXTRACTOR_REALTIME_MODE_STREAM_MODE_VALUE:
504-
checkWalEnable(parameters);
505+
checkWalEnableAndSetUncompressed(parameters);
505506
realtimeExtractor = new PipeRealtimeDataRegionHybridExtractor();
506507
break;
507508
case EXTRACTOR_REALTIME_MODE_FORCED_LOG_VALUE:
508-
checkWalEnable(parameters);
509+
checkWalEnableAndSetUncompressed(parameters);
509510
realtimeExtractor = new PipeRealtimeDataRegionLogExtractor();
510511
break;
511512
default:
512-
checkWalEnable(parameters);
513+
checkWalEnableAndSetUncompressed(parameters);
513514
realtimeExtractor = new PipeRealtimeDataRegionHybridExtractor();
514515
if (LOGGER.isWarnEnabled()) {
515516
LOGGER.warn(
@@ -519,14 +520,26 @@ private void constructRealtimeExtractor(final PipeParameters parameters)
519520
}
520521
}
521522

522-
private void checkWalEnable(final PipeParameters parameters) throws IllegalPathException {
523+
private void checkWalEnableAndSetUncompressed(final PipeParameters parameters)
524+
throws IllegalPathException {
523525
if (Boolean.TRUE.equals(
524526
DataRegionListeningFilter.parseInsertionDeletionListeningOptionPair(parameters)
525527
.getLeft())
526528
&& IoTDBDescriptor.getInstance().getConfig().getWalMode().equals(WALMode.DISABLE)) {
527529
throw new PipeException(
528530
"The pipe cannot transfer realtime insertion if data region disables wal. Please set 'realtime.mode'='batch' in source parameters when enabling realtime transmission.");
529531
}
532+
533+
if (!IoTDBDescriptor.getInstance()
534+
.getConfig()
535+
.getWALCompressionAlgorithm()
536+
.equals(CompressionType.UNCOMPRESSED)) {
537+
LOGGER.info(
538+
"The pipe prefers uncompressed wal, and may introduce certain delay in realtime insert syncing without it. Hence, we change it to uncompressed.");
539+
IoTDBDescriptor.getInstance()
540+
.getConfig()
541+
.setWALCompressionAlgorithm(CompressionType.UNCOMPRESSED);
542+
}
530543
}
531544

532545
@Override

0 commit comments

Comments
 (0)