8000 ZKD Indexes by maierlars · Pull Request #13650 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

ZKD Indexes #13650

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 “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 50 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c19d549
Bootstrap zkd indexes. Now fill in the details.
Mar 3, 2021
60d6ceb
Added prototype for condition finder.
Mar 4, 2021
63fd0b7
Added helper for Range.
Mar 4, 2021
a43cf14
Fixed double conversion.
Mar 4, 2021
9305dbc
Added wrong but working nextImpl
Mar 5, 2021
14ba135
Extract bounds for iterator.
Mar 5, 2021
3d7d5fc
Fixed extraction logic with reversed operator usage.
Mar 5, 2021
db52b6d
Detect equal operator correctly.
Mar 5, 2021
ede46db
Implemented nextImpl
goedderz Mar 5, 2021
5c78b96
Removed log devel for hot path.
Mar 5, 2021
0b73dcf
Cleanup
goedderz Mar 5, 2021
4fb378c
Added support for partially unbounded queries.
Mar 5, 2021
6948eb6
Do not use index for full collection scans.
Mar 5, 2021
34117f4
Merge branch 'feature/zkd-index' of github.com:arangodb/arangodb into…
Mar 5, 2021
59fd78e
Added tests for ZkdHelper.
Mar 8, 2021
db392e3
Added functional test suite skeleton for zkd index
goedderz Mar 8, 2021
811e660
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Mar 8, 2021
91f5651
Some fixes to double conversions
goedderz Mar 8, 2021
5be1cd2
Fixed bug in double to byte_string conversion.
Mar 8, 2021
34c4324
Added support for denormalized doubles and infinity.
Mar 9, 2021
e2977ff
Test all interesting double values.
Mar 9, 2021
c9042d2
Disallow Nan.
Mar 9, 2021
dd3b8f2
Added more js tests.
Mar 9, 2021
7b879dc
Added a lot of tests.
Mar 9, 2021
6fcf4d1
Cleaned up test.
Mar 9, 2021
5697c52
[zkd] Strict comparsion (#13673)
Mar 10, 2021
1d3522d
[zkd] Cluster support (#13677)
Mar 11, 2021
94dd02e
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Mar 11, 2021
3d1ce4b
Added support for nested fields - excluding expansions. (#13681)
Mar 11, 2021
7618470
[zkd] Unique Constraints (#13691)
Mar 12, 2021
1d4928b
[zkd] Forward Compat (#13694)
Mar 15, 2021
8cabd6f
[zkd] Column Family (#13692)
Mar 15, 2021
bbf25b4
Added zkd index docu block. (#13698)
Mar 15, 2021
caa87ae
Fixed bug in RocksDBKeyBounds and using default cost estimation
Mar 16, 2021
6c6a34e
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Mar 22, 2021
b81f948
[zkd] testInBox speedup (#13798)
Mar 24, 2021
aaddb71
Feature/zkd index speedup getnextzvalue (#13799)
goedderz Mar 25, 2021
10ed61a
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
May 25, 2021
5a1adc3
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
May 26, 2021
584f524
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Jul 1, 2021
d650d3f
Updated CHANGELOG.
Jul 1, 2021
265ed5c
Merge branch 'devel' of github.com:arangodb/arangodb into feature/zkd…
goedderz Jul 6, 2021
3c73e3d
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Jul 15, 2021
41ea5e2
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Aug 5, 2021
fa7d8b0
Fixing iterator.
Aug 6, 2021
5f83c9f
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Aug 12, 2021
dd48bf9
Added review suggestions.
Aug 20, 2021
a55c4c6
Merge remote-tracking branch 'origin/devel' into feature/zkd-index
Sep 9, 2021
60473c5
Applied suggestions from review.
Sep 9, 2021
a185712
Merge branch 'devel' into feature/zkd-index
mchacki Sep 10, 2021
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
Prev Previous commit
Next Next commit
Added review suggestions.
  • Loading branch information
maierlars committed Aug 20, 2021
commit dd48bf982baa8a5f3dced438c597b0ee5e10d7ed
14 changes: 6 additions & 8 deletions arangod/RocksDBEngine/RocksDBZkdIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ auto zkd::supportsFilterCondition(
extractBoundsFromCondition(inde 8000 x, node, reference, extractedBounds, unusedExpressions);

if (extractedBounds.empty()) {
return Index::FilterCosts();
return {};
}

// TODO -- actually return costs
Expand Down Expand Up @@ -441,7 +441,7 @@ arangodb::Result arangodb::RocksDBZkdIndexBase::insert(
return rocksutils::convertStatus(s);
}

return Result();
return {};
}

arangodb::Result arangodb::RocksDBZkdIndexBase::remove(arangodb::transaction::Methods& trx,
Expand All @@ -456,13 +456,12 @@ arangodb::Result arangodb::RocksDBZkdIndexBase::remove(arangodb::transaction::Me
RocksDBKey rocks_key;
rocks_key.constructZkdIndexValue(objectId(), key_value, documentId);

auto value = RocksDBValue::ZkdIndexValue();
auto s = methods->SingleDelete(_cf, rocks_key);
if (!s.ok()) {
return rocksutils::convertStatus(s);
}

return Result();
return {};
}

arangodb::RocksDBZkdIndexBase::RocksDBZkdIndexBase(arangodb::IndexId iid,
Expand Down Expand Up @@ -532,7 +531,7 @@ arangodb::Result arangodb::RocksDBUniqueZkdIndex::insert(
transaction::StringLeaser leased(&trx);
rocksdb::PinnableSlice existing(leased.get());
if (auto s = methods->GetForUpdate(_cf, rocks_key.string(), &existing); s.ok()) { // detected conflicting index entry
return Result(TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED);
return {TRI_ERROR_ARANGO_UNIQUE_CONSTRAINT_VIOLATED};
} else if (!s.IsNotFound()) {
return Result(rocksutils::convertStatus(s));
}
Expand All @@ -544,7 +543,7 @@ arangodb::Result arangodb::RocksDBUniqueZkdIndex::insert(
return rocksutils::convertStatus(s);
}

return Result();
return {};
}

arangodb::Result arangodb::RocksDBUniqueZkdIndex::remove(
Expand All @@ -559,11 +558,10 @@ arangodb::Result arangodb::RocksDBUniqueZkdIndex::remove(
RocksDBKey rocks_key;
rocks_key.constructZkdIndexValue(objectId(), key_value);

auto value = RocksDBValue::ZkdIndexValue();
auto s = methods->SingleDelete(_cf, rocks_key);
if (!s.ok()) {
return rocksutils::convertStatus(s);
}

return Result();
return {};
}
33 changes: 28 additions & 5 deletions arangod/Zkd/ZkdHelper.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Tobias Gödderz
/// @author Lars Maier
////////////////////////////////////////////////////////////////////////////////
#include "ZkdHelper.h"

#include "Basics/ScopeGuard.h"
Expand Down Expand Up @@ -227,12 +250,12 @@ auto zkd::transpose(byte_string_view bs, std::size_t dimensions) -> std::vector<
for (auto& w : writer) {
auto b = reader.next();
if (!b.has_value()) {
goto fuckoff_cxx;
goto break_loops;
}
w.append(b.value());
}
}
fuckoff_cxx:
break_loops:

std::vector<zkd::byte_string> result;
std::transform(writer.begin(), writer.end(), std::back_inserter(result), [](auto& bs) {
Expand Down Expand Up @@ -273,8 +296,8 @@ void zkd::compareWithBoxInto(byte_string_view cur, byte_string_view min, byte_st
return result[dim].saveMax != CompareResult::max;
};

unsigned step = 0;
unsigned dim = 0;
std::size_t step = 0;
std::size_t dim = 0;

for (std::size_t i = 0; i < 8 * max_size; i++) {
TRI_ASSERT(step == i / dimensions);
Expand Down Expand Up @@ -437,7 +460,7 @@ auto zkd::getNextZValue(byte_string_view cur, byte_string_view min, byte_string_
return result;
};

for (unsigned dim = 0; dim < dims; dim++) {
for (std::size_t dim = 0; dim < dims; dim++) {
auto& cmpRes = cmpResult[dim];
if (cmpRes.flag >= 0) {
auto bp = dims * cmpRes.saveMin + dim;
Expand Down
29 changes: 24 additions & 5 deletions arangod/Zkd/ZkdHelper.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 6D40 @@
#ifndef ZKD_TREE_LIBRARY_H
#define ZKD_TREE_LIBRARY_H

////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Tobias Gödderz
/// @author Lars Maier
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <cstddef>
#include <iosfwd>
#include <limits>
Expand Down Expand Up @@ -147,5 +168,3 @@ std::ostream& operator<<(std::ostream& os, struct floating_point const& fp);

std::ostream& operator<<(std::ostream& ostream, arangodb::zkd::byte_string const& string);
std::ostream& operator<<(std::ostream& ostream, arangodb::zkd::byte_string_view string);

#endif // ZKD_TREE_LIBRARY_H
23 changes: 23 additions & 0 deletions tests/Zkd/Conversion.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Tobias Gödderz
/// @author Lars Maier
////////////////////////////////////////////////////////////////////////////////
#include "Zkd/ZkdHelper.h"

#include "gtest/gtest.h"
Expand Down
23 changes: 23 additions & 0 deletions tests/Zkd/Library.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2021 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Tobias Gödderz
/// @author Lars Maier
////////////////////////////////////////////////////////////////////////////////
#include <array>
#include <iostream>
#include <utility>
Expand Down
0