go/libraries/doltcore/sqle: cluster: When a database is dropped, shutdown the replication goroutines and stop returning its status in the dolt_cluster_status table.

This commit is contained in:
Aaron Son
2023-09-20 15:47:46 -07:00
parent 418a78d560
commit 3b0ca8bb21
5 changed files with 103 additions and 2 deletions
@@ -1417,3 +1417,68 @@ tests:
- exec: 'call dolt_gc()'
error_match: "must be the primary"
- exec: 'call dolt_gc("--shallow")'
- name: dropped database no longer in dolt_cluster_status
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: 'SET @@GLOBAL.dolt_cluster_ack_writes_timeout_secs = 10'
- exec: 'create table vals (i int primary key)'
- query: "select `database`, standby_remote, role, epoch, replication_lag_millis is not null as `replication_lag_millis`, current_error from dolt_cluster.dolt_cluster_status"
result:
columns: ["database","standby_remote","role","epoch","replication_lag_millis","current_error"]
rows:
- ["repo1", "standby", "primary", "1", "1", "NULL"]
- exec: 'use dolt_cluster'
- exec: 'drop database repo1'
- query: 'show databases'
result:
columns: ["Database"]
rows:
- ["dolt_cluster"]
- ["information_schema"]
- ["mysql"]
- query: "select `database`, standby_remote, role, epoch, replication_lag_millis is not null as `replication_lag_millis`, current_error from dolt_cluster.dolt_cluster_status"
result:
columns: ["database","standby_remote","role","epoch","replication_lag_millis","current_error"]
rows: []