-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug where SQL query in version match check would execute outside …
…of an outer snapshot or portal (#266)
- Loading branch information
1 parent
37a587d
commit 7b66765
Showing
4 changed files
with
81 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
-- This test is to check that Lantern properly handles missing outer snapshots or portals when it is loaded | ||
-- So far, this test checks that Lantern handles cases of initializing parallel workers properly. | ||
-- Specifically, we test that Lantern performs the version match check by only performing its initialization SQL queries when a proper outer snapshot or portal exists. | ||
-- This is to prevent the following error: "ERROR: cannot execute SQL without an outer snapshot or portal" | ||
-- Note: Dropping and loading the extension again is necessary to test the desired missing outer snapshot/portal behavior | ||
DROP EXTENSION lantern; | ||
CREATE EXTENSION lantern; | ||
CREATE TABLE IF NOT EXISTS ourtable ( | ||
id SERIAL, | ||
v REAL[128] | ||
); | ||
\copy ourtable (v) FROM '/tmp/lantern/vector_datasets/siftsmall_base_arrays.csv' with csv; | ||
SET max_parallel_workers_per_gather TO 4; | ||
SET max_parallel_workers TO 8; | ||
--- Make parallel plans more favorable --- | ||
SET min_parallel_table_scan_size TO '8kB'; | ||
SET parallel_setup_cost TO 10; | ||
SET parallel_tuple_cost TO 0.001; | ||
SET seq_page_cost TO 10; | ||
-- This query should have a parallel plan | ||
EXPLAIN (COSTS false) SELECT COUNT(*) FROM ourtable; | ||
QUERY PLAN | ||
------------------------------------------------- | ||
Finalize Aggregate | ||
-> Gather | ||
Workers Planned: 4 | ||
-> Partial Aggregate | ||
-> Parallel Seq Scan on ourtable | ||
(5 rows) | ||
|
||
SELECT COUNT(*) FROM ourtable; | ||
count | ||
------- | ||
10000 | ||
(1 row) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- This test is to check that Lantern properly handles missing outer snapshots or portals when it is loaded | ||
|
||
-- So far, this test checks that Lantern handles cases of initializing parallel workers properly. | ||
-- Specifically, we test that Lantern performs the version match check by only performing its initialization SQL queries when a proper outer snapshot or portal exists. | ||
-- This is to prevent the following error: "ERROR: cannot execute SQL without an outer snapshot or portal" | ||
|
||
-- Note: Dropping and loading the extension again is necessary to test the desired missing outer snapshot/portal behavior | ||
DROP EXTENSION lantern; | ||
CREATE EXTENSION lantern; | ||
|
||
CREATE TABLE IF NOT EXISTS ourtable ( | ||
id SERIAL, | ||
v REAL[128] | ||
); | ||
|
||
\copy ourtable (v) FROM '/tmp/lantern/vector_datasets/siftsmall_base_arrays.csv' with csv; | ||
|
||
SET max_parallel_workers_per_gather TO 4; | ||
SET max_parallel_workers TO 8; | ||
|
||
--- Make parallel plans more favorable --- | ||
SET min_parallel_table_scan_size TO '8kB'; | ||
|
||
SET parallel_setup_cost TO 10; | ||
SET parallel_tuple_cost TO 0.001; | ||
|
||
SET seq_page_cost TO 10; | ||
|
||
-- This query should have a parallel plan | ||
EXPLAIN (COSTS false) SELECT COUNT(*) FROM ourtable; | ||
SELECT COUNT(*) FROM ourtable; | ||
|
||
|