Skip to content

Commit

Permalink
Add switch dataspace in schedule (#392)
Browse files Browse the repository at this point in the history
* Add switch dataspace in schedule

* fix switch_dataspace test
  • Loading branch information
CBists authored Jan 12, 2024
1 parent 539dd24 commit 6443c60
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions test/regress/schedule/router
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ test: multishard
test: error
test: routing_hint
test: begin
test: switch_dataspace
4 changes: 2 additions & 2 deletions test/regress/tests/router/expected/switch_dataspace.out
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ ADD KEY RANGE krid3 FROM 11 TO 31 ROUTE TO sh2 FOR DATASPACE ds2;
(1 row)

\c regress
SET __spqr__DATASPACE = ds1;
SET __spqr__dataspace = ds1;
CREATE TABLE xx (w_id int);
NOTICE: send query to shard(s) : sh1,sh2
INSERT INTO xx(w_id) VALUES(5);
Expand All @@ -68,6 +68,6 @@ NOTICE: send query to shard(s) : sh1
5
(1 row)

SET __spqr__DATASPACE = ds2;
SET __spqr__dataspace = ds2;
SELECT * FROM xx WHERE w_id=5;
ERROR: client proccessing error: error processing query 'SELECT * FROM xx WHERE w_id=5;': failed to match key with ranges, tx status IDLE
4 changes: 2 additions & 2 deletions test/regress/tests/router/sql/switch_dataspace.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ADD KEY RANGE krid3 FROM 11 TO 31 ROUTE TO sh2 FOR DATASPACE ds2;

\c regress

SET __spqr__DATASPACE = ds1;
SET __spqr__dataspace = ds1;

CREATE TABLE xx (w_id int);

Expand All @@ -24,6 +24,6 @@ INSERT INTO xx(w_id) VALUES(20);

SELECT * FROM xx WHERE w_id=5;

SET __spqr__DATASPACE = ds2;
SET __spqr__dataspace = ds2;

SELECT * FROM xx WHERE w_id=5;

0 comments on commit 6443c60

Please sign in to comment.