From a65283a492fe966b4af5b07caf0956e8dbf94204 Mon Sep 17 00:00:00 2001 From: earayu Date: Tue, 22 Aug 2023 16:39:14 +0800 Subject: [PATCH] feat: add docs for read-after-write-consistency --- .../04-Read-After-Write-Consistency.md | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 doc/toturial/04-Read-After-Write-Consistency.md diff --git a/doc/toturial/04-Read-After-Write-Consistency.md b/doc/toturial/04-Read-After-Write-Consistency.md new file mode 100644 index 0000000000..41e68abe79 --- /dev/null +++ b/doc/toturial/04-Read-After-Write-Consistency.md @@ -0,0 +1,35 @@ +# + +The goal of this tutorial is to explain how to enable the Read-After-Write-Consistency feature in WeSQL-Scale, in order to ensure that after enabling read-write separation, stale data will not be read. + +# Setting through the set command. + +If you have already set up a cluster and want to enable Read-After-Write-Consistency, the simplest way is using the MySQL "set" command: + +``` +# session +set session read_after_write_consistency='SESSION' + +# global +set global read_after_write_consistency='SESSION' + +``` + +Currently, WeSQL-Scale supports these consistency levels: + +| EVENTUAL | No guarantee of consistency. | +| --- | --- | +| SESSION | Within the same connection, ensure that subsequent read requests can read previous write operations. (recommend) | +| INSTANCE | Within the same instance (VTGate), ensure that subsequent read requests can read previous write operations, even if the read and write requests are not initiated by the same connection. | +| GLOBAL | Within the same WeSQL-Scale cluster, ensure that any read request can read previous write operations. | + +# Setting via launch parameters + +If you need to set the default value of read_write_splitting_policy, you can pass it as a startup parameter for the vtgate process: +```bash +vtgate \ + # enable read-write-splitting and load balancing + --read_after_write_consistency session + # other necessary command line options + ... +``` \ No newline at end of file