8000 fixed issue #11275 · arangodb/arangodb@b303e33 · GitHub
[go: up one dir, main page]

Skip to content

Commit b303e33

Browse files
committed
fixed issue #11275
1 parent 35966d5 commit b303e33

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ devel
5353
* Supervision to clean up zombie servers after 24h, if no
5454
responsibility for shards.
5555

56+
* Fixed issue #11275: indexes backward compatibility broken in 3.5+.
57+
5658
* Fix SORT RAND() LIMIT 1 optimization for RocksDB when only a projection of the
5759
attributes was used. When a projection was used and that projection was
5860
covered by an index (e.g. `_key` via the primary index), then the access

arangod/RocksDBEngine/RocksDBVPackIndex.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,13 +750,16 @@ namespace {
750750
bool attributesEqual(VPackSlice first, VPackSlice second,
751751
std::vector<arangodb::basics::AttributeName>::const_iterator begin,
752752
std::vector<arangodb::basics::AttributeName>::const_iterator end) {
753+
TRI_ASSERT(first.isObject());
754+
TRI_ASSERT(second.isObject());
755+
753756
for (; begin != end; ++begin) {
754757
// fetch subattribute
755758
first = first.get(begin->name);
756-
second = second.get(begin->name);
757759
if (first.isExternal()) {
758760
first = first.resolveExternal();
759761
}
762+
second = second.get(begin->name);
760763
if (second.isExternal()) {
761764
second = second.resolveExternal();
762765
}
@@ -784,6 +787,17 @@ namespace {
784787
if (notF1 || notF2) { // one of the paths was not found
785788
break;
786789
}
790+
791+
// check if, after fetching the subattribute, we are point to a non-object.
792+
// e.g. if the index is on field ["a.b"], the first iteration of this loop
793+
// will look for subattribute "a" in the original document. this will always
794+
// work. however, when looking for "b", we have to make sure that "a" was
795+
// an object. otherwise we must not call Slice::get() on it. In case one of
796+
// the subattributes we found so far is not an object, we fall back to the
797+
// regular comparison
798+
if (!first.isObject() || !second.isObject()) {
799+
break;
800+
}
787801
}
788802

789803
return basics::VelocyPackHelper::equal(first, second, true);

0 commit comments

Comments
 (0)
0