Skip to content
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

Query don't copy #380

Merged
merged 3 commits into from
Oct 11, 2022
Merged

Query don't copy #380

merged 3 commits into from
Oct 11, 2022

Conversation

martinsumner
Copy link
Owner

@martinsumner martinsumner commented Oct 3, 2022

Queries the manifest to avoid copying the whole manifest when taking a snapshot of a penciller to run a query.

Change the logging of fold setup in the Bookie to record the actual snapshot time (rather than the uninteresting and fast returning the the function which will request the snapshot).

A little tidy to avoid duplicating the ?MAX_LEVELS macro.

#379

Queries the manifest to avoid copying the whole manifest when taking a snapshot of a penciller to run a query.

Change the logging of fold setup in the Bookie to record the actual snapshot time (rather than the uninteresting and fast returning the the function which will request the snapshot).

A little tidy to avoid duplicating the ?MAX_LEVELS macro.
@martinsumner
Copy link
Owner Author

Testing in standard NHS Riak test cluster on a 2i heavy workload. The result was that the B0017 log showed a total of 1.173ms to snapshot a store prior to the change, and 233ms after the change.

@martinsumner
Copy link
Owner Author

martinsumner commented Oct 3, 2022

With the database unstressed (i.e. just ten bench workers), the throughput increase was 26.6% with a 10% drop in CPU used.

leveled_pmanifest:query_manifest(
State#state.manifest, StartKey, EndKey);
QueryManifest ->
QueryManifest
Copy link
Contributor

@ThomasArts ThomasArts Oct 4, 2022

Choose a reason for hiding this comment

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

I have a bit of problem to see whether this is compatible with the old solution.

If you register a snapshot, then you now put the query_manifest in the state (line 881). A consecutive fetch_keys will use that query.
But the StartKey and EndKey of the registers snapshot and the fetch might be different? In which case the result of the fetch is different??

More precise, if the fetch is on Query {StartKey = 10, EndKey = 20} and the fetch is on StartKey = 1, EndKey = 8, then the original would use the 1..8 range for fetch, whereas the new one would have saved the query 10...20 in the state and use that. What am I missing?

Copy link
Owner Author

@martinsumner martinsumner Oct 4, 2022

Choose a reason for hiding this comment

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

If at the point of requesting the snapshot you know what the Query is, then the StartKey/EndKey are provided here. So it is assumed that there will only be one subsequent call to find_keys on that snapshot, and it will be for the same StartKey/EndKey.

There are circumstances where a snapshot is reused for multiple queries (e.g. when doing list buckets), but in this case there is no Query provided when registering the snapshot.

I think it might be worth making the query_manifest a tuple of {SubManifest, StartKey, EndKey} and a guard to crash a subsequent find_keys request which tries a StartKey or EndKey outside of the range. This will then make this requirement explicit.

Copy link
Contributor

@ThomasArts ThomasArts left a comment

Choose a reason for hiding this comment

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

I like the solution to keep Start and End key in the state!

@martinsumner martinsumner merged commit 4664427 into develop-3.0 Oct 11, 2022
@martinsumner martinsumner deleted the mas-i379-snapshottime branch October 11, 2022 12:46
martinsumner added a commit that referenced this pull request Oct 11, 2022
* Query don't copy

Queries the manifest to avoid copying the whole manifest when taking a snapshot of a penciller to run a query.

Change the logging of fold setup in the Bookie to record the actual snapshot time (rather than the uninteresting and fast returning the the function which will request the snapshot).

A little tidy to avoid duplicating the ?MAX_LEVELS macro.

* Clarify log is of snapshot time not fold time

* Updates after review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants