mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-01-09 06:42:57 +00:00
feat: introduce read preference (#5783)
* feat: introduce read preference * feat: introduce `RegionQueryHandlerFactory` * feat: extract ReadPreference from http header * test: add more tests * chore: apply suggestions from CR * chore: apply suggestions from CR
This commit is contained in:
28
tests/cases/standalone/common/system/read_preference.result
Normal file
28
tests/cases/standalone/common/system/read_preference.result
Normal file
@@ -0,0 +1,28 @@
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
SELECT read_preference();
|
||||
|
||||
+-------------------+
|
||||
| read_preference() |
|
||||
+-------------------+
|
||||
| LEADER |
|
||||
+-------------------+
|
||||
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
SET read_preference = 'hi';
|
||||
|
||||
Failed to execute query, err: MySqlError { ERROR 1235 (42000): (Unsupported): Not supported: Invalid read preference expr hi in set variable statement }
|
||||
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
SET read_preference = 'leader';
|
||||
|
||||
affected_rows: 0
|
||||
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
SELECT read_preference();
|
||||
|
||||
+-------------------+
|
||||
| read_preference() |
|
||||
+-------------------+
|
||||
| LEADER |
|
||||
+-------------------+
|
||||
|
||||
13
tests/cases/standalone/common/system/read_preference.sql
Normal file
13
tests/cases/standalone/common/system/read_preference.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
SELECT read_preference();
|
||||
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
SET read_preference = 'hi';
|
||||
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
SET read_preference = 'leader';
|
||||
|
||||
-- SQLNESS PROTOCOL MYSQL
|
||||
SELECT read_preference();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user