From a6a19e36094e5cae6fb64d05861c641a54b77a97 Mon Sep 17 00:00:00 2001 From: Eric Long Date: Thu, 21 May 2020 11:23:44 -0400 Subject: [PATCH 1/2] 0004398: Initial load leaves batch in RQ status with message "batch not ready for delivery" --- .../jumpmind/symmetric/service/impl/DataExtractorService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java b/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java index a2b2ad75a5..e3f0f0f885 100644 --- a/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java +++ b/symmetric-core/src/main/java/org/jumpmind/symmetric/service/impl/DataExtractorService.java @@ -1019,13 +1019,13 @@ protected OutgoingBatch extractOutgoingBatch(ProcessInfo extractInfo, Node targe if (currentBatch.getStatus() == Status.IG) { cleanupIgnoredBatch(sourceNode, targetNode, currentBatch, writer); - } else if (!isPreviouslyExtracted(currentBatch, false)) { + } else if (currentBatch.getStatus() == Status.RQ || !isPreviouslyExtracted(currentBatch, false)) { BatchLock lock = null; try { log.debug("{} attempting to acquire lock for batch {}", targetNode.getNodeId(), currentBatch.getBatchId()); lock = acquireLock(currentBatch, useStagingDataWriter); log.debug("{} acquired lock for batch {}", targetNode.getNodeId(), currentBatch.getBatchId()); - if (!isPreviouslyExtracted(currentBatch, true)) { + if (currentBatch.getStatus() == Status.RQ || !isPreviouslyExtracted(currentBatch, true)) { log.debug("{} extracting batch {}", targetNode.getNodeId(), currentBatch.getBatchId()); currentBatch.setExtractCount(currentBatch.getExtractCount() + 1); From c500a3cfe7b9e98141e35124071d908a306c326c Mon Sep 17 00:00:00 2001 From: Philip Marzullo Date: Mon, 29 Jun 2020 09:01:40 -0400 Subject: [PATCH 2/2] 0004456: StagedResource should use a more robust file rename function --- .../org/jumpmind/symmetric/io/stage/StagedResource.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/symmetric-io/src/main/java/org/jumpmind/symmetric/io/stage/StagedResource.java b/symmetric-io/src/main/java/org/jumpmind/symmetric/io/stage/StagedResource.java index 8c316e2baf..ce1d04cab7 100644 --- a/symmetric-io/src/main/java/org/jumpmind/symmetric/io/stage/StagedResource.java +++ b/symmetric-io/src/main/java/org/jumpmind/symmetric/io/stage/StagedResource.java @@ -33,6 +33,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.io.StringReader; +import java.nio.file.Files; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.Map; @@ -168,9 +169,12 @@ public void setState(State state) { } } - if (!file.renameTo(newFile)) { + try { + Files.move(file.toPath(), newFile.toPath()); + } catch(IOException e) { + log.error(e.getMessage(),e); handleFailedRename(file, newFile); - } + } } }