@@ -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." );
6565TAG_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+
7378DEFINE_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