8000 Properly compare velocypack objects in Agency operations (#6924) · Mars2018/arangodb@4359d98 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4359d98

Browse files
graetzerjsteemann
authored andcommitted
Properly compare velocypack objects in Agency operations (arangodb#6924)
1 parent 700dcbb commit 4359d98

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

arangod/Agency/Node.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,9 @@ template <> bool Node::handle<ERASE>(VPackSlice const& slice) {
539539

540540
if (this->slice().isArray()) {
541541
if (haveVal) {
542+
VPackSlice valToErase = slice.get("val");
542543
for (auto const& old : VPackArrayIterator(this->slice())) {
543-
if (old != slice.get("val")) {
544+
if (VelocyPackHelper::compare(old, valToErase, /*useUTF8*/true) != 0) {
544545
tmp.add(old);
545546
}
546547
}
@@ -581,8 +582,13 @@ bool Node::handle<REPLACE>(VPackSlice const& slice) {
581582
Builder tmp;
582583
{ VPackArrayBuilder t(&tmp);
583584
if (this->slice().isArray()) {
585+
VPackSlice valToRepl = slice.get("val");
584586
for (auto const& old : VPackArrayIterator(this->slice())) {
585-
tmp.add(old == slice.get("val") ? slice.get("new") : old);
587+
if (VelocyPackHelper::compare(old, valToRepl, /*useUTF8*/true) == 0) {
588+
tmp.add(slice.get("new"));
589+
} else {
590+
tmp.add(old);
591+
}
586592
}
587593
}
588594
}

arangod/Cluster/ClusterInfo.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,8 +2013,7 @@ int ClusterInfo::ensureIndexCoordinatorWithoutRollback(
20132013
errorMsg = "Error during index creation: " + errorMsg;
20142014

20152015
// Returns the specific error number if set, or the general
2016-
// error
2017-
// otherwise
2016+
// error otherwise
20182017
*dbServerResult =
20192018
arangodb::basics::VelocyPackHelper::getNumericValue<int>(
20202019
v, "errorNum", TRI_ERROR_ARANGO_INDEX_CREATION_FAILED);

0 commit comments

Comments
 (0)
0