8000 some fixes for replication (#4621) · ashang/arangodb@b3556f7 · GitHub
[go: up one dir, main page]

Skip to content

Commit b3556f7

Browse files
authored
some fixes for replication (arangodb#4621)
1 parent 63c50c3 commit b3556f7

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

UnitTests/HttpInterface/api-replication-rocksdb-spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,6 @@
510510
document["type"].should eq(2302)
511511
document["cid"].should eq(cid)
512512
document["data"]["_key"].should eq("test")
513-
document["data"]["_rev"].should match(/^[a-zA-Z0-9_\-]+$/)
514-
document["data"]["_rev"].should_not eq(rev)
515513

516514
i = i + 1
517515
elsif i == 3 and document["type"] == 2001 and document["cid"] == cid
@@ -1630,8 +1628,6 @@
16301628
document["type"].should eq(2302)
16311629
document["cid"].should eq(cid)
16321630
document["data"]["_key"].should eq("test")
1633-
document["data"]["_rev"].should match(/^[a-zA-Z0-9_\-]+$/)
1634-
document["data"]["_rev"].should_not eq(rev)
16351631

16361632
i = i + 1
16371633
elsif i == 3 and document["type"] == 2001 and document["cid"] == cid

arangod/Replication/Syncer.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,13 @@ Result Syncer::createIndex(VPackSlice const& slice) {
655655
return Result(TRI_ERROR_ARANGO_COLLECTION_NOT_FOUND,
656656
"did not find collection for index");
657657
}
658+
659+
VPackBuilder s;
660+
s.openObject();
661+
s.add("objectId", VPackSlice::nullSlice());
662+
s.close();
663+
VPackBuilder merged = VPackCollection::merge(indexSlice, s.slice(),
664+
/*mergeValues*/true, /*nullMeansRemove*/true);
658665

659666
try {
660667
SingleCollectionTransaction trx(transaction::StandaloneContext::Create(vocbase),
@@ -669,7 +676,7 @@ Result Syncer::createIndex(VPackSlice const& slice) {
669676
auto physical = trx.documentCollection()->getPhysical();
670677
TRI_ASSERT(physical != nullptr);
671678
std::shared_ptr<arangodb::Index> idx;
672-
res = physical->restoreIndex(&trx, indexSlice, idx);
679+
res = physical->restoreIndex(&trx, merged.slice(), idx);
673680
res = trx.finish(res);
674681

675682
return res;

arangod/RocksDBEngine/RocksDBReplicationTailing.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,6 @@ class WALParser : public rocksdb::WriteBatch::Handler {
419419
TRI_ASSERT(_currentDbId != 0 && _currentCid != 0);
420420
TRI_ASSERT(!_removeDocumentKey.empty());
421421

422-
uint64_t revId = RocksDBKey::revisionId(RocksDBEntryType::Document, key);
423422
_builder.openObject();
424423
_builder.add("tick", VPackValue(std::to_string(_currentSequence)));
425424
_builder.add("type", VPackValue(static_cast<uint64_t>(REPLICATION_MARKER_REMOVE)));
@@ -432,8 +431,8 @@ class WALParser : public rocksdb::WriteBatch::Handler {
432431
}
433432
_builder.add("tid", VPackValue(std::to_string(_currentTrxId)));
434433
_builder.add("data", VPackValue(VPackValueType::Object));
434+
// only pass on _key, but no _rev
435435
_builder.add(StaticStrings::KeyString, VPackValue(_removeDocumentKey));
436-
_builder.add(StaticStrings::RevString, VPackValue(std::to_string(revId)));
437436
_builder.close();
438437
_builder.close();
439438
_removeDocumentKey.clear();

0 commit comments

Comments
 (0)
0