mirror of
https://github.com/neondatabase/neon.git
synced 2025-12-26 15:49:58 +00:00
Merge batch_others and batch_pg_regress. The original idea was to split all the python tests into multiple "batches" and run each batch in parallel as a separate CI job. However, the batch_pg_regress batch was pretty short compared to all the tests in batch_others. We could split batch_others into multiple batches, but it actually seems better to just treat them as one big pool of tests and use pytest's handle the parallelism on its own. If we need to split them across multiple nodes in the future, we could use pytest-shard or something else, instead of managing the batches ourselves. Merge test_neon_regress.py, test_pg_regress.py and test_isolation.py into one file, test_pg_regress.py. Seems more clear to group all pg_regress-based tests into one file, now that they would all be in the same directory.
47 lines
1.5 KiB
SQL
47 lines
1.5 KiB
SQL
--
|
|
-- Test that when a relation is truncated by VACUUM, the next smgrnblocks()
|
|
-- query to get the relation's size returns the new size.
|
|
-- (This isn't related to the TRUNCATE command, which works differently,
|
|
-- by creating a new relation file)
|
|
--
|
|
CREATE TABLE truncatetest (i int);
|
|
INSERT INTO truncatetest SELECT g FROM generate_series(1, 10000) g;
|
|
|
|
-- Remove all the rows, and run VACUUM to remove the dead tuples and
|
|
-- truncate the physical relation to 0 blocks.
|
|
DELETE FROM truncatetest;
|
|
VACUUM truncatetest;
|
|
|
|
-- Check that a SeqScan sees correct relation size (which is now 0)
|
|
SELECT * FROM truncatetest;
|
|
|
|
DROP TABLE truncatetest;
|
|
|
|
|
|
--
|
|
-- Test that the FSM is truncated along with the table.
|
|
--
|
|
|
|
-- Create a test table and delete and vacuum away most of the rows.
|
|
-- This leaves the FSM full of pages with plenty of space
|
|
create table tt(i int);
|
|
insert into tt select g from generate_series(1, 100000) g;
|
|
delete from tt where i%100 != 0 and i > 10000;
|
|
vacuum freeze tt;
|
|
|
|
-- Delete the rest of the rows, and vacuum again. This truncates the
|
|
-- heap to 0 blocks, and should also truncate the FSM.
|
|
delete from tt;
|
|
vacuum tt;
|
|
|
|
-- This can be used to look at the FSM directly, if the 'pg_freespace' contrib module
|
|
-- is installed
|
|
--SELECT blkno, avail from generate_series(1, 450) blkno, pg_freespace('tt'::regclass, blkno) AS avail;
|
|
|
|
-- Insert a row again. It should go on block #0. If the FSM was not truncated,
|
|
-- the insertion would find a higher-numbered block in the FSM and use that instead.
|
|
insert into tt values (0);
|
|
select ctid, * from tt;
|
|
|
|
drop table tt;
|