From c5a195d62c4dd9ef239ce6aefff4b1d247f973c6 Mon Sep 17 00:00:00 2001 From: jsteemann Date: Wed, 10 May 2017 14:32:16 +0200 Subject: [PATCH] attempt to fix races in replication --- arangod/Replication/ContinuousSyncer.cpp | 2 +- arangod/Replication/InitialSyncer.cpp | 8 ++++---- js/server/tests/replication/replication-ongoing.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arangod/Replication/ContinuousSyncer.cpp b/arangod/Replication/ContinuousSyncer.cpp index ca31a06091..915d97c4bd 100644 --- a/arangod/Replication/ContinuousSyncer.cpp +++ b/arangod/Replication/ContinuousSyncer.cpp @@ -565,7 +565,7 @@ int ContinuousSyncer::processDocument(TRI_replication_operation_e type, return TRI_ERROR_REPLICATION_UNEXPECTED_TRANSACTION; } - trx->addCollectionAtRuntime(cid, "", AccessMode::Type::WRITE); + trx->addCollectionAtRuntime(cid, "", AccessMode::Type::EXCLUSIVE); int res = applyCollectionDumpMarker(*trx, trx->name(cid), type, old, doc, errorMsg); if (res == TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED && isSystem) { diff --git a/arangod/Replication/InitialSyncer.cpp b/arangod/Replication/InitialSyncer.cpp index a69cb4cc35..af87d4f1dc 100644 --- a/arangod/Replication/InitialSyncer.cpp +++ b/arangod/Replication/InitialSyncer.cpp @@ -735,7 +735,7 @@ int InitialSyncer::handleCollectionDump(arangodb::LogicalCollection* col, if (res.ok()) { SingleCollectionTransaction trx( transaction::StandaloneContext::Create(_vocbase), col->cid(), - AccessMode::Type::WRITE); + AccessMode::Type::EXCLUSIVE); res = trx.begin(); @@ -937,7 +937,7 @@ int InitialSyncer::handleCollectionSync(arangodb::LogicalCollection* col, // remote collection has no documents. now truncate our local collection SingleCollectionTransaction trx( transaction::StandaloneContext::Create(_vocbase), col->cid(), - AccessMode::Type::WRITE); + AccessMode::Type::EXCLUSIVE); Result res = trx.begin(); @@ -1095,7 +1095,7 @@ int InitialSyncer::handleCollection(VPackSlice const& parameters, SingleCollectionTransaction trx( transaction::StandaloneContext::Create(_vocbase), col->cid(), - AccessMode::Type::WRITE); + AccessMode::Type::EXCLUSIVE); Result res = trx.begin(); @@ -1212,7 +1212,7 @@ int InitialSyncer::handleCollection(VPackSlice const& parameters, try { SingleCollectionTransaction trx( transaction::StandaloneContext::Create(_vocbase), col->cid(), - AccessMode::Type::WRITE); + AccessMode::Type::EXCLUSIVE); res = trx.begin(); diff --git a/js/server/tests/replication/replication-ongoing.js b/js/server/tests/replication/replication-ongoing.js index 96e5c7aec4..7d17093062 100644 --- a/js/server/tests/replication/replication-ongoing.js +++ b/js/server/tests/replication/replication-ongoing.js @@ -624,7 +624,7 @@ function ReplicationSuite() { assertTrue(replication.applier.state().state.running); return "wait"; } catch (err) { - // task does not exist. we're done + // task does not exist anymore. we're done state.lastLogTick = replication.logger.state().state.lastLogTick; state.checksum = collectionChecksum(cn); state.count = collectionCount(cn);