-
-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6607 from dolthub/aaron/dolt-clustering-standby-i…
…s-read-only sqle: cluster: Set the engine to read-only when a replica is in standby mode. Set it back to read-write when it becomes primary.
- Loading branch information
Showing
7 changed files
with
233 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
204 changes: 204 additions & 0 deletions
204
integration-tests/go-sql-server-driver/tests/sql-server-cluster-read-only.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
tests: | ||
- name: users and grants cannot be run on standby | ||
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: server2 | ||
queries: | ||
- exec: 'CREATE USER "brian"@"%" IDENTIFIED BY "brianspassword"' | ||
error_match: 'database server is set to read only mode' | ||
- exec: 'GRANT ALL ON *.* TO "aaron"@"%"' | ||
error_match: 'database server is set to read only mode' | ||
- name: create database cannot be run on standby | ||
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: server2 | ||
queries: | ||
- exec: 'CREATE DATABASE my_db' | ||
error_match: 'database server is set to read only mode' | ||
- name: drop database cannot be run on standby | ||
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: 'SET @@PERSIST.dolt_cluster_ack_writes_timeout_secs = 10' | ||
- 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)' | ||
- on: server2 | ||
queries: | ||
- exec: 'DROP DATABASE repo1' | ||
error_match: 'database server is set to read only mode' | ||
- name: when a server becomes primary it accepts 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: server2 | ||
queries: | ||
- exec: 'CALL DOLT_ASSUME_CLUSTER_ROLE("primary", 2)' | ||
- on: server2 | ||
queries: | ||
- exec: 'SET @@PERSIST.dolt_cluster_ack_writes_timeout_secs = 10' | ||
- 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)' | ||
- on: server1 | ||
queries: | ||
- exec: 'USE repo1' | ||
- query: 'SELECT COUNT(*) FROM vals' | ||
result: | ||
columns: ["COUNT(*)"] | ||
rows: | ||
- [5] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters