Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize Tablet with super_read_only mode #12206

Merged
merged 74 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
14dcc78
Adding super read only in cnf file
rsajwani Nov 14, 2022
b5caff3
add new init sql file for unit test
rsajwani Nov 15, 2022
d64bab0
enable super-readonly by default
rsajwani Nov 22, 2022
c7bcd52
Fixing some arrangement for super-read-only
rsajwani Nov 24, 2022
978d02c
Fix end to end tests
rsajwani Dec 1, 2022
6a9c93d
fix rpc_replication issue
rsajwani Dec 6, 2022
8b14bed
Fixing backup tests
rsajwani Dec 7, 2022
014115a
fixing error with spacing in init sql file
rsajwani Dec 9, 2022
c4eb7f0
vtgate end to end fixes
rsajwani Dec 10, 2022
8374e14
some more test fixes
rsajwani Dec 10, 2022
a52c1bc
fixing flag tests and more
rsajwani Dec 12, 2022
eac4d6a
fixing schema sql
rsajwani Dec 14, 2022
c196413
fixing unit tests
rsajwani Dec 16, 2022
ce52ba4
fixing vttest server test cases
rsajwani Dec 17, 2022
cc6cf01
fixing more downgrad upgrade test
rsajwani Dec 21, 2022
4e0bd80
fixing reparent upgrade downgrade test
rsajwani Dec 22, 2022
215f318
Bug fix for replication position
rsajwani Jan 19, 2023
4da62a4
Fixing vtexplain tests
rsajwani Jan 19, 2023
8c4e933
Fixing mariadb initialization
rsajwani Jan 23, 2023
e8afcab
fixing upgrade downgrade e2e test
rsajwani Jan 23, 2023
3c26c6b
Fixing assignment of init sql db file
rsajwani Jan 24, 2023
46ab550
code clean up
rsajwani Jan 24, 2023
a3804ca
Fixing backup test
rsajwani Jan 24, 2023
deba5c7
adding super read only api for sql demon
rsajwani Jan 25, 2023
d443df5
converting read-only calls to super-read-only calls
rsajwani Jan 25, 2023
31664d7
restructure vtexplain code to be more generic
rsajwani Jan 26, 2023
e7a8aeb
forgot to make proto vtadmin
rsajwani Jan 26, 2023
b07097d
Code review part-1
rsajwani Jan 28, 2023
349a302
remove code for redolog in test
rsajwani Jan 28, 2023
2a1f185
fix ensureDB test
rsajwani Jan 29, 2023
0a4f29e
code review part-2
rsajwani Jan 30, 2023
e8a9851
Remove setSuperReadOnly checks
rsajwani Jan 30, 2023
cc37e73
code review part-3
rsajwani Jan 30, 2023
dac1d46
Try restoring without super_read_only
rsajwani Jan 31, 2023
36f3628
test: simplify vtorc test to not require turning off super-read-only
GuptaManan100 Jan 31, 2023
d94f977
code review part-4
rsajwani Feb 1, 2023
e31ec31
Fixing typo
rsajwani Feb 1, 2023
5b32fd4
code review part-5
rsajwani Feb 2, 2023
272814f
clean up some code
rsajwani Feb 2, 2023
fd9df61
test: fix vtorc test
GuptaManan100 Feb 2, 2023
1f2df82
Merge remote-tracking branch 'upstream/main' into tablet-init-super-r…
rsajwani Feb 2, 2023
89c1b4b
Code clean up - part 2
rsajwani Feb 2, 2023
8e158e2
Adding summary
rsajwani Feb 3, 2023
185cf53
Merge remote-tracking branch 'upstream/main' into tablet-init-super-r…
rsajwani Feb 3, 2023
b81b354
code cleanup
rsajwani Feb 6, 2023
7fe7a89
Removing init_testserver to test its dependenciesy
rsajwani Feb 11, 2023
4ead779
Merge remote-tracking branch 'upstream/main' into tablet-init-super-r…
rsajwani Feb 11, 2023
402b449
fixing downgrade/upgrade and bringing back mariadb check
rsajwani Feb 11, 2023
3d1435d
Removing mariadb check from vttest
rsajwani Feb 12, 2023
8997da5
deprecating `use_super_read_only` flag
rsajwani Feb 12, 2023
8556879
Modify FullStatus test
rsajwani Feb 13, 2023
12ddd17
code clean-up
rsajwani Feb 13, 2023
d4e9ef1
code cleanup - part 2
rsajwani Feb 13, 2023
5c5ca78
fixing fullstatus test
rsajwani Feb 14, 2023
9153e19
code review feedback
rsajwani Feb 15, 2023
bd84f1c
Merge remote-tracking branch 'upstream/main' into tablet-init-super-r…
rsajwani Feb 15, 2023
234d89c
fixing summary and some minor cleanup
rsajwani Feb 15, 2023
a653287
remove extra logging
rsajwani Feb 16, 2023
e3d1607
moving init_testserver_db under test folder
rsajwani Feb 16, 2023
2d7636f
fixing code comment
rsajwani Feb 16, 2023
f3b1958
Merge remote-tracking branch 'upstream/main' into tablet-init-super-r…
rsajwani Feb 24, 2023
fdc2eef
trying out password db init file for PITR test
rsajwani Mar 1, 2023
525afb9
Merge remote-tracking branch 'upstream/main' into tablet-init-super-r…
rsajwani Mar 1, 2023
f7b3546
remove read-only flag from default.cnf
rsajwani Mar 1, 2023
47ee6ad
Removing QueryTabletWithSuperReadOnlyHandling method
rsajwani Mar 3, 2023
1723696
Merge remote-tracking branch 'upstream/main' into tablet-init-super-r…
rsajwani Mar 3, 2023
2be3147
moving flag at right place
rsajwani Mar 3, 2023
cf9b781
code review feedback
rsajwani Mar 7, 2023
422b7cc
Merge remote-tracking branch 'upstream/main' into tablet-init-super-r…
rsajwani Mar 7, 2023
30f36d6
fixing require.noerror check
rsajwani Mar 8, 2023
b1683bd
code review - part 2
rsajwani Mar 8, 2023
ca0aefe
Merge remote-tracking branch 'upstream/main' into tablet-init-super-r…
rsajwani Mar 8, 2023
1980366
code review phase 3
rsajwani Mar 11, 2023
53ea516
revert uncommented code
rsajwani Mar 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/upgrade_downgrade_test_backups_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vttablet
rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
rsajwani marked this conversation as resolved.
Show resolved Hide resolved
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vttablet --version

# Run test with VTTablet at version N-1 and VTBackup at version N
Expand All @@ -181,9 +183,11 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vtbackup $PWD/bin/vttablet
rm -f $PWD/bin/vtbackup $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-current/bin/vtbackup $PWD/bin/vtbackup
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vtbackup --version
vttablet --version

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,10 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vttablet
rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vttablet --version

# Run test with VTTablet at version N+1 and VTBackup at version N
Expand All @@ -184,9 +186,11 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vtbackup $PWD/bin/vttablet
cp /tmp/vitess-build-current/bin/vtbackup $PWD/bin/vtbackup
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
rm -f $PWD/bin/vtbackup $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-other/bin/vtbackup $PWD/bin/vtbackup
cp /tmp/vitess-build-current/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-current/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-current/bin/mysqlctld $PWD/bin/mysqlctld
vtbackup --version
vttablet --version

Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/upgrade_downgrade_test_backups_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,10 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vttablet
rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vttablet --version

# Starting the tablets again, they will automatically start restoring the last backup.
Expand Down Expand Up @@ -290,8 +292,10 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vttablet
rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-current/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-current/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-current/bin/mysqlctld $PWD/bin/mysqlctld
vttablet --version

# Starting the tablets again and restoring the previous backup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vttablet
rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vttablet --version

# Starting the tablets again, they will automatically start restoring the last backup.
Expand Down Expand Up @@ -293,8 +295,10 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vttablet
rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-current/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-current/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-current/bin/mysqlctld $PWD/bin/mysqlctld
vttablet --version

# Starting the tablets again and restoring the next backup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vtgate $PWD/bin/vttablet
rm -f $PWD/bin/vtgate $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-current/bin/vtgate $PWD/bin/vtgate
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vtgate --version
vttablet --version

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,11 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vtgate $PWD/bin/vttablet
rm -f $PWD/bin/vtgate $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-current/bin/vtgate $PWD/bin/vtgate
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vtgate --version
vttablet --version

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vtgate $PWD/bin/vttablet
rm -f $PWD/bin/vtgate $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-current/bin/vtgate $PWD/bin/vtgate
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vtgate --version
vttablet --version

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,11 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vtgate $PWD/bin/vttablet
rm -f $PWD/bin/vtgate $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-current/bin/vtgate $PWD/bin/vtgate
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vtgate --version
vttablet --version

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,10 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vttablet
rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vtctl --version
vttablet --version

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ jobs:
run: |
source build.env

rm -f $PWD/bin/vttablet
rm -f $PWD/bin/vttablet $PWD/bin/mysqlctl $PWD/bin/mysqlctld
cp /tmp/vitess-build-other/bin/vttablet $PWD/bin/vttablet
cp /tmp/vitess-build-other/bin/mysqlctl $PWD/bin/mysqlctl
cp /tmp/vitess-build-other/bin/mysqlctld $PWD/bin/mysqlctld
vtctl --version
vttablet --version

Expand Down
12 changes: 12 additions & 0 deletions config/init_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
###############################################################################
# Equivalent of mysql_secure_installation
###############################################################################
# We need to ensure that super_read_only is disabled so that we can execute
# these commands. Note that disabling it does NOT disable read_only.
# We save the current value so that we only re-enable it at the end if it was
# enabled before.
SET @original_super_read_only=IF(@@global.super_read_only=1, 'ON', 'OFF');
SET GLOBAL super_read_only='OFF';
rsajwani marked this conversation as resolved.
Show resolved Hide resolved

# Changes during the init db should not make it to the binlog.
# They could potentially create errant transactions on replicas.
Expand Down Expand Up @@ -77,3 +83,9 @@ FLUSH PRIVILEGES;

RESET SLAVE ALL;
RESET MASTER;

# custom sql is used to add custom scripts like creating users/passwords. We use it in our tests
# add custom sql here
rsajwani marked this conversation as resolved.
Show resolved Hide resolved

# We need to set super_read_only back to what it was before
SET GLOBAL super_read_only=IFNULL(@original_super_read_only, 'OFF');
rsajwani marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 0 additions & 3 deletions config/mycnf/default.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ port = {{.MysqlPort}}
secure-file-priv = {{.SecureFilePriv}}
{{end}}

# all db instances should start in read-only mode - once the db is started and
# fully functional, we'll push it into read-write mode
read-only
rsajwani marked this conversation as resolved.
Show resolved Hide resolved
server-id = {{.ServerID}}

# all db instances should skip starting replication threads - that way we can do any
Expand Down
4 changes: 4 additions & 0 deletions config/mycnf/mysql57.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisy
rpl_semi_sync_master_timeout = 1000000000000000000
rpl_semi_sync_master_wait_no_slave = 1

# In order to protect against any errand GTIDs we will start the mysql instance
# in super-read-only mode.
super-read-only

4 changes: 4 additions & 0 deletions config/mycnf/mysql80.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ plugin-load = rpl_semi_sync_master=semisync_master.so;rpl_semi_sync_slave=semisy
loose_rpl_semi_sync_master_timeout = 1000000000000000000
loose_rpl_semi_sync_master_wait_no_slave = 1

# In order to protect against any errand GTIDs we will start the mysql instance
# in super-read-only mode.
super-read-only

3 changes: 3 additions & 0 deletions config/mycnf/test-suite.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ sql_mode = STRICT_TRANS_TABLES

# set a short heartbeat interval in order to detect failures quickly
slave_net_timeout = 4
# test-suite is mainly used for vttestserver, which does not need super-read-only. Therefore,
# we are disabling it.
super-read-only = false
rsajwani marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 15 additions & 1 deletion doc/releasenotes/17_0_0_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
- **[New stats](#new-stats)**
- [Detailed backup and restore stats](#detailed-backup-and-restore-stats)
- **[Deprecations and Deletions](#deprecations-and-deletions)**
- **[VTTablet](#vttablet)**
- [VTTablet: Initializing all replicas with super_read_only](#vttablet-initialization)
- [Deprecated Flags](#deprecated-flags)

## <a id="major-changes"/> Major Changes

Expand Down Expand Up @@ -168,4 +171,15 @@ Some notes to help understand these metrics:

## <a id="deprecations-and-deletions"/> Deprecations and Deletions

* The deprecated `automation` and `automationservice` protobuf definitions and associated client and server packages have been removed.
* The deprecated `automation` and `automationservice` protobuf definitions and associated client and server packages have been removed.
### <a id="vttablet"/> VTTablet
#### <a id="vttablet-initialization"/> Initializing all replicas with super_read_only
In order to prevent SUPER privileged users like `root` or `vt_dba` from producing errant GTIDs on replicas, all the replica MySQL servers are initialized with the MySQL
global variable `super_read_only` value set to `ON`. During failovers, we set `super_read_only` to `OFF` for the promoted primary tablet. This will allow the
primary to accept writes. All replicas except the primary will still have their global variable `super_read_only` set to `ON`. This will make sure that apart from
rsajwani marked this conversation as resolved.
Show resolved Hide resolved
MySQL replication no other component or offline system can write directly to a replica.
rsajwani marked this conversation as resolved.
Show resolved Hide resolved

Reference PR for this change is [PR #12206](https://github.com/vitessio/vitess/pull/12206)

#### <a id="deprecated-flags"/> Deprecated Flags
The flag `use_super_read_only` is deprecated and will be removed in a later release.
15 changes: 15 additions & 0 deletions go/cmd/vtbackup/vtbackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,19 @@ func takeBackup(ctx context.Context, topoServer *topo.Server, backupStorage back
if err := mysqld.ResetReplication(ctx); err != nil {
return fmt.Errorf("can't reset replication: %v", err)
}
// We need to switch off super_read_only before we create database.
rsajwani marked this conversation as resolved.
Show resolved Hide resolved
resetFunc, err := mysqld.SetSuperReadOnly(false)
rsajwani marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return fmt.Errorf("can't turn-off super_read_only during backup: %v", err)
rsajwani marked this conversation as resolved.
Show resolved Hide resolved
}
if resetFunc != nil {
defer func() {
err := resetFunc()
if err != nil {
log.Info("not able to set super_read_only to its original value during backup")
rsajwani marked this conversation as resolved.
Show resolved Hide resolved
}
}()
}
cmd := mysqlctl.GenerateInitialBinlogEntry()
if err := mysqld.ExecuteSuperQueryList(ctx, []string{cmd}); err != nil {
return err
Expand Down Expand Up @@ -404,6 +417,8 @@ func takeBackup(ctx context.Context, topoServer *topo.Server, backupStorage back
return err
}

log.Infof("takeBackup: primary position is: %s", primaryPos.String())
rsajwani marked this conversation as resolved.
Show resolved Hide resolved

// Remember the time when we fetched the primary position, not when we caught
// up to it, so the timestamp on our backup is honest (assuming we make it
// to the goal position).
Expand Down
1 change: 0 additions & 1 deletion go/flags/endtoend/vttablet.txt
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ Usage of vttablet:
--tx_throttler_config string The configuration of the transaction throttler as a text formatted throttlerdata.Configuration protocol buffer message (default "target_replication_lag_sec: 2\nmax_replication_lag_sec: 10\ninitial_rate: 100\nmax_increase: 1\nemergency_decrease: 0.5\nmin_duration_between_increases_sec: 40\nmax_duration_between_increases_sec: 62\nmin_duration_between_decreases_sec: 20\nspread_backlog_across_sec: 20\nage_bad_rate_after_sec: 180\nbad_rate_increase: 0.1\nmax_rate_approach_threshold: 0.9\n")
--tx_throttler_healthcheck_cells strings A comma-separated list of cells. Only tabletservers running in these cells will be monitored for replication lag by the transaction throttler.
--unhealthy_threshold duration replication lag after which a replica is considered unhealthy (default 2h0m0s)
--use_super_read_only Set super_read_only flag when performing planned failover.
--v Level log level for V logs
-v, --version print binary version
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging
Expand Down
36 changes: 36 additions & 0 deletions go/mysql/fakesqldb/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,3 +783,39 @@ func (db *DB) MockQueriesForTable(table string, result *sqltypes.Result) {
cols...,
))
}

func (db *DB) GetRejectedQueryResult(key string) error {
// check if we should reject it.
if err, ok := db.rejectedData[key]; ok {
return err
}

return nil
}

func (db *DB) GetQueryResult(key string) *ExpectedResult {
// Check explicit queries from AddQuery().
result, ok := db.data[key]
if ok {
return result
}
return nil
}

func (db *DB) GetQueryPatternResult(key string) (func(string), ExpectedResult, bool, error) {
for _, pat := range db.patternData {
if pat.expr.MatchString(key) {
userCallback, ok := db.queryPatternUserCallback[pat.expr]
if ok {
if pat.err != "" {
return userCallback, ExpectedResult{pat.result, nil}, true, fmt.Errorf(pat.err)
}
return userCallback, ExpectedResult{pat.result, nil}, true, nil
}

return nil, ExpectedResult{nil, nil}, false, nil
}
}

return nil, ExpectedResult{nil, nil}, false, nil
}
6 changes: 3 additions & 3 deletions go/test/endtoend/backup/pitr/backup_mysqlctld_pitr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ func TestIncrementalBackupMysqlctld(t *testing.T) {
if tc.writeBeforeBackup {
backup.InsertRowOnPrimary(t, "")
}
// we wait for 1 second because backups ar ewritten to a directory named after the current timestamp,
// in 1 second resolution. We want to aoid two backups that have the same pathname. Realistically this
// is only ever a problem in this endtoend test, not in production.
// we wait for 1 second because backups are written to a directory named after the current timestamp,
// in 1 second resolution. We want to avoid two backups that have the same pathname. Realistically this
// is only ever a problem in this end-to-end test, not in production.
// Also, we gie the replica a chance to catch up.
time.Sleep(1100 * time.Millisecond)
waitForReplica(t)
Expand Down
Loading