Only execute read repair delete batch if there are no rows to delete.
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/48780f07 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/48780f07 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/48780f07 Branch: refs/heads/release-2.1.1 Commit: 48780f07d1d94bc7b8a6934dbd5da3446102e8fc Parents: 7143cba Author: Michael Russo <[email protected]> Authored: Mon Jun 6 10:44:11 2016 -0700 Committer: Michael Russo <[email protected]> Committed: Mon Jun 6 10:44:11 2016 -0700 ---------------------------------------------------------------------- .../impl/EntityCollectionManagerImpl.java | 22 +++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/48780f07/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java ---------------------------------------------------------------------- diff --git a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java index 70b06ba..fcf1c6b 100644 --- a/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java +++ b/stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java @@ -385,23 +385,29 @@ public class EntityCollectionManagerImpl implements EntityCollectionManager { response.addEntity( expectedUnique.getField(), entity ); } - deleteBatch.execute(); + if ( deleteBatch.getRowCount() > 0 ) { - // optionally sleep after read repair as some tasks immediately try to write after the delete - if ( serializationFig.getReadRepairDelay() > 0 ){ + deleteBatch.execute(); - try { + // optionally sleep after read repair as some tasks immediately try to write after the delete + if ( serializationFig.getReadRepairDelay() > 0 ){ - Thread.sleep(Math.min(serializationFig.getReadRepairDelay(), 200L)); + try { - } catch (InterruptedException e) { + Thread.sleep(Math.min(serializationFig.getReadRepairDelay(), 200L)); + + } catch (InterruptedException e) { + + // do nothing if sleep fails; log and continue on + logger.warn("Sleep during unique value read repair failed."); + } - // do nothing if sleep fails; log and continue on - logger.warn("Sleep during unique value read repair failed."); } } + + return response; } catch ( ConnectionException e ) {
