-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: avoid blocking the command queue for scans with limits
SQL has a tendancy to create scans which cover a range's entire key span, though looking only to return a finite number of results. These requests end up blocking writes in the command queue, which block other reads, causing requsets to effectively serialize. In reality, when there is a scan with a limit, the actual affected key span ends up being a small subset of the range's key span. This change creates a new "pre-evaluation" execution path for read- only requests. When pre-evaluating, the batch still interacts with the command queue, but it neither waits for pre-requisites nor causes successor, dependent write batches from waiting on it. Instead, any prereqs or dependents are tracked while the read-only batch is immediately evaluated without blocking. On successful evaluation, the actual span(s) covered and recorded in the read-only batch's `BatchResponse` are compared to the pre-requisite and dependent commands. If there is no overlap, the timestamp cache is updated and the read-only batch response returned to the caller. If there is overlap, then the read-only batch is re-executed, but with the pre-evaluation option disabled, so that it proceeds to interact with the command queue in the traditional fashion, waiting on prereqs and making dependents wait on it. Release note: improved performance on workloads which mix OLAP queries with updates.
- Loading branch information
1 parent
3ee3e10
commit c2d3a00
Showing
4 changed files
with
157 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.