Skip to content

Commit

Permalink
VReplication: Use MariaDB Compat JSON Functions (#12420)
Browse files Browse the repository at this point in the history
This is needed to better support importing from
MariaDB into Vitess/MySQL.

Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord authored Feb 22, 2023
1 parent 8528903 commit fa2c0a6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go/vt/vttablet/tabletmanager/vdiff/engine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func TestEngineRetryErroredVDiffs(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
vdiffenv.dbClient.ExpectRequest("select * from _vt.vdiff where state = 'error' and options->>'$.core_options.auto_retry' = 'true'", tt.retryQueryResults, nil)
vdiffenv.dbClient.ExpectRequest("select * from _vt.vdiff where state = 'error' and json_unquote(json_extract(options, '$.core_options.auto_retry')) = 'true'", tt.retryQueryResults, nil)

// Right now this only supports a single row as with multiple rows we have
// multiple controllers in separate goroutines and the order is not
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vttablet/tabletmanager/vdiff/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (
where vd.id = vdt.vdiff_id and vd.id = %d and vd.state != 'completed'`
sqlGetVReplicationEntry = "select * from _vt.vreplication %s"
sqlGetVDiffsToRun = "select * from _vt.vdiff where state in ('started','pending')" // what VDiffs have not been stopped or completed
sqlGetVDiffsToRetry = "select * from _vt.vdiff where state = 'error' and options->>'$.core_options.auto_retry' = 'true'"
sqlGetVDiffsToRetry = "select * from _vt.vdiff where state = 'error' and json_unquote(json_extract(options, '$.core_options.auto_retry')) = 'true'"
sqlGetVDiffID = "select id as id from _vt.vdiff where vdiff_uuid = %s"
sqlGetAllVDiffs = "select * from _vt.vdiff order by id desc"
sqlGetAllTableRows = "select table_name as table_name, table_rows as table_rows from INFORMATION_SCHEMA.TABLES where table_schema = %s and table_name in (%s)"
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vttablet/tabletmanager/vreplication/vreplicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ const (
select pca.id from _vt.post_copy_action as pca inner join _vt.vreplication as vr on (pca.vrepl_id = vr.id)
where pca.table_name=%a
) for update`
sqlGetPostCopyActionTaskByType = `select action->>'$.task' from _vt.post_copy_action where
action->>'$.type'=%a and vrepl_id=%a and table_name=%a`
sqlGetPostCopyActionTaskByType = `select json_unquote(json_extract(action, '$.task')) as task from _vt.post_copy_action where
json_unquote(json_extract(action, '$.type'))=%a and vrepl_id=%a and table_name=%a`
sqlDeletePostCopyAction = `delete from _vt.post_copy_action where vrepl_id=%a and
table_name=%a and id=%a`
)
Expand Down

0 comments on commit fa2c0a6

Please sign in to comment.