mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-29 03:08:47 -06:00
go/libraries/doltcore/sqle/cluster: Add JWT authentication for peer communication to cluster replicas.
928 lines
26 KiB
YAML
928 lines
26 KiB
YAML
tests:
|
|
- name: persisted role and epoch take precedence over bootstrap values
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo2
|
|
with_files:
|
|
- name: standby_server.yaml
|
|
contents: |
|
|
log_level: trace
|
|
listener:
|
|
host: 0.0.0.0
|
|
port: 3309
|
|
cluster:
|
|
standby_remotes:
|
|
- name: standby
|
|
remote_url_template: http://localhost:3852/{database}
|
|
bootstrap_role: standby
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
- name: primary_server.yaml
|
|
contents: |
|
|
log_level: trace
|
|
listener:
|
|
host: 0.0.0.0
|
|
port: 3309
|
|
cluster:
|
|
standby_remotes:
|
|
- name: standby
|
|
remote_url_template: http://localhost:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 15
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "standby_server.yaml"]
|
|
port: 3309
|
|
connections:
|
|
- on: server1
|
|
queries:
|
|
- exec: "use dolt_cluster"
|
|
- query: "select @@GLOBAL.dolt_cluster_role, @@GLOBAL.dolt_cluster_role_epoch"
|
|
result:
|
|
columns: ["@@GLOBAL.dolt_cluster_role","@@GLOBAL.dolt_cluster_role_epoch"]
|
|
rows: [["standby","10"]]
|
|
- query: |
|
|
select `database`, standby_remote, role, epoch from dolt_cluster_status order by `database` asc
|
|
result:
|
|
columns: ["database","standby_remote","role","epoch"]
|
|
rows:
|
|
- ["repo1","standby","standby","10"]
|
|
- ["repo2","standby","standby","10"]
|
|
restart_server:
|
|
args: ["--config", "primary_server.yaml"]
|
|
- on: server1
|
|
queries:
|
|
- exec: "use dolt_cluster"
|
|
- query: "select @@GLOBAL.dolt_cluster_role, @@GLOBAL.dolt_cluster_role_epoch"
|
|
result:
|
|
columns: ["@@GLOBAL.dolt_cluster_role","@@GLOBAL.dolt_cluster_role_epoch"]
|
|
rows: [["standby","10"]]
|
|
- name: dolt_assume_cluster_role
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/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:3852/{database}
|
|
bootstrap_role: standby
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "server.yaml"]
|
|
port: 3309
|
|
connections:
|
|
- on: server1
|
|
queries:
|
|
- exec: "use repo1"
|
|
- query: "call dolt_assume_cluster_role('standby', '9')"
|
|
error_match: "error assuming role"
|
|
- query: "call dolt_assume_cluster_role('primary', '10')"
|
|
error_match: "error assuming role"
|
|
- query: "call dolt_assume_cluster_role('backup', '11')"
|
|
error_match: "error assuming role"
|
|
- query: "call dolt_assume_cluster_role('standby', '10')"
|
|
result:
|
|
columns: ["status"]
|
|
rows: [["0"]]
|
|
- query: "select @@GLOBAL.dolt_cluster_role, @@GLOBAL.dolt_cluster_role_epoch"
|
|
result:
|
|
columns: ["@@GLOBAL.dolt_cluster_role","@@GLOBAL.dolt_cluster_role_epoch"]
|
|
rows: [["standby","10"]]
|
|
- query: "call dolt_assume_cluster_role('standby', '12')"
|
|
result:
|
|
columns: ["status"]
|
|
rows: [["0"]]
|
|
- query: "select @@GLOBAL.dolt_cluster_role, @@GLOBAL.dolt_cluster_role_epoch"
|
|
result:
|
|
columns: ["@@GLOBAL.dolt_cluster_role","@@GLOBAL.dolt_cluster_role_epoch"]
|
|
rows: [["standby","12"]]
|
|
- query: "call dolt_assume_cluster_role('primary', '13')"
|
|
result:
|
|
columns: ["status"]
|
|
rows: [["0"]]
|
|
# Connection should be broken now.
|
|
- query: "select 2 from dual"
|
|
error_match: "this connection can no longer be used"
|
|
- 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: [["primary","13"]]
|
|
restart_server: {}
|
|
# Assert that it comes back up with newly assumed role.
|
|
- 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: [["primary","13"]]
|
|
- name: create database makes a new remote
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "server.yaml"]
|
|
port: 3309
|
|
connections:
|
|
- on: server1
|
|
queries:
|
|
- exec: "create database a_new_database"
|
|
- exec: "use a_new_database"
|
|
- query: "select name, url from dolt_remotes"
|
|
result:
|
|
columns: ["name","url"]
|
|
rows: [["standby","http://localhost:3852/a_new_database"]]
|
|
- name: fails to start if a configured remote is missing
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "server.yaml"]
|
|
port: 3309
|
|
error_matches:
|
|
- destination remote standby does not exist
|
|
- name: primary comes up and replicates to standby
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--port", "3309"]
|
|
port: 3309
|
|
- name: server2
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/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:3851/{database}
|
|
bootstrap_role: standby
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3852
|
|
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 (1),(2),(3),(4),(5)"
|
|
restart_server:
|
|
args: ["--config", "server.yaml"]
|
|
- on: server1
|
|
queries:
|
|
- exec: "use dolt_cluster"
|
|
- query: "select `database`, standby_remote, role, epoch, replication_lag_millis, current_error from dolt_cluster_status order by `database` asc"
|
|
result:
|
|
columns: ["database","standby_remote","role","epoch","replication_lag_millis","current_error"]
|
|
rows:
|
|
- ["repo1","standby","primary","10","0","NULL"]
|
|
- ["repo2","standby","primary","10","0","NULL"]
|
|
retry_attempts: 100
|
|
- on: server2
|
|
queries:
|
|
- exec: "use repo1"
|
|
- query: "select count(*) from vals"
|
|
result:
|
|
columns: ["count(*)"]
|
|
rows: [["5"]]
|
|
- name: booted standby server is read only
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo2
|
|
with_files:
|
|
- name: standby_server.yaml
|
|
contents: |
|
|
log_level: trace
|
|
listener:
|
|
host: 0.0.0.0
|
|
port: 3309
|
|
cluster:
|
|
standby_remotes:
|
|
- name: standby
|
|
remote_url_template: http://localhost:3852/{database}
|
|
bootstrap_role: standby
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "standby_server.yaml"]
|
|
port: 3309
|
|
connections:
|
|
- on: server1
|
|
queries:
|
|
- exec: "use repo1"
|
|
- exec: "create table vals (i int primary key)"
|
|
error_match: "repo1 is read-only"
|
|
- name: booted primary server is read write
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "server.yaml"]
|
|
port: 3309
|
|
connections:
|
|
- on: server1
|
|
queries:
|
|
- exec: "use repo1"
|
|
- exec: "create table vals (i int primary key)"
|
|
- name: standby transitioned to primary becomes read write
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo2
|
|
with_files:
|
|
- name: standby_server.yaml
|
|
contents: |
|
|
log_level: trace
|
|
listener:
|
|
host: 0.0.0.0
|
|
port: 3309
|
|
cluster:
|
|
standby_remotes:
|
|
- name: standby
|
|
remote_url_template: http://localhost:3852/{database}
|
|
bootstrap_role: standby
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "standby_server.yaml"]
|
|
port: 3309
|
|
connections:
|
|
- on: server1
|
|
queries:
|
|
- exec: "use repo1"
|
|
- exec: "create table vals (i int primary key)"
|
|
error_match: "repo1 is read-only"
|
|
- query: "call dolt_assume_cluster_role('primary', 11)"
|
|
result:
|
|
columns: ["status"]
|
|
rows: [["0"]]
|
|
- on: server1
|
|
queries:
|
|
- exec: "use repo1"
|
|
- exec: "create table vals (i int primary key)"
|
|
- query: "select count(*) from vals"
|
|
result:
|
|
columns: ["count(*)"]
|
|
rows: [["0"]]
|
|
- name: primary transitioned to standby becomes read only
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "server.yaml"]
|
|
port: 3309
|
|
- name: server2
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/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:3851/{database}
|
|
bootstrap_role: standby
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3852
|
|
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 (1),(2),(3),(4),(5)"
|
|
- query: "call dolt_assume_cluster_role('standby', 11)"
|
|
result:
|
|
columns: ["status"]
|
|
rows: [["0"]]
|
|
- on: server1
|
|
queries:
|
|
- exec: "use repo1"
|
|
- exec: "insert into vals values (6),(7),(8),(9),(10)"
|
|
error_match: "repo1 is read-only"
|
|
- query: "select count(*) from vals"
|
|
result:
|
|
columns: ["count(*)"]
|
|
rows: [["5"]]
|
|
- name: misconfigured cluster with primaries at same epoch, both transition to detected_broken_config
|
|
multi_repos:
|
|
- name: server1
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "server.yaml"]
|
|
port: 3309
|
|
- name: server2
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/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:3851/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3852
|
|
server:
|
|
args: ["--config", "server.yaml"]
|
|
port: 3310
|
|
connections:
|
|
- on: server1
|
|
retry_attempts: 100
|
|
queries:
|
|
- query: "SELECT @@GLOBAL.dolt_cluster_role,@@GLOBAL.dolt_cluster_role_epoch"
|
|
result:
|
|
columns: ["@@GLOBAL.dolt_cluster_role", "@@GLOBAL.dolt_cluster_role_epoch"]
|
|
rows: [["detected_broken_config", "10"]]
|
|
- exec: "use repo1"
|
|
- exec: "create table more_vals (i int primary key)"
|
|
error_match: "repo1 is read-only"
|
|
- on: server2
|
|
retry_attempts: 100
|
|
queries:
|
|
- query: "SELECT @@GLOBAL.dolt_cluster_role,@@GLOBAL.dolt_cluster_role_epoch"
|
|
result:
|
|
columns: ["@@GLOBAL.dolt_cluster_role", "@@GLOBAL.dolt_cluster_role_epoch"]
|
|
rows: [["detected_broken_config", "10"]]
|
|
- 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:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 15
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "preserver.yaml"]
|
|
port: 3309
|
|
- name: server2
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/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:3851/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3852
|
|
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:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "preserver.yaml"]
|
|
port: 3309
|
|
- name: server2
|
|
repos:
|
|
- name: repo1
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3851/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:3851/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 15
|
|
remotesapi:
|
|
port: 3852
|
|
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:3852/repo1
|
|
- name: repo2
|
|
with_remotes:
|
|
- name: standby
|
|
url: http://localhost:3852/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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 10
|
|
remotesapi:
|
|
port: 3851
|
|
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: create new database, primary replicates to standby, fails over, new primary replicates to standby, fails over, new primary has all writes
|
|
multi_repos:
|
|
- name: server1
|
|
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:3852/{database}
|
|
bootstrap_role: primary
|
|
bootstrap_epoch: 1
|
|
remotesapi:
|
|
port: 3851
|
|
server:
|
|
args: ["--config", "server.yaml"]
|
|
port: 3309
|
|
- name: server2
|
|
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:3851/{database}
|
|
bootstrap_role: standby
|
|
bootstrap_epoch: 1
|
|
remotesapi:
|
|
port: 3852
|
|
server:
|
|
args: ["--config", "server.yaml"]
|
|
port: 3310
|
|
connections:
|
|
- on: server1
|
|
queries:
|
|
- exec: 'create database repo1'
|
|
- 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"]]
|