WL#12892: Deprecate slave-rows-search-algorithms
Affects: Server-8.0
—
Status: Complete
EXECUTIVE SUMMARY
=================
This worklog implements a deprecation warning when user engages the
command line option (or the corresponding system variable)
--slave_rows_search_algorithms.
BACKGROUND
==========
The option slave-rows-search-algorithms controls how the replication
applier looks up rows in tables, when applying UPDATE or DELETE row
events. The default for this option is HASH_SCAN,INDEX_SCAN as of 8.0,
and this is always best, both for performance and (in a corner case)
for correctness. So it is better to not give the possibility to use
any other algorithm.
User Stories
------------
U1. As a user, I don't want the server to have options that should
never be changed, so that there is less to learn in order to use
the server.
U2. As a user, I want replication to always be as fast as possible,
and not have options to make it slower.
U3. As a user, I want replication to always work, and not have options
that might break it.
Notes:
1. For indexed tables, it is always faster to use INDEX_SCAN.
2. For unindexed tables, it is always faster to use HASH_SCAN.
3. For indexed tables, using TABLE_SCAN,HASH_SCAN can make the slave
stop with an error (duplicate key) in cases like the following:
CREATE TABLE t (a INT PRIMARY KEY, b INT UNIQUE NOT NULL);
INSERT INTO t VALUES (1, 2), (2, 1);
UPDATE t SET b = b - 1 WHERE b > 0;
(I.e., rows are updated on master in the order of a secondary index, and
the row updates are order-dependent in such a way that doing the same row
updates in primary key order will create collisions in some index.)
4. For indexed tables, using TABLE_SCAN,HASH_SCAN can make the slave
stop with an error (key not found) in cases like the following:
--delimiter |
CREATE FUNCTION f1 () RETURNS INT BEGIN
UPDATE t1 SET a = 2 WHERE a = 1;
UPDATE t1 SET a = 3 WHERE a = 2;
RETURN 0;
END|
--delimiter ;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
SELECT f1();
Functional Requirements
=======================
FR1: Server SHALL emit a warning, at server start time, when
configuring slave_rows_search_algorithms in the server
configuration file.
FR2: Server SHALL emit a warning, at server start time, when passing
slave_rows_search_algorithms as a server start up option on the
command line.
FR3: Warning shall be emitted in the user session when the user reads
the variable @@global.slave_rows_search_algorithms.
FR4: Warning shall be emitted in the user session when the user SETS
the variable @@global.slave_rows_search_algorithms.
FR5: Warning shall be emitted in the user session when the user issues
SET PERSIST slave_rows_search_algorithms or SET PERSIST_ONLY
slave_rows_search_algorithms.
User Visible Changes
====================
- Server emits a deprecation warning in the session when the user
selects @@global.slave_rows_search_algorithms.
"Warning 1287 '@@slave_rows_search_algorithms' is deprecated and will
be removed in a future release."
- Server emits a deprecation warning in the session when the user sets
@@global.slave_rows_search_algorithms.
"Warning 1287 '@@slave_rows_search_algorithms' is deprecated and
will be removed in a future release."
- Server emits a deprecation warning at start up if the
slave_rows_search_algorithms config option is set, either through
the config file or through a command line option.
"2019-07-09T22:45:35.948175Z 0 [Warning] [MY-011069] [Server] The
syntax '--slave-rows-search-algorithms' is deprecated and will be
removed in a future release."
Upgrades
========
After upgrading to the version that contains this change then the user
will get the aforementioned deprecation warnings. This, however, shall
not break backwards compatibility.
Security
========
There are no security considerations.
Observability
=============
There are no observability considerations. There is no new
functionality added only a new warning is emitted.
LOW LEVEL CHANGES
=================
1. Deploy DEPRECATED_VAR("") in the slave_rows_search_algorithms
system variable declaration.
2. Deploy conditional calls to push_deprecated_warn in
mysql_get_one_options, for slave_rows_search_algorithms so that the
warning is pushed at server start time, when the options is set.
3. Add deprecation test case validating session and server start
warnings.
Copyright (c) 2000, 2025, Oracle Corporation and/or its affiliates. All rights reserved.