Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ private void createDataFilePartitions(final String exportArn,

// Currently, we need to maintain a global state to track the overall progress.
// So that we can easily tell if all the export files are loaded
LoadStatus loadStatus = new LoadStatus(totalFiles.get(), 0, totalRecords.get(), 0);
LoadStatus loadStatus = new LoadStatus(dataFileInfo.size(), 0, totalRecords.get(), 0);
enhancedSourceCoordinator.createPartition(new GlobalState(exportArn, Optional.of(loadStatus.toMap())));

dataFileInfo.forEach((key, size) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.opensearch.dataprepper.plugins.source.dynamodb.coordination.partition.GlobalState;
import org.opensearch.dataprepper.plugins.source.dynamodb.coordination.state.ExportProgressState;
import org.opensearch.dataprepper.plugins.source.dynamodb.model.ExportSummary;
import org.opensearch.dataprepper.plugins.source.dynamodb.model.LoadStatus;
import org.opensearch.dataprepper.plugins.source.dynamodb.utils.DynamoDBSourceAggregateMetrics;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.DescribeExportRequest;
Expand Down Expand Up @@ -185,6 +186,12 @@ public void test_run_exportJob_correctly() throws InterruptedException {
assertThat(createdPartitions.get(1), instanceOf(DataFilePartition.class));
assertThat(createdPartitions.get(2), instanceOf(DataFilePartition.class));

// Verify the GlobalState LoadStatus has accurate totalFiles count
GlobalState globalState = (GlobalState) createdPartitions.get(0);
LoadStatus loadStatus = LoadStatus.fromMap(globalState.getProgressState().get());
assertThat(loadStatus.getTotalFiles(), equalTo(2));
assertThat(loadStatus.getLoadedFiles(), equalTo(0));

// Complete the export partition
verify(coordinator).completePartition(any(EnhancedSourcePartition.class));
verify(exportJobSuccess).increment();
Expand Down
Loading