mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-05 11:21:58 -05:00
integration-tests/go-sql-server-driver: Finish transitioning the rest of the sql-server-cluster tests.
This commit is contained in:
@@ -129,7 +129,7 @@ tests:
|
||||
rows: [["0"]]
|
||||
# Connection should be broken now.
|
||||
- query: "select 2 from dual"
|
||||
error_match: "this connection no longer be used"
|
||||
error_match: "this connection can no longer be used"
|
||||
- on: server1
|
||||
queries:
|
||||
- query: "select @@GLOBAL.dolt_cluster_role, @@GLOBAL.dolt_cluster_role_epoch"
|
||||
@@ -570,3 +570,374 @@ tests:
|
||||
- exec: "use repo1"
|
||||
- exec: "create table more_vals (i int primary key)"
|
||||
error_match: "repo1 is read-only"
|
||||
- name: an older primary comes up, becomes a standby and does not overwrite newer primary
|
||||
multi_repos:
|
||||
- name: server1
|
||||
repos:
|
||||
- name: repo1
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50052/repo1
|
||||
- name: repo2
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50052/repo2
|
||||
with_files:
|
||||
- name: preserver.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3309
|
||||
- name: server.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3309
|
||||
cluster:
|
||||
standby_remotes:
|
||||
- name: standby
|
||||
remote_url_template: http://localhost:50052/{database}
|
||||
bootstrap_role: primary
|
||||
bootstrap_epoch: 15
|
||||
remotesapi:
|
||||
port: 50051
|
||||
server:
|
||||
args: ["--config", "preserver.yaml"]
|
||||
port: 3309
|
||||
- name: server2
|
||||
repos:
|
||||
- name: repo1
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50051/repo1
|
||||
- name: repo2
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50051/repo2
|
||||
with_files:
|
||||
- name: preserver.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3310
|
||||
- name: server.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3310
|
||||
cluster:
|
||||
standby_remotes:
|
||||
- name: standby
|
||||
remote_url_template: http://localhost:50051/{database}
|
||||
bootstrap_role: primary
|
||||
bootstrap_epoch: 10
|
||||
remotesapi:
|
||||
port: 50052
|
||||
server:
|
||||
args: ["--config", "preserver.yaml"]
|
||||
port: 3310
|
||||
connections:
|
||||
- on: server1
|
||||
queries:
|
||||
- exec: 'use repo1'
|
||||
- exec: 'create table vals (i int primary key)'
|
||||
- exec: 'insert into vals values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)'
|
||||
- on: server2
|
||||
queries:
|
||||
- exec: 'use repo1'
|
||||
- exec: 'create table vals (i int primary key)'
|
||||
- exec: 'insert into vals values (1),(2),(3),(4),(5)'
|
||||
- on: server1
|
||||
restart_server:
|
||||
args: ["--config", "server.yaml"]
|
||||
- on: server1
|
||||
- on: server2
|
||||
restart_server:
|
||||
args: ["--config", "server.yaml"]
|
||||
- on: server1
|
||||
queries:
|
||||
- query: "select `database`, standby_remote, role, epoch, replication_lag_millis, current_error from dolt_cluster.dolt_cluster_status order by `database` asc"
|
||||
result:
|
||||
columns: ["database","standby_remote","role","epoch","replication_lag_millis","current_error"]
|
||||
rows:
|
||||
- ["repo1","standby","primary","15","0","NULL"]
|
||||
- ["repo2","standby","primary","15","0","NULL"]
|
||||
retry_attempts: 100
|
||||
- query: "SELECT count(*) FROM repo1.vals"
|
||||
result:
|
||||
columns: ["count(*)"]
|
||||
rows: [["10"]]
|
||||
- on: server2
|
||||
queries:
|
||||
- query: "SELECT @@GLOBAL.dolt_cluster_role,@@GLOBAL.dolt_cluster_role_epoch"
|
||||
result:
|
||||
columns: ["@@GLOBAL.dolt_cluster_role", "@@GLOBAL.dolt_cluster_role_epoch"]
|
||||
rows: [["standby", "15"]]
|
||||
- query: "SELECT count(*) FROM repo1.vals"
|
||||
result:
|
||||
columns: ["count(*)"]
|
||||
rows: [["10"]]
|
||||
- name: a newer primary comes up, old primary becomes a standby has its state overwritten
|
||||
multi_repos:
|
||||
- name: server1
|
||||
repos:
|
||||
- name: repo1
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50052/repo1
|
||||
- name: repo2
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50052/repo2
|
||||
with_files:
|
||||
- name: preserver.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3309
|
||||
- name: server.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3309
|
||||
cluster:
|
||||
standby_remotes:
|
||||
- name: standby
|
||||
remote_url_template: http://localhost:50052/{database}
|
||||
bootstrap_role: primary
|
||||
bootstrap_epoch: 10
|
||||
remotesapi:
|
||||
port: 50051
|
||||
server:
|
||||
args: ["--config", "preserver.yaml"]
|
||||
port: 3309
|
||||
- name: server2
|
||||
repos:
|
||||
- name: repo1
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50051/repo1
|
||||
- name: repo2
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50051/repo2
|
||||
with_files:
|
||||
- name: preserver.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3310
|
||||
- name: server.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3310
|
||||
cluster:
|
||||
standby_remotes:
|
||||
- name: standby
|
||||
remote_url_template: http://localhost:50051/{database}
|
||||
bootstrap_role: primary
|
||||
bootstrap_epoch: 15
|
||||
remotesapi:
|
||||
port: 50052
|
||||
server:
|
||||
args: ["--config", "preserver.yaml"]
|
||||
port: 3310
|
||||
connections:
|
||||
- on: server1
|
||||
queries:
|
||||
- exec: 'use repo1'
|
||||
- exec: 'create table vals (i int primary key)'
|
||||
- exec: 'insert into vals values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10)'
|
||||
- on: server2
|
||||
queries:
|
||||
- exec: 'use repo1'
|
||||
- exec: 'create table vals (i int primary key)'
|
||||
- exec: 'insert into vals values (1),(2),(3),(4),(5)'
|
||||
- on: server1
|
||||
restart_server:
|
||||
args: ["--config", "server.yaml"]
|
||||
- on: server1
|
||||
queries:
|
||||
- query: "SELECT count(*) FROM repo1.vals"
|
||||
result:
|
||||
columns: ["count(*)"]
|
||||
rows: [["10"]]
|
||||
- on: server2
|
||||
restart_server:
|
||||
args: ["--config", "server.yaml"]
|
||||
- on: server2
|
||||
queries:
|
||||
- query: "select `database`, standby_remote, role, epoch, replication_lag_millis, current_error from dolt_cluster.dolt_cluster_status order by `database` asc"
|
||||
result:
|
||||
columns: ["database","standby_remote","role","epoch","replication_lag_millis","current_error"]
|
||||
rows:
|
||||
- ["repo1","standby","primary","15","0","NULL"]
|
||||
- ["repo2","standby","primary","15","0","NULL"]
|
||||
retry_attempts: 100
|
||||
- query: "SELECT count(*) FROM repo1.vals"
|
||||
result:
|
||||
columns: ["count(*)"]
|
||||
rows: [["5"]]
|
||||
- on: server1
|
||||
queries:
|
||||
- query: "SELECT @@GLOBAL.dolt_cluster_role,@@GLOBAL.dolt_cluster_role_epoch"
|
||||
result:
|
||||
columns: ["@@GLOBAL.dolt_cluster_role", "@@GLOBAL.dolt_cluster_role_epoch"]
|
||||
rows: [["standby", "15"]]
|
||||
- query: "SELECT count(*) FROM repo1.vals"
|
||||
result:
|
||||
columns: ["count(*)"]
|
||||
rows: [["5"]]
|
||||
- name: graceful primary to standby transition without the standby up fails
|
||||
multi_repos:
|
||||
- name: server1
|
||||
repos:
|
||||
- name: repo1
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50052/repo1
|
||||
- name: repo2
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50052/repo2
|
||||
with_files:
|
||||
- name: server.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3309
|
||||
cluster:
|
||||
standby_remotes:
|
||||
- name: standby
|
||||
remote_url_template: http://localhost:50052/{database}
|
||||
bootstrap_role: primary
|
||||
bootstrap_epoch: 10
|
||||
remotesapi:
|
||||
port: 50051
|
||||
server:
|
||||
args: ["--config", "server.yaml"]
|
||||
port: 3309
|
||||
connections:
|
||||
- on: server1
|
||||
queries:
|
||||
- exec: "use repo1"
|
||||
- query: "call dolt_assume_cluster_role('standby', '11')"
|
||||
error_match: failed to transition from primary to standby gracefully
|
||||
- exec: "create table vals (i int primary key)"
|
||||
- exec: "insert into vals values (0)"
|
||||
- name: primary replicates to standby, fails over, new primary replicates to standby, fails over, new primary has all writes
|
||||
multi_repos:
|
||||
- name: server1
|
||||
repos:
|
||||
- name: repo1
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50052/repo1
|
||||
- name: repo2
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50052/repo2
|
||||
with_files:
|
||||
- name: server.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3309
|
||||
cluster:
|
||||
standby_remotes:
|
||||
- name: standby
|
||||
remote_url_template: http://localhost:50052/{database}
|
||||
bootstrap_role: primary
|
||||
bootstrap_epoch: 1
|
||||
remotesapi:
|
||||
port: 50051
|
||||
server:
|
||||
args: ["--config", "server.yaml"]
|
||||
port: 3309
|
||||
- name: server2
|
||||
repos:
|
||||
- name: repo1
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50051/repo1
|
||||
- name: repo2
|
||||
with_remotes:
|
||||
- name: standby
|
||||
url: http://localhost:50051/repo2
|
||||
with_files:
|
||||
- name: server.yaml
|
||||
contents: |
|
||||
log_level: trace
|
||||
listener:
|
||||
host: 0.0.0.0
|
||||
port: 3310
|
||||
cluster:
|
||||
standby_remotes:
|
||||
- name: standby
|
||||
remote_url_template: http://localhost:50051/{database}
|
||||
bootstrap_role: standby
|
||||
bootstrap_epoch: 1
|
||||
remotesapi:
|
||||
port: 50052
|
||||
server:
|
||||
args: ["--config", "server.yaml"]
|
||||
port: 3310
|
||||
connections:
|
||||
- on: server1
|
||||
queries:
|
||||
- exec: 'use repo1'
|
||||
- exec: 'create table vals (i int primary key)'
|
||||
- exec: 'insert into vals values (0),(1),(2),(3),(4)'
|
||||
- query: "call dolt_assume_cluster_role('standby', 2)"
|
||||
result:
|
||||
columns: ["status"]
|
||||
rows: [["0"]]
|
||||
- on: server2
|
||||
queries:
|
||||
- exec: 'use repo1'
|
||||
- query: "select count(*) from vals"
|
||||
result:
|
||||
columns: ["count(*)"]
|
||||
rows: [["5"]]
|
||||
- query: "call dolt_assume_cluster_role('primary', 2)"
|
||||
result:
|
||||
columns: ["status"]
|
||||
rows: [["0"]]
|
||||
- on: server2
|
||||
queries:
|
||||
- exec: 'use repo1'
|
||||
- exec: 'insert into vals values (5),(6),(7),(8),(9)'
|
||||
- query: "call dolt_assume_cluster_role('standby', 3)"
|
||||
result:
|
||||
columns: ["status"]
|
||||
rows: [["0"]]
|
||||
- on: server1
|
||||
queries:
|
||||
- exec: 'use repo1'
|
||||
- query: "select count(*) from vals"
|
||||
result:
|
||||
columns: ["count(*)"]
|
||||
rows: [["10"]]
|
||||
- query: "call dolt_assume_cluster_role('primary', 3)"
|
||||
result:
|
||||
columns: ["status"]
|
||||
rows: [["0"]]
|
||||
- on: server1
|
||||
queries:
|
||||
- exec: 'use repo1'
|
||||
- exec: 'insert into vals values (10),(11),(12),(13),(14)'
|
||||
- query: "select count(*) from vals"
|
||||
result:
|
||||
columns: ["count(*)"]
|
||||
rows: [["15"]]
|
||||
|
||||
Reference in New Issue
Block a user