forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: Refactor pagination for the Get command into the MVCC layer
Informs: cockroachdb#77228 Refactor key and byte pagination for the Get command into the MVCC layer Previously, pagination was done in pkg/kv/kvserver/batcheval/cmd_get.go, but to ensure consistency in where pagination logic is located across all commands, we move the pagination logic for the Get command to the MVCC layer where the pagination logic for most other commands is. This also enables better parameter testing in the storage package since we can leverage e.g. data-driven tests like TestMVCCHistories. Release note: None
- Loading branch information
Showing
4 changed files
with
121 additions
and
31 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Test MaxKeys and TargetBytes for get. | ||
|
||
# Put some test data. | ||
run ok | ||
put k=a v=a ts=1 | ||
put k=b v=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb ts=1 | ||
---- | ||
>> at end: | ||
data: "a"/1.000000000,0 -> /BYTES/a | ||
data: "b"/1.000000000,0 -> /BYTES/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | ||
|
||
# Return none since maxKeys < 0. | ||
run ok | ||
get k=a ts=2 maxKeys=-1 | ||
---- | ||
get: "a" -> <no data> | ||
|
||
# Return value since maxKeys >= 0. | ||
run ok | ||
get k=a ts=2 maxKeys=1 | ||
---- | ||
get: "a" -> /BYTES/a @1.000000000,0 | ||
|
||
# Return none since targetBytes < 0. | ||
run ok | ||
get k=a ts=2 targetBytes=-1 | ||
---- | ||
get: "a" -> <no data> | ||
|
||
# Return none since targetBytes is insufficient and allowEmpty is true. | ||
run ok | ||
get k=b ts=2 targetBytes=1 allowEmpty | ||
---- | ||
get: "b" -> <no data> | ||
|
||
# Return value since targetBytes is sufficient and allowEmpty is true. | ||
run ok | ||
get k=a ts=2 targetBytes=100 allowEmpty | ||
---- | ||
get: "a" -> /BYTES/a @1.000000000,0 | ||
|
||
# Return value since targetBytes is insufficient and allowEmpty is false. | ||
run ok | ||
get k=b ts=2 targetBytes=1 | ||
---- | ||
get: "b" -> /BYTES/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb @1.000000000,0 | ||
|
||
# Return value since targetBytes is sufficient and allowEmpty is false. | ||
run ok | ||
get k=a ts=2 targetBytes=100 | ||
---- | ||
get: "a" -> /BYTES/a @1.000000000,0 |