Clarify `inplace_update_support` with DeleteRange and reenable `inplace_update_support` in crash test (#12577)

Summary:
**Context/Summary:**
Our crash test recently surfaced incompatibilities between DeleteRange and inplace_update_support. Incorrect read result will be returned after insertion into memtables already contain delete range data.

This PR is to clarify this in API and re-enable `inplace_update_support` in crash test with sanitization.

Ideally there should be a way to check memtable for delete range entry upon put under inplace_update_support = true

Pull Request resolved: https://github.com/facebook/rocksdb/pull/12577

Test Plan: CI

Reviewed By: ajkr

Differential Revision: D56492556

Pulled By: hx235

fbshipit-source-id: 9e80e5c69dd708716619a266f41580959680c83b
This commit is contained in:
Hui Xiao 2024-04-25 14:07:39 -07:00 committed by Facebook GitHub Bot
parent f16ba42116
commit 490d11a012
2 changed files with 23 additions and 4 deletions

View File

@ -229,11 +229,18 @@ struct AdvancedColumnFamilyOptions {
// if it is not explicitly set by the user. Otherwise, the default is 0.
int64_t max_write_buffer_size_to_maintain = 0;
// Allows thread-safe inplace updates. If this is true, there is no way to
// Allows thread-safe inplace updates.
//
// If this is true, there is no way to
// achieve point-in-time consistency using snapshot or iterator (assuming
// concurrent updates). Hence iterator and multi-get will return results
// which are not consistent as of any point-in-time.
//
// Backward iteration on memtables will not work either.
//
// It is intended to work or be compatible with a limited set of features:
// (1) Non-snapshot Get()
//
// If inplace_callback function is not set,
// Put(key, new_value) will update inplace the existing_value iff
// * key exists in current memtable

View File

@ -74,9 +74,16 @@ default_params = {
"destroy_db_initially": 0,
"enable_pipelined_write": lambda: random.randint(0, 1),
"enable_compaction_filter": lambda: random.choice([0, 0, 0, 1]),
# TODO(hx235): re-enable `inplace_update_support` after fixing the
# inconsistency issue it surfaced
"inplace_update_support": 0,
# `inplace_update_support` is incompatible with DB that has delete
# range data in memtables.
# Such data can result from any of the previous db stress runs
# using delete range.
# Since there is no easy way to keep track of whether delete range
# is used in any of the previous runs,
# to simpify our testing, we set `inplace_update_support` across
# runs and to disable delete range accordingly
# (see below `finalize_and_sanitize`).
"inplace_update_support": random.choice([0] * 9 + [1]),
"expected_values_dir": lambda: setup_expected_values_dir(),
"fail_if_options_file_error": lambda: random.randint(0, 1),
"flush_one_in": lambda: random.choice([1000, 1000000]),
@ -673,6 +680,11 @@ def finalize_and_sanitize(src_params):
):
dest_params["delpercent"] += dest_params["delrangepercent"]
dest_params["delrangepercent"] = 0
if dest_params["inplace_update_support"] == 1:
dest_params["delpercent"] += dest_params["delrangepercent"]
dest_params["delrangepercent"] = 0
dest_params["readpercent"] += dest_params["prefixpercent"]
dest_params["prefixpercent"] = 0
if (
dest_params.get("disable_wal") == 1
or dest_params.get("sync_fault_injection") == 1