-
Notifications
You must be signed in to change notification settings - Fork 57
Predicate locking in rum index #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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,2 @@ | ||
wal_level = logical | ||
max_replication_slots = 4 |
This file contains hidden or 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,59 @@ | ||
# Test for page level predicate locking in rum | ||
# | ||
# Test to check reduced false positives | ||
# | ||
# Queries are written in such a way that an index scan(from one transaction) and an index insert(from another transaction) will try to access different parts(sub-tree) of the index. | ||
|
||
setup | ||
{ | ||
CREATE EXTENSION rum; | ||
|
||
CREATE TABLE rum_tbl (id serial, tsv tsvector); | ||
|
||
CREATE TABLE text_table (id1 serial, t text[]); | ||
|
||
SELECT SETSEED(0.5); | ||
|
||
INSERT INTO text_table(t) SELECT array[chr(i) || chr(j)] FROM generate_series(65,90) i, | ||
generate_series(65,90) j ; | ||
|
||
INSERT INTO rum_tbl(tsv) SELECT to_tsvector('simple', t[1] ) FROM text_table; | ||
|
||
DO $$ | ||
BEGIN | ||
FOR j in 1..10 LOOP | ||
UPDATE rum_tbl SET tsv = tsv || q.t1 FROM (SELECT id1,to_tsvector('simple', t[1] ) | ||
as t1 FROM text_table) as q WHERE id = (random()*q.id1)::integer; | ||
END LOOP; | ||
END; | ||
$$; | ||
|
||
CREATE INDEX rum_tbl_idx ON rum_tbl USING rum (tsv rum_tsvector_ops); | ||
} | ||
|
||
teardown | ||
{ | ||
DROP TABLE text_table; | ||
DROP TABLE rum_tbl; | ||
DROP EXTENSION rum; | ||
} | ||
|
||
session "s1" | ||
setup { | ||
BEGIN ISOLATION LEVEL SERIALIZABLE; | ||
set enable_seqscan=off; | ||
} | ||
step "rxy1" { SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx'; } | ||
step "wx1" { INSERT INTO rum_tbl(tsv) values('ab'); } | ||
step "c1" { COMMIT; } | ||
|
||
session "s2" | ||
setup { | ||
BEGIN ISOLATION LEVEL SERIALIZABLE; | ||
set enable_seqscan=off; | ||
} | ||
|
||
step "rxy2" { SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh'; } | ||
step "wy2" { INSERT INTO rum_tbl(tsv) values('xz'); } | ||
step "c2" { COMMIT; } | ||
|
This file contains hidden or 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,58 @@ | ||
# Test for page level predicate locking in rum | ||
# | ||
# Test to verify serialization failures | ||
# | ||
# Queries are written in such a way that an index scan(from one transaction) and an index insert(from another transaction) will try to access the same part(sub-tree) of the index. | ||
|
||
setup | ||
{ | ||
CREATE EXTENSION rum; | ||
|
||
CREATE TABLE rum_tbl (id serial, tsv tsvector); | ||
|
||
CREATE TABLE text_table (id1 serial, t text[]); | ||
|
||
SELECT SETSEED(0.5); | ||
|
||
INSERT INTO text_table(t) SELECT array[chr(i) || chr(j)] FROM generate_series(65,90) i, | ||
generate_series(65,90) j ; | ||
|
||
INSERT INTO rum_tbl(tsv) SELECT to_tsvector('simple', t[1] ) FROM text_table; | ||
|
||
DO $$ | ||
BEGIN | ||
FOR j in 1..10 LOOP | ||
UPDATE rum_tbl SET tsv = tsv || q.t1 FROM (SELECT id1,to_tsvector('simple', t[1] ) | ||
as t1 FROM text_table) as q WHERE id = (random()*q.id1)::integer; | ||
END LOOP; | ||
END; | ||
$$; | ||
|
||
CREATE INDEX rum_tbl_idx ON rum_tbl USING rum (tsv rum_tsvector_ops); | ||
} | ||
|
||
teardown | ||
{ | ||
DROP TABLE text_table; | ||
DROP TABLE rum_tbl; | ||
DROP EXTENSION rum; | ||
} | ||
|
||
session "s1" | ||
setup { | ||
BEGIN ISOLATION LEVEL SERIALIZABLE; | ||
set enable_seqscan=off; | ||
} | ||
step "rxy1" { SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'hx'; } | ||
step "wx1" { INSERT INTO rum_tbl(tsv) values('qh'); } | ||
step "c1" { COMMIT; } | ||
|
||
session "s2" | ||
setup { | ||
BEGIN ISOLATION LEVEL SERIALIZABLE; | ||
set enable_seqscan=off; | ||
} | ||
|
||
step "rxy2" { SELECT id, tsv FROM rum_tbl WHERE tsv @@ 'qh'; } | ||
step "wy2" { INSERT INTO rum_tbl(tsv) values('hx'); } | ||
step "c2" { COMMIT; } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove
check
target? This target makes it impossible to runcheck
withUSE_PGXS
variable. With this target you can runcheck
only under thecontrib
directory.To run isolationcheck you can execute the command:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I will make changes.