8000 Bug fix/issue 11275 by jsteemann · Pull Request #11299 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Bug fix/issue 11275 #11299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking &ldquo 8000 ;Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
devel
-----

* Fixed issue #11275: indexes backward compatibility broken in 3.5+.

* Updated snowball dependency to the latest version.
More stemmers are available. Built-in analyzer list is unchanged.

Expand Down
13 changes: 12 additions & 1 deletion arangod/RocksDBEngine/RocksDBVPackIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,12 +751,23 @@ namespace {
std::vector<arangodb::basics::AttributeName>::const_iterator begin,
std::vector<arangodb::basics::AttributeName>::const_iterator end) {
for (; begin != end; ++begin) {
// check if, after fetching the subattribute, we are point to a non-object.
// e.g. if the index is on field ["a.b"], the first iteration of this loop
// will look for subattribute "a" in the original document. this will always
// work. however, when looking for "b", we have to make sure that "a" was
// an object. otherwise we must not call Slice::get() on it. In case one of
// the subattributes we found so far is not an object, we fall back to the
// regular comparison
if (!first.isObject() || !second.isObject()) {
break;
}

// fetch subattribute
first = first.get(begin->name);
second = second.get(begin->name);
if (first.isExternal()) {
first = first.resolveExternal();
}
second = second.get(begin->name);
if (second.isExternal()) {
second = second.resolveExternal();
}
Expand Down
22 changes: 20 additions & 2 deletions tests/js/common/shell/shell-hash-index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*jshint globalstrict:false, strict:false */
/*global fail, assertEqual, assertTrue, assertFalse, assertNotEqual */
/*global fail, assertEqual, assertTrue, assertFalse, assertNull, assertNotEqual */

////////////////////////////////////////////////////////////////////////////////
/// @brief test the hash index
Expand Down Expand Up @@ -604,7 +604,25 @@ function HashIndexSuite() {
}
i *= 2;
}
}
},

testUniqueIndexNullSubattribute : function () {
let idx = collection.ensureIndex({ type: "hash", unique: true, fields: ["a.b"] });

assertEqual("hash", idx.type);
assertEqual(true, idx.unique);
assertEqual(["a.b"], idx.fields);
assertEqual(true, idx.isNewlyCreated);

// as "a" is null here, "a.b" should also be null, at least it should not fail when accessing it via the index
collection.insert({ _key: "test", a : null });
collection.update("test", { something: "test2" });

let doc = collection.document("test");
assertNull(doc.a);
assertEqual("test2", doc.something);
},

};
}

Expand Down
0