Skip to content

Commit 3f005c0

Browse files
committed
Rename ImportProcessor methods for clarity
1 parent b3f0e39 commit 3f005c0

File tree

1 file changed

+11
-10
lines changed
  • data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataimport/processor

1 file changed

+11
-10
lines changed

data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataimport/processor/ImportProcessor.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ public void removeListener(ImportEventListener listener) {
168168
}
169169

170170
/**
171-
* Notify once the task is completed
171+
* Notify once a single CRUD task is completed
172172
*
173173
* @param result task result object
174174
*/
175-
protected void notifyStorageRecordCompleted(ImportTaskResult result) {
175+
protected void notifySingleCrudRecordCompleted(ImportTaskResult result) {
176176
// Add data to summary, success logs with/without raw data
177177
for (ImportEventListener listener : listeners) {
178178
listener.onTaskComplete(result);
@@ -341,14 +341,14 @@ private ImportTransactionBatchResult processTransactionBatch(
341341
}
342342

343343
/**
344-
* Processes a single record in storage mode (non-transactional). Each record is processed
344+
* Processes a single record in single CRUD mode (non-transactional). Each record is processed
345345
* independently without transaction guarantees.
346346
*
347347
* @param dataChunkId the parent data chunk id of the chunk containing this record
348348
* @param importRow the record to process
349349
* @return an {@link ImportTaskResult} containing the processing result for the record
350350
*/
351-
private ImportTaskResult processStorageRecord(int dataChunkId, ImportRow importRow) {
351+
private ImportTaskResult processSingleCrudRecord(int dataChunkId, ImportRow importRow) {
352352
ImportTaskParams taskParams =
353353
ImportTaskParams.builder()
354354
.sourceRecord(importRow.getSourceData())
@@ -369,7 +369,7 @@ private ImportTaskResult processStorageRecord(int dataChunkId, ImportRow importR
369369
.targets(importRecordResult.getTargets())
370370
.dataChunkId(dataChunkId)
371371
.build();
372-
notifyStorageRecordCompleted(modifiedTaskResult);
372+
notifySingleCrudRecordCompleted(modifiedTaskResult);
373373
return modifiedTaskResult;
374374
}
375375

@@ -391,9 +391,10 @@ private void processDataChunk(ImportDataChunk dataChunk, int transactionBatchSiz
391391
notifyDataChunkStarted(status);
392392
ImportDataChunkStatus importDataChunkStatus;
393393
if (params.getTransactionMode() == TransactionMode.CONSENSUS_COMMIT) {
394-
importDataChunkStatus = processDataChunkWithTransactions(dataChunk, transactionBatchSize);
394+
importDataChunkStatus =
395+
processDataChunkInConsensusCommitMode(dataChunk, transactionBatchSize);
395396
} else {
396-
importDataChunkStatus = processDataChunkWithoutTransactions(dataChunk);
397+
importDataChunkStatus = processDataChunkInSingleCrudMode(dataChunk);
397398
}
398399
notifyDataChunkCompleted(importDataChunkStatus);
399400
}
@@ -406,7 +407,7 @@ private void processDataChunk(ImportDataChunk dataChunk, int transactionBatchSiz
406407
* @param transactionBatchSize the number of records per transaction batch
407408
* @return an {@link ImportDataChunkStatus} containing processing results and metrics
408409
*/
409-
private ImportDataChunkStatus processDataChunkWithTransactions(
410+
private ImportDataChunkStatus processDataChunkInConsensusCommitMode(
410411
ImportDataChunk dataChunk, int transactionBatchSize) {
411412
Instant startTime = Instant.now();
412413
List<ImportTransactionBatch> transactionBatches =
@@ -446,13 +447,13 @@ private ImportDataChunkStatus processDataChunkWithTransactions(
446447
* @param dataChunk the data chunk to process
447448
* @return an {@link ImportDataChunkStatus} containing processing results and metrics
448449
*/
449-
private ImportDataChunkStatus processDataChunkWithoutTransactions(ImportDataChunk dataChunk) {
450+
private ImportDataChunkStatus processDataChunkInSingleCrudMode(ImportDataChunk dataChunk) {
450451
Instant startTime = Instant.now();
451452
AtomicInteger successCount = new AtomicInteger(0);
452453
AtomicInteger failureCount = new AtomicInteger(0);
453454

454455
for (ImportRow importRow : dataChunk.getSourceData()) {
455-
ImportTaskResult result = processStorageRecord(dataChunk.getDataChunkId(), importRow);
456+
ImportTaskResult result = processSingleCrudRecord(dataChunk.getDataChunkId(), importRow);
456457
boolean allSaved =
457458
result.getTargets().stream()
458459
.allMatch(t -> t.getStatus().equals(ImportTargetResultStatus.SAVED));

0 commit comments

Comments
 (0)