Skip to content

Commit c6c877e

Browse files
committed
fix application of applyEvent.writeFunc
1 parent f209592 commit c6c877e

File tree

4 files changed

+32
-34
lines changed

4 files changed

+32
-34
lines changed

go/logic/migrator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,9 +1293,9 @@ func (this *Migrator) onApplyEventStruct(eventStruct *applyEventStruct) error {
12931293
}
12941294
return nil
12951295
}
1296-
// if eventStruct.dmlEvent == nil {
1297-
// return handleNonDMLEventStruct(eventStruct)
1298-
// }
1296+
if eventStruct.writeFunc != nil {
1297+
return handleNonDMLEventStruct(eventStruct)
1298+
}
12991299
if eventStruct.trxEvent != nil {
13001300
this.migrationContext.Log.Infof("got transaction: %+v", eventStruct.trxEvent)
13011301
batchSize := int(atomic.LoadInt64(&this.migrationContext.DMLBatchSize))

localtests/docker-compose.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ services:
22
mysql-primary:
33
image: mysql:8.0.39
44
container_name: mysql-primary
5-
command: --server-id=1 --log-bin=mysql-bin --binlog-format=row --gtid-mode=ON
6-
volumes:
7-
- /var/lib/mysql
5+
command: --server-id=1 --log-bin=mysql-bin --binlog-format=row --gtid-mode=ON --enforce-gtid-consistency=ON
6+
# volumes:
7+
# - /var/lib/mysql
88
environment:
99
MYSQL_ROOT_PASSWORD: opensesame
1010
MYSQL_DATABASE: test
@@ -18,9 +18,9 @@ services:
1818
mysql-replica:
1919
image: mysql:8.0.39
2020
container_name: mysql-replica
21-
command: --server-id=2 --log-bin=mysql-bin --binlog-format=row --gtid-mode=ON
22-
volumes:
23-
- /var/lib/mysql
21+
command: --server-id=2 --log-bin=mysql-bin --binlog-format=row --gtid-mode=ON --enforce-gtid-consistency=ON
22+
# volumes:
23+
# - /var/lib/mysql
2424
environment:
2525
MYSQL_ROOT_PASSWORD: opensesame
2626
MYSQL_DATABASE: test

localtests/test.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ master_port=
2323
replica_host=
2424
replica_port=
2525
original_sql_mode=
26+
docker=false
2627

2728
OPTIND=1
28-
while getopts "b:s:" OPTION
29+
while getopts "b:s:d" OPTION
2930
do
3031
case $OPTION in
3132
b)
3233
ghost_binary="$OPTARG";;
3334
s)
3435
storage_engine="$OPTARG";;
36+
d)
37+
docker=true;;
3538
esac
3639
done
3740
shift $((OPTIND-1))
@@ -94,20 +97,17 @@ start_replication() {
9497
done
9598
}
9699

97-
test_single_docker() {
98-
#docker compose setup
99-
master_host="0.0.0.0"
100-
master_port="3307"
101-
replica_host="0.0.0.0"
102-
replica_port="3308"
103-
104-
test_single "$1"
105-
}
106-
107100
test_single() {
108101
local test_name
109102
test_name="$1"
110103

104+
if [ "$docker" = true ]; then
105+
master_host="0.0.0.0"
106+
master_port="3307"
107+
replica_host="0.0.0.0"
108+
replica_port="3308"
109+
fi
110+
111111
if [ -f $tests_path/$test_name/ignore_versions ] ; then
112112
ignore_versions=$(cat $tests_path/$test_name/ignore_versions)
113113
mysql_version=$(gh-ost-test-mysql-master -s -s -e "select @@version")

script/docker-gh-ost-replica-tests

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
verbose=true
4+
# execute from gh-ost repo root directory
45
root_dir="$PWD"
56

67
container_exec() {
@@ -10,14 +11,6 @@ container_exec() {
1011
docker exec "$1" bash -c "MYSQL_PWD=opensesame mysql -uroot -Ne \"$2\" test"
1112
}
1213

13-
primary_exec() {
14-
container_exec "mysql-primary" "$1"
15-
}
16-
17-
replica_exec() {
18-
container_exec "mysql-replica" "$1"
19-
}
20-
2114
poll_container() {
2215
CTR=0
2316
while ! container_exec "$1" "select 1;" 2>&1 | grep -q "1"
@@ -37,11 +30,16 @@ setup() {
3730
poll_container "mysql-primary"
3831
poll_container "mysql-replica"
3932

40-
primary_exec "alter user 'repl'@'%' identified with 'mysql_native_password' by 'repl';"
41-
primary_exec "grant replication slave on *.* to 'repl'@'%'; flush privileges;"
42-
primary_exec "show master status;" | read logfile logpos
43-
replica_exec "change replication source to source_host='mysql-primary', source_port=3307, source_user='repl', source_password='repl', source_log_file='$logfile', source_log_pos=$logpos;"
44-
replica_exec "start replica;"
33+
export PATH="$PATH:$root_dir/script"
34+
35+
gh-ost-test-mysql-master -e "alter user 'repl'@'%' identified with 'mysql_native_password' by 'repl';"
36+
gh-ost-test-mysql-master -e "grant replication slave on *.* to 'repl'@'%'; flush privileges;"
37+
gh-ost-test-mysql-master -e "create user if not exists 'gh-ost'@'%' identified by 'gh-ost'"
38+
gh-ost-test-mysql-master -e "grant all on *.* to 'gh-ost'@'%'"
39+
40+
gh-ost-test-mysql-replica -e "flush privileges;"
41+
gh-ost-test-mysql-replica -e "change replication source to source_host='mysql-primary', source_port=3307, source_user='repl', source_password='repl', source_auto_position=1;"
42+
gh-ost-test-mysql-replica -e "start replica;"
4543
}
4644

47-
#setup
45+
setup

0 commit comments

Comments
 (0)