initialize_writebuf.patch
application/octet-stream
Filename: initialize_writebuf.patch
Type: application/octet-stream
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/access/hash/hash_xlog.c | 1 | 1 |
| src/test/regress/expected/hash_index.out | 13 | 0 |
| src/test/regress/sql/hash_index.sql | 16 | 0 |
diff --git a/src/backend/access/hash/hash_xlog.c b/src/backend/access/hash/hash_xlog.c index 40debf4028..f1e233a817 100644 --- a/src/backend/access/hash/hash_xlog.c +++ b/src/backend/access/hash/hash_xlog.c @@ -632,7 +632,7 @@ hash_xlog_squeeze_page(XLogReaderState *record) XLogRecPtr lsn = record->EndRecPtr; xl_hash_squeeze_page *xldata = (xl_hash_squeeze_page *) XLogRecGetData(record); Buffer bucketbuf = InvalidBuffer; - Buffer writebuf; + Buffer writebuf = InvalidBuffer; Buffer ovflbuf; Buffer prevbuf = InvalidBuffer; Buffer mapbuf; diff --git a/src/test/regress/expected/hash_index.out b/src/test/regress/expected/hash_index.out index 0df348b5dd..416d851644 100644 --- a/src/test/regress/expected/hash_index.out +++ b/src/test/regress/expected/hash_index.out @@ -298,6 +298,19 @@ ROLLBACK; INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 500) as i; CHECKPOINT; VACUUM hash_cleanup_heap; +TRUNCATE hash_cleanup_heap; +-- Insert tuples to both the primary bucket page and overflow pages. +INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 500) as i; +-- Fill overflow pages by "dead" tuples. +BEGIN; +INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 1500) as i; +ROLLBACK; +-- And insert some tuples again. During squeeze operation, these will be moved +-- to another overflow pages. Also, other overflow pages filled by dead tuples +-- would be free'd. +INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 50) as i; +CHECKPOINT; +VACUUM hash_cleanup_heap; -- Clean up. DROP TABLE hash_cleanup_heap; -- Index on temp table. diff --git a/src/test/regress/sql/hash_index.sql b/src/test/regress/sql/hash_index.sql index 943bd0ecf1..94861c296c 100644 --- a/src/test/regress/sql/hash_index.sql +++ b/src/test/regress/sql/hash_index.sql @@ -284,6 +284,22 @@ INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 500) as i; CHECKPOINT; VACUUM hash_cleanup_heap; +TRUNCATE hash_cleanup_heap; + +-- Insert tuples to both the primary bucket page and overflow pages. +INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 500) as i; +-- Fill overflow pages by "dead" tuples. +BEGIN; +INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 1500) as i; +ROLLBACK; +-- And insert some tuples again. During squeeze operation, these will be moved +-- to another overflow pages. Also, other overflow pages filled by dead tuples +-- would be free'd. +INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 50) as i; + +CHECKPOINT; +VACUUM hash_cleanup_heap; + -- Clean up. DROP TABLE hash_cleanup_heap;