8000 using lookahead in zkd by romanatarango · Pull Request #14745 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

using lookahead in zkd #14745

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 68 commits into from
Jan 5, 2022
Merged

using lookahead in zkd #14745

merged 68 commits into from
Jan 5, 2022

Conversation

romanatarango
Copy link
Contributor
@romanatarango romanatarango commented Sep 7, 2021

Scope & Purpose

This is an experimental improvement of the ZKD based index iterator. While querying a multidimensional range of values one can now choose (instead of computing the next intersection point of the Z-curve with the range) to try first several documents that are immediately after the current document. If one of them is in the range, the computation of the next intersection point is not necessary, otherwise the point is computed.

A new parameter can be passed from the query: lookahead (a non-negative number). It tells how many documents after the current one should be checked for being in the search range before looking for the next point where the Z-curve intersects the search range. The lookahead is passed from the query to, finally, RocksDBZkdIndexIterator. However, it possibly should depend on the dimension of the index and on the limits of the query (see function numNextTries). The main change is in the function RocksDBZkdIndexIterator::nextImpl().

  • 💩 Bugfix (requires CHANGELOG entry)
  • 🍕 New feature (requires CHANGELOG entry, feature documentation and release notes)
  • 🔥 Performance improvement
  • 🔨 Refactoring/simplification
  • 📖 CHANGELOG entry made

Backports:

  • No backports required
  • Backports required for: (Please specify versions and link PRs)

Related Information

(Please reference tickets / specification / other PRs etc)

  • Docs PR:
  • Enterprise PR:
  • GitHub issue / Jira ticket number:
  • Design document:

Testing & Verification

(Please pick either of the following options)

  • This change is a trivial rework / code cleanup without any test coverage.
  • The behavior in this PR was manually tested
  • This change is already covered by existing tests, such as (please describe tests).
  • This PR adds tests that were used to verify all changes:
    • Added new C++ Unit tests
    • Added new integration tests (e.g. in shell_server / shell_server_aql)
    • Added new resilience tests (only if the feature is impacted by failovers)
  • There are tests in an external testing repository:
  • I ensured this code runs with ASan / TSan or other static verification tools

Link to Jenkins PR run:

Documentation

All new features should be accompanied by corresponding documentation.
Bugs and features should furthermore be documented in the CHANGELOG so that
support, end users, and other developers have a concise overview.

  • Added entry to Release Notes
  • Added a new section in the Manual
  • Added a new section in the HTTP API
  • Added Swagger examples for the HTTP API
  • Updated license information in LICENSES-OTHER-COMPONENTS.md for 3rd party libraries

maierlars and others added 30 commits March 3, 2021 18:13
* Added support for strict comparsion.

* Allow unsupported conditions. Correctly display conditions that are strict in explainer.

* Fixed some now broken tests.

* Apply suggestions from code review

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>
* Added support for cluster.

* Fixing unit tests namespace using.
* Added support for nested fields - excluding expansions.

* Added tests for nested attributes.
* Added support for unique constraint.

* Added tests for unique constraints.
Base automatically changed from feature/zkd-index to devel September 10, 2021 07:00
Copy link
Contributor
@maierlars maierlars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are zdk index js tests. we should run another set of those tests with lookahead enabled to check that it does not miss any documents. See tests/js/server/aql/aql-optimizer-zkdindex-multi.js

@romanatarango
Copy link
Contributor Author

There are zdk index js tests. we should run another set of those tests with lookahead enabled to check that it does not miss any documents. See tests/js/server/aql/aql-optimizer-zkdindex-multi.js

Added testing with loolkahead 32.

@romanatarango romanatarango requested a review from a team as a code owner January 4, 2022 09:07
@maierlars maierlars added the cinfra Cluster Infrastructure label Jan 4, 2022
@maierlars maierlars merged commit 26a3cd0 into devel Jan 5, 2022
@maierlars maierlars deleted the feature/zkd-index-lookahead branch January 5, 2022 07:55
dothebart pushed a commit that referenced this pull request Jan 5, 2022
* Bootstrap zkd indexes. Now fill in the details.

* Added prototype for condition finder.

* Added helper for Range.

* Fixed double conversion.

* Added wrong but working nextImpl

* Extract bounds for iterator.

* Fixed extraction logic with reversed operator usage.

* Detect equal operator correctly.

* Implemented nextImpl

* Removed log devel for hot path.

* Cleanup

* Added support for partially unbounded queries.

* Do not use index for full collection scans.

* Added tests for ZkdHelper.

* Added functional test suite skeleton for zkd index

* Some fixes to double conversions

* Fixed bug in double to byte_string conversion.

* Added support for denormalized doubles and infinity.

* Test all interesting double values.

* Disallow Nan.

* Added more js tests.

* Added a lot of tests.

* Cleaned up test.

* [zkd] Strict comparsion (#13673)

* Added support for strict comparsion.

* Allow unsupported conditions. Correctly display conditions that are strict in explainer.

* Fixed some now broken tests.

* Apply suggestions from code review

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>

* [zkd] Cluster support (#13677)

* Added support for cluster.

* Fixing unit tests namespace using.

* Added support for nested fields - excluding expansions. (#13681)

* Added support for nested fields - excluding expansions.

* Added tests for nested attributes.

* [zkd] Unique Constraints (#13691)

* Added support for unique constraint.

* Added tests for unique constraints.

* [zkd] Forward Compat (#13694)

* Added required field fieldValueTypes: double.

* Refactored index attribute validation. Disallowed attribute expansions.

* Added tests for restrictions.

* Fixing normalization of zkd index definition.

* [zkd] Column Family (#13692)

* Added a new column family for the zkd index.

* Changed write buffer number to 8 + 2.

* Added zkd index docu block. (#13698)

* Fixed bug in RocksDBKeyBounds and using default cost estimation

* [zkd] testInBox speedup (#13798)

* Performance optimized testInBox.

* Optimized performance of compareWithBox.

* Now actually use the optimized version.

* Resize vector before usage.

* Clear vector before reusing CompareResults.

* Eliminate div operation.

* Another div in testInBox.

* Count finished dimensions.

* Removed unused functions.

* Use small vector.

* Fixed goto bug and resize short vector properly.

* Apply suggestions from code review

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>

* Feature/zkd index speedup getnextzvalue (#13799)

* Avoid interleave&transpose in getNextZValue()

* Change order of actual/expected in test assertion

* Minor improvements

* Removed superfluous transpose calls

* Updated CHANGELOG.

* Fixing iterator.

* Added review suggestions.

* using lookahead in zkd

* added forgotten declaration

* added forgotten condering of the new option

* Applied suggestions from review.

* removed tryNewIndex option, now decided by lookahead==0

* unified default lookaheads for zkd to 1, made one of them const

* added testing with lookahead 32 in aql-optimizer-zkdindex-multi.js

* Applied clang-format

Co-authored-by: maierlars <lars@arangodb.com>
Co-authored-by: Tobias Gödderz <tobias@arangodb.com>
Co-authored-by: Michael Hackstein <michael@arangodb.com>
maierlars pushed a commit that referenced this pull request Jan 7, 2022
* Bootstrap zkd indexes. Now fill in the details.

* Added prototype for condition finder.

* Added helper for Range.

* Fixed double conversion.

* Added wrong but working nextImpl

* Extract bounds for iterator.

* Fixed extraction logic with reversed operator usage.

* Detect equal operator correctly.

* Implemented nextImpl

* Removed log devel for hot path.

* Cleanup

* Added support for partially unbounded queries.

* Do not use index for full collection scans.

* Added tests for ZkdHelper.

* Added functional test suite skeleton for zkd index

* Some fixes to double conversions

* Fixed bug in double to byte_string conversion.

* Added support for denormalized doubles and infinity.

* Test all interesting double values.

* Disallow Nan.

* Added more js tests.

* Added a lot of tests.

* Cleaned up test.

* [zkd] Strict comparsion (#13673)

* Added support for strict comparsion.

* Allow unsupported conditions. Correctly display conditions that are strict in explainer.

* Fixed some now broken tests.

* Apply suggestions from code review

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>

* [zkd] Cluster support (#13677)

* Added support for cluster.

* Fixing unit tests namespace using.

* Added support for nested fields - excluding expansions. (#13681)

* Added support for nested fields - excluding expansions.

* Added tests for nested attributes.

* [zkd] Unique Constraints (#13691)

* Added support for unique constraint.

* Added tests for unique constraints.

* [zkd] Forward Compat (#13694)

* Added required field fieldValueTypes: double.

* Refactored index attribute validation. Disallowed attribute expansions.

* Added tests for restrictions.

* Fixing normalization of zkd index definition.

* [zkd] Column Family (#13692)

* Added a new column family for the zkd index.

* Changed write buffer number to 8 + 2.

* Added zkd index docu block. (#13698)

* Fixed bug in RocksDBKeyBounds and using default cost estimation

* [zkd] testInBox speedup (#13798)

* Performance optimized testInBox.

* Optimized performance of compareWithBox.

* Now actually use the optimized version.

* Resize vector before usage.

* Clear vector before reusing CompareResults.

* Eliminate div operation.

* Another div in testInBox.

* Count finished dimensions.

* Removed unused functions.

* Use small vector.

* Fixed goto bug and resize short vector properly.

* Apply suggestions from code review

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>

Co-authored-by: Tobias Gödderz <tobias@arangodb.com>

* Feature/zkd index speedup getnextzvalue (#13799)

* Avoid interleave&transpose in getNextZValue()

* Change order of actual/expected in test assertion

* Minor improvements

* Removed superfluous transpose calls

* Updated CHANGELOG.

* Fixing iterator.

* Added review suggestions.

* using lookahead in zkd

* added forgotten declaration

* added forgotten condering of the new option

* Applied suggestions from review.

* removed tryNewIndex option, now decided by lookahead==0

* unified default lookaheads for zkd to 1, made one of them const

* added testing with lookahead 32 in aql-optimizer-zkdindex-multi.js

* Applied clang-format

Co-authored-by: maierlars <lars@arangodb.com>
Co-authored-by: Tobias Gödderz <tobias@arangodb.com>
Co-authored-by: Michael Hackstein <michael@arangodb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 Index 3 RocksDB Storage engine related 3 Search IResearch / Fulltext index / Analyzers cinfra Cluster Infrastructure performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0