Skip to content

Commit 6dbe5e6

Browse files
committed
[#28894] docdb: Enable skip prefix locks by default
Summary: Set skip_prefix_locks = true to enable skip prefix locks by default. Jira: DB-18616 Test Plan: existing unit tests Reviewers: rthallam Reviewed By: rthallam Subscribers: ybase, yql Differential Revision: https://phorge.dev.yugabyte.com/D47359
1 parent d70256c commit 6dbe5e6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressProc.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ protected Map<String, String> getTServerFlags() {
3434
Map<String, String> flagMap = super.getTServerFlags();
3535
// Setting the below flag stabilizes yb_lock_status tests.
3636
flagMap.put("TEST_delay_before_get_old_transactions_heartbeat_intervals", "2");
37+
flagMap.put("skip_prefix_locks", "false");
3738
return flagMap;
3839
}
3940

src/yb/tablet/write_query.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,17 @@ DEFINE_RUNTIME_bool(disable_alter_vs_write_mutual_exclusion, false,
6464
"operation take an exclusive lock making all write operations wait for it.");
6565
TAG_FLAG(disable_alter_vs_write_mutual_exclusion, advanced);
6666

67-
DEFINE_RUNTIME_bool(skip_prefix_locks, false,
67+
DEFINE_RUNTIME_bool(skip_prefix_locks, true,
6868
"Enable to skip writing weak intent locks on intermediate prefixes of the actual PK being "
6969
"written. This reduces the number of key-value pairs written to the intents db, resulting in "
7070
"better performance. However, it may lead to high contention when serializable isolation "
7171
"transactions are present in the workload.");
7272

73+
DEFINE_RUNTIME_AUTO_bool(skip_prefix_locks_for_upgrade, kLocalPersisted, false, true,
74+
"The gflag is for upgrade and should not be changed. skip prefix lock is enabled only if "
75+
"both skip_prefix_locks and skip_prefix_locks_for_upgrade are true. To disable the feature, "
76+
"just set skip_prefix_locks to false.");
77+
7378
DEFINE_RUNTIME_bool(skip_prefix_locks_suppress_warning_for_serializable_op, false,
7479
"If false, logs a warning when a serializable transaction runs with skip prefix locks enabled."
7580
"Serializable isolation transactions are not meant to be run if skip_prefix_locks is enabled. "
@@ -830,7 +835,8 @@ Status WriteQuery::DoExecute() {
830835
auto transaction_id = VERIFY_RESULT(FullyDecodeTransactionId(
831836
write_batch.transaction().transaction_id()));
832837

833-
const bool should_skip_prefix_locks = FLAGS_skip_prefix_locks && FLAGS_ysql_enable_packed_row;
838+
const bool should_skip_prefix_locks = FLAGS_skip_prefix_locks &&
839+
FLAGS_skip_prefix_locks_for_upgrade && FLAGS_ysql_enable_packed_row;
834840
skip_prefix_locks = should_skip_prefix_locks ?
835841
dockv::SkipPrefixLocks::kTrue : dockv::SkipPrefixLocks::kFalse;
836842
write_batch.mutable_transaction()->set_skip_prefix_locks(should_skip_prefix_locks);

0 commit comments

Comments
 (0)