Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

loader, syncer: support create/drop view #1310

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3fafe7b
save work
lance6716 Nov 27, 2020
246e4bb
add test
lance6716 Nov 27, 2020
a6878f8
add ut
lance6716 Nov 27, 2020
7412f64
Merge branch 'master' of https://github.com/pingcap/dm into support-view
lance6716 Nov 27, 2020
ba1e0b2
fix CI
lance6716 Nov 27, 2020
8089a8e
change script
lance6716 Nov 27, 2020
e431dda
fix CI
lance6716 Nov 27, 2020
0823ba2
Merge branch 'master' into support-view
GMHDBJD Nov 27, 2020
fbcd1fc
Merge branch 'master' of https://github.com/pingcap/dm into support-view
lance6716 Nov 28, 2020
7d6fa37
support "as select xxx" in view
lance6716 Nov 28, 2020
89934cc
remove debug
lance6716 Nov 28, 2020
b7f7438
remove TODO
lance6716 Nov 28, 2020
8a54a3d
try fix CI
lance6716 Nov 28, 2020
0b14140
add check and remove unused code
lance6716 Nov 28, 2020
d168716
address comment
lance6716 Dec 1, 2020
4d94b05
Merge branch 'master' into support-view
lance6716 Dec 1, 2020
16897d4
Merge branch 'master' of https://github.com/pingcap/dm into support-view
lance6716 Dec 23, 2020
ad14b9d
bring VIEW test back
lance6716 Dec 23, 2020
1fa1a7e
Merge branch 'master' of https://github.com/pingcap/dm into support-view
lance6716 Dec 30, 2020
a9fdc88
VIEW didn't need sync group
lance6716 Dec 30, 2020
5f55bf3
update dumpling
lance6716 Dec 31, 2020
a91adcb
register / remove metrics of dumpling
lance6716 Dec 31, 2020
ff9d825
Revert "register / remove metrics of dumpling"
lance6716 Dec 31, 2020
690b7e7
Revert "update dumpling"
lance6716 Dec 31, 2020
56ba826
test shard DDL mixed with VIEW
lance6716 Jan 7, 2021
1cd0dc4
improve wait time
lance6716 Jan 7, 2021
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
56 changes: 56 additions & 0 deletions tests/shardddl3/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,61 @@ function DM_RestartMaster() {
}

function DM_SyncView_CASE() {
# test sharding lock mixed VIEW
# 1/3 shard DDL
run_sql_source1 "alter table ${shardddl1}.${tb1} add column c int;"

run_sql_source1 "create view ${shardddl1}.v1 as select * from ${shardddl1}.${tb1};"
sleep 1
run_sql_tidb "show create view ${shardddl}.v"
check_contains "View: v"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems view is created here in pessimistic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. VIEW is pretend to sync in none ShardMode, try to immediately execute to downstream.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the table may not be created?

create table                        <-- not sync
create view                         <-- sync
                     create table
                     create view

if [[ "$1" = "pessimistic" ]]; then
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"query-status test" \
'ALTER TABLE `shardddl`.`tb` ADD COLUMN `c` INT' 1
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"show-ddl-locks" \
"\"result\": true" 1 \
"no DDL lock exists" 1
else
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"show-ddl-locks" \
"\"ID\": \"test-\`shardddl\`.\`tb\`\"" 1
fi

# 2/3 shard DDL
run_sql_source1 "alter table ${shardddl1}.${tb2} add column c int;"

run_sql_source1 "drop view ${shardddl1}.v1;"
if [[ "$1" = "pessimistic" ]]; then
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"query-status test" \
'ALTER TABLE `shardddl`.`tb` ADD COLUMN `c` INT' 1
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"show-ddl-locks" \
"\"result\": true" 1 \
'ALTER TABLE `shardddl`.`tb` ADD COLUMN `c` INT' 1
# DDL lock will stop sync of VIEW
else
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"show-ddl-locks" \
"\"ID\": \"test-\`shardddl\`.\`tb\`\"" 1
sleep 2
run_sql_tidb "show create view ${shardddl}.v" && exit 1 || true
fi

# 3/3 shard DDL
run_sql_source2 "alter table ${shardddl1}.${tb1} add column c int;"
if [[ "$1" = "pessimistic" ]]; then
sleep 1
run_sql_tidb "show create view ${shardddl}.v" && exit 1 || true
fi
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"show-ddl-locks" \
"\"result\": true" 1 \
"no DDL lock exists" 1

# --------------------------------------------------
# sync of view didn't need shard DDL synchronization
run_sql_source2 "create view ${shardddl1}.v1 as select * from ${shardddl1}.${tb1};"
sleep 1
Expand Down Expand Up @@ -874,6 +929,7 @@ function DM_SyncView() {
function run() {
init_cluster
init_database

start=71
end=103
except=(072 074 075 083 084 087 088 089 090 091 092 093)
Expand Down