Skip to content

Commit

Permalink
Remove footer from test output as pg17 contains Disabled: true|false
Browse files Browse the repository at this point in the history
if enable_seqscan is set to false.
Modify failing tests because of operator rewrite hook to not use <?>
operator.
Modify test output files accordingly.
  • Loading branch information
var77 committed Oct 30, 2024
1 parent 8ab9a61 commit 8cf2c6b
Show file tree
Hide file tree
Showing 29 changed files with 65 additions and 389 deletions.
1 change: 1 addition & 0 deletions lantern_hnsw/src/hnsw/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <assert.h>
#include <catalog/namespace.h>
#include <catalog/pg_proc.h>
#include <catalog/pg_type_d.h>
#include <executor/spi.h>
#include <math.h>
#include <miscadmin.h>
Expand Down
19 changes: 0 additions & 19 deletions lantern_hnsw/test/expected/async_tasks.out
Original file line number Diff line number Diff line change
Expand Up @@ -94,34 +94,29 @@ SELECT lantern.async_task($$SELECT pg_sleep(0.1);$$, 'Lantern job name');
async_task
------------
1
(1 row)

SELECT lantern.async_task($$SELECT pg_sleep(70);$$::text);
async_task
------------
2
(1 row)

-- will fail since the task is not valid SQL
SELECT lantern.async_task($$SELECT pg_sleep(haha);$$, 'Lantern job name');
async_task
------------
3
(1 row)

SELECT jobid, query, pg_cron_job_name, job_name, duration IS NOT NULL AS is_done, status, error_message FROM lantern.tasks;
jobid | query | pg_cron_job_name | job_name | is_done | status | error_message
-------+------------------------+------------------+------------------+---------+--------+---------------
1 | SELECT pg_sleep(0.1); | async_task_1 | Lantern job name | f | |
2 | SELECT pg_sleep(70); | async_task_2 | | f | |
3 | SELECT pg_sleep(haha); | async_task_3 | Lantern job name | f | |
(3 rows)

SELECT pg_sleep(3);
pg_sleep
----------

(1 row)

SELECT jobid, query, pg_cron_job_name, job_name, duration IS NOT NULL AS is_done, status, error_message FROM lantern.tasks;
jobid | query | pg_cron_job_name | job_name | is_done | status | error_message
Expand All @@ -132,13 +127,11 @@ SELECT jobid, query, pg_cron_job_name, job_name, duration IS NOT NULL AS is_done
| | | | | | ^ +
| | | | | |
1 | SELECT pg_sleep(0.1); | async_task_1 | Lantern job name | t | succeeded |
(3 rows)

SELECT lantern.cancel_all_async_tasks();
cancel_all_async_tasks
------------------------

(1 row)

-- test async tasks on index creation
DROP TABLE IF EXISTS small_world;
Expand All @@ -156,29 +149,25 @@ SELECT lantern.async_task($$CREATE INDEX idx ON "sift_base1k_UpperCase" USING la
async_task
------------
4
(1 row)

-- blocks DB deletions that is why it is disabled for now
-- SELECT lantern.async_task($$CREATE INDEX CONCURRENTLY idx_concurrent ON "sift_base1k_UpperCase" USING lantern_hnsw (v) WITH (dim=128, M=6);$$, 'Indexing Job');
SELECT pg_sleep(5);
pg_sleep
----------

(1 row)

SELECT * FROM ldb_get_indexes('sift_base1k_UpperCase');
indexname | size | indexdef | indisvalid
-----------+--------+--------------------------------------------------------------------------------------------+------------
idx | 632 kB | CREATE INDEX idx ON "sift_base1k_UpperCase" USING lantern_hnsw (v) WITH (dim='128', m='6') | t
(1 row)

SELECT _lantern_internal.validate_index('idx', false);
INFO: validate_index() start for idx
INFO: validate_index() done, no issues found.
validate_index
----------------

(1 row)

SELECT jobid, query, pg_cron_job_name, job_name, duration IS NOT NULL AS is_done, status, error_message FROM lantern.tasks;
jobid | query | pg_cron_job_name | job_name | is_done | status | error_message
Expand All @@ -190,7 +179,6 @@ SELECT jobid, query, pg_cron_job_name, job_name, duration IS NOT NULL AS is_done
1 | SELECT pg_sleep(0.1); | async_task_1 | Lantern job name | t | succeeded |
2 | SELECT pg_sleep(70); | async_task_2 | | t | canceled | Canceled by user
4 | CREATE INDEX idx ON "sift_base1k_UpperCase" USING lantern_hnsw (v) WITH (dim=128, M=6); | async_task_4 | Indexing Job | t | succeeded |
(4 rows)

-- NOTE: the test finishes but the async index creation may still be in progress
-- create non superuser and test the function
Expand All @@ -207,14 +195,12 @@ NOTICE: Job scheduled with pg_cron name: 'async_task_5'
async_task
------------
5
(1 row)

SELECT lantern.async_task($$CREATE INDEX idx2 ON "sift_base1k_UpperCase" USING lantern_hnsw (v) WITH (dim=128, M=6);$$, 'Indexing Job');
NOTICE: Job scheduled with pg_cron name: 'async_task_6'
async_task
------------
6
(1 row)

-- this should fail since test_user does not have permission to drop the table
-- sql line for do not stop on error
Expand All @@ -223,28 +209,24 @@ NOTICE: Job scheduled with pg_cron name: 'async_task_7'
async_task
------------
7
(1 row)

-- lantern.tasks jobid is distinct and independent from cron.jobid, even though they may often overlap
-- make sure everything works even when they are out of sync
SELECT nextval('lantern.tasks_jobid_seq');
nextval
---------
8
(1 row)

SELECT lantern.async_task($$SELECT 42$$, 'Life');
NOTICE: Job scheduled with pg_cron name: 'async_task_9'
async_task
------------
9
(1 row)

SELECT pg_sleep(4);
pg_sleep
----------

(1 row)

SELECT jobid, query, pg_cron_job_name, job_name, duration IS NOT NULL AS is_done, status, error_message FROM lantern.tasks ORDER BY jobid;
jobid | query | pg_cron_job_name | job_name | is_done | status | error_message
Expand All @@ -255,5 +237,4 @@ SELECT jobid, query, pg_cron_job_name, job_name, duration IS NOT NULL AS is_done
7 | DROP TABLE "sift_base1k_UpperCase"; | async_task_7 | Dropping Table Job | t | failed | ERROR: must be owner of table sift_base1k_UpperCase+
| | | | | |
9 | SELECT 42 | async_task_9 | Life | t | succeeded |
(4 rows)

7 changes: 0 additions & 7 deletions lantern_hnsw/test/expected/ext_relocation.out
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ ORDER BY 1, 3, 2;
schema1 | ldb_pqvec_send | schema1
schema1 | quantize_table | schema1
schema1 | quantize_vector | schema1
(29 rows)

-- show all the extension operators
SELECT ne.nspname AS extschema, op.oprname, np.nspname AS proschema
Expand All @@ -81,15 +80,13 @@ ORDER BY 1, 3;
schema1 | <-> | schema1
schema1 | <=> | schema1
schema1 | <+> | schema1
(5 rows)

SET search_path TO public, schema1;
-- extension function is accessible
SELECT l2sq_dist(ARRAY[1.0, 2.0, 3.0], ARRAY[4.0, 5.0, 6.0]);
l2sq_dist
-----------
27
(1 row)

CREATE INDEX hnsw_index ON small_world USING lantern_hnsw(v) WITH (dim=3);
INFO: done init usearch index
Expand All @@ -101,7 +98,6 @@ INFO: validate_index() done, no issues found.
validate_index
----------------

(1 row)

\set ON_ERROR_STOP off
-- lantern does not support relocation.
Expand All @@ -127,7 +123,6 @@ ORDER BY 1, 3;
schema1 | <-> | schema1
schema1 | <=> | schema1
schema1 | <+> | schema1
(5 rows)

SET search_path TO public, schema2;
--extension access method is still accessible since access methods are not schema-qualified
Expand All @@ -141,7 +136,6 @@ INFO: validate_index() done, no issues found.
validate_index
----------------

(1 row)

\set ON_ERROR_STOP off
-- extension function cannot be found without schema-qualification
Expand All @@ -152,5 +146,4 @@ SELECT schema1.l2sq_dist(ARRAY[1.0, 2.0, 3.0], ARRAY[4.0, 5.0, 6.0]);
l2sq_dist
-----------
27
(1 row)

6 changes: 0 additions & 6 deletions lantern_hnsw/test/expected/hnsw_concurrent.out
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ SELECT id, ROUND((v <-> :'v444')::numeric, 2) FROM sift_base1k ORDER BY v <-> :'
557 | 91664.00
62 | 93497.00
58 | 93637.00
(6 rows)

CREATE INDEX to_be_reindexed ON sift_base1k USING lantern_hnsw (v) WITH (dim=128, M=8);
INFO: done init usearch index
Expand All @@ -25,15 +24,13 @@ SELECT * FROM ldb_get_indexes('sift_base1k');
indexname | size | indexdef | indisvalid
-----------------+--------+--------------------------------------------------------------------------------------------+------------
to_be_reindexed | 680 kB | CREATE INDEX to_be_reindexed ON sift_base1k USING lantern_hnsw (v) WITH (dim='128', m='8') | t
(1 row)

SELECT _lantern_internal.validate_index('to_be_reindexed', false);
INFO: validate_index() start for to_be_reindexed
INFO: validate_index() done, no issues found.
validate_index
----------------

(1 row)

REINDEX INDEX CONCURRENTLY to_be_reindexed;
INFO: done init usearch index
Expand All @@ -46,13 +43,11 @@ INFO: validate_index() done, no issues found.
validate_index
----------------

(1 row)

SELECT * FROM ldb_get_indexes('sift_base1k');
indexname | size | indexdef | indisvalid
-----------------+--------+--------------------------------------------------------------------------------------------+------------
to_be_reindexed | 680 kB | CREATE INDEX to_be_reindexed ON sift_base1k USING lantern_hnsw (v) WITH (dim='128', m='8') | t
(1 row)

set enable_seqscan=FALSE;
-- 6 closest vectors to the vector with ID 444. note all the duplicate results because of bad handling of REINDEX
Expand All @@ -65,5 +60,4 @@ SELECT id, ROUND((v <-> :'v444')::numeric, 2) FROM sift_base1k ORDER BY v <-> :'
557 | 91664.00
62 | 93497.00
58 | 93637.00
(6 rows)

5 changes: 0 additions & 5 deletions lantern_hnsw/test/expected/hnsw_config.out
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,26 @@ SELECT * FROM ldb_get_indexes('small_world');
indexname | size | indexdef | indisvalid
-------------------+-------+-------------------------------------------------------------------------------------+------------
small_world_v_idx | 16 kB | CREATE INDEX small_world_v_idx ON small_world USING lantern_hnsw (v) WITH (dim='3') | t
(1 row)

-- Verify that lantern_hnsw.init_k exists after index creation
SHOW lantern_hnsw.init_k;
lantern_hnsw.init_k
---------------------
10
(1 row)

-- Modify lantern_hnsw.init_k and verify that it was modified
SET lantern_hnsw.init_k = 45;
SHOW lantern_hnsw.init_k;
lantern_hnsw.init_k
---------------------
45
(1 row)

-- Reset all parameters and verify that lantern_hnsw.init_k was reset
RESET ALL;
SHOW lantern_hnsw.init_k;
lantern_hnsw.init_k
---------------------
10
(1 row)

-- Validate the index data structures
SELECT _lantern_internal.validate_index('small_world_v_idx', false);
Expand All @@ -59,5 +55,4 @@ INFO: validate_index() done, no issues found.
validate_index
----------------

(1 row)

2 changes: 0 additions & 2 deletions lantern_hnsw/test/expected/hnsw_correct.out
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ WHERE
a.id != b.id;
row_num | id_with_index | id_without_index | dist_with_index | dist_without_index
---------+---------------+------------------+-----------------+--------------------
(0 rows)

-- Validate the index data structures
SELECT _lantern_internal.validate_index('small_world_v_idx', false);
Expand All @@ -55,5 +54,4 @@ INFO: validate_index() done, no issues found.
validate_index
----------------

(1 row)

Loading

0 comments on commit 8cf2c6b

Please sign in to comment.