Skip to content

Commit

Permalink
Rename export partition size to export batch size
Browse files Browse the repository at this point in the history
Signed-off-by: Dinu John <[email protected]>
  • Loading branch information
dinujoh committed Apr 18, 2024
1 parent 8c5a3ad commit 50c407e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ public class CollectionConfig {
private static final String COLLECTION_SPLITTER = "\\.";
private static final int DEFAULT_STREAM_BATCH_SIZE = 1000;
private static final int DEFAULT_PARTITION_COUNT = 100;
private static final int DEFAULT_EXPORT_PARTITION_SIZE = 4000;
private static final int DEFAULT_EXPORT_BATCH_SIZE = 10_000;
@JsonProperty("collection")
private @NotNull String collection;

@JsonProperty("export")
private boolean export;

@JsonProperty("export_partition_size")
private int exportPartitionSize;

@JsonProperty("stream")
private boolean stream;

Expand All @@ -35,6 +32,8 @@ public class CollectionConfig {
@JsonProperty("partition_count")
private int partitionCount;

@JsonProperty("export_batch_size")
private int exportBatchSize;
@JsonProperty("stream_batch_size")
private int streamBatchSize;

Expand All @@ -43,7 +42,7 @@ public CollectionConfig() {
this.stream = true;
this.streamBatchSize = DEFAULT_STREAM_BATCH_SIZE;
this.partitionCount = DEFAULT_PARTITION_COUNT;
this.exportPartitionSize = DEFAULT_EXPORT_PARTITION_SIZE;
this.exportBatchSize = DEFAULT_EXPORT_BATCH_SIZE;
}

public String getCollection() {
Expand Down Expand Up @@ -78,8 +77,8 @@ public int getPartitionCount() {
return this.partitionCount;
}

public int getExportPartitionSize() {
return this.exportPartitionSize;
public int getExportBatchSize() {
return this.exportBatchSize;
}

public int getStreamBatchSize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private void createExportPartition(final CollectionConfig collectionConfig, fina
exportProgressState.setDatabaseName(collectionConfig.getDatabaseName());
exportProgressState.setExportTime(exportTime.toString()); // information purpose
final ExportPartition exportPartition = new ExportPartition(collectionConfig.getCollection(),
collectionConfig.getExportPartitionSize(), exportTime, exportProgressState);
collectionConfig.getExportBatchSize(), exportTime, exportProgressState);
coordinator.createPartition(exportPartition);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void test_should_init() {
given(coordinator.acquireAvailablePartition(LeaderPartition.PARTITION_TYPE)).willReturn(Optional.of(leaderPartition));
given(collectionConfig.isExport()).willReturn(true);
given(collectionConfig.isStream()).willReturn(true);
given(collectionConfig.getExportPartitionSize()).willReturn(Math.abs(new Random().nextInt()));
given(collectionConfig.getExportBatchSize()).willReturn(Math.abs(new Random().nextInt()));
given(collectionConfig.getCollection()).willReturn(UUID.randomUUID().toString());

final ExecutorService executorService = Executors.newSingleThreadExecutor();
Expand Down Expand Up @@ -94,7 +94,7 @@ void test_should_init_export() {
leaderPartition = new LeaderPartition();
given(coordinator.acquireAvailablePartition(LeaderPartition.PARTITION_TYPE)).willReturn(Optional.of(leaderPartition));
given(collectionConfig.isExport()).willReturn(true);
given(collectionConfig.getExportPartitionSize()).willReturn(Math.abs(new Random().nextInt()));
given(collectionConfig.getExportBatchSize()).willReturn(Math.abs(new Random().nextInt()));
given(collectionConfig.getCollection()).willReturn(UUID.randomUUID().toString());

final ExecutorService executorService = Executors.newSingleThreadExecutor();
Expand Down

0 comments on commit 50c407e

Please sign in to comment.