mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 11:03:36 +08:00
Re-enable CREATE/DROP INDEX isolation test
The flake in `multi_transaction_indexing` is because of a race between `CREATE INDEX` and `DROP INDEX` and this commit add a debug waitpoint so that we can reliably reproduce the race condition in the isolation test.
This commit is contained in:
parent
102064aab3
commit
5bde51a3d9
@ -66,6 +66,7 @@
|
||||
#include "continuous_agg.h"
|
||||
#include "compression_with_clause.h"
|
||||
#include "partitioning.h"
|
||||
#include "debug_wait.h"
|
||||
|
||||
#include "cross_module_fn.h"
|
||||
|
||||
@ -2392,6 +2393,8 @@ process_index_start(ProcessUtilityArgs *args)
|
||||
|
||||
UnlockRelationIdForSession(&main_table_index_lock_relid, AccessShareLock);
|
||||
|
||||
DEBUG_WAITPOINT("indexing_done");
|
||||
|
||||
return DDL_DONE;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
Parsed test spec with 6 sessions
|
||||
Parsed test spec with 8 sessions
|
||||
|
||||
starting permutation: CI I1 Ic Bc P Sc
|
||||
step CI: CREATE INDEX test_index ON ts_index_test(location) WITH (timescaledb.transaction_per_chunk, timescaledb.barrier_table='barrier'); <waiting ...>
|
||||
@ -41,6 +41,29 @@ hypertable_index_size
|
||||
49152
|
||||
step Ic: COMMIT;
|
||||
|
||||
starting permutation: F WPE CI DI Bc WPR P Ic Sc
|
||||
step F: SET client_min_messages TO 'error';
|
||||
step WPE: SELECT debug_waitpoint_enable('indexing_done');
|
||||
debug_waitpoint_enable
|
||||
|
||||
|
||||
step CI: CREATE INDEX test_index ON ts_index_test(location) WITH (timescaledb.transaction_per_chunk, timescaledb.barrier_table='barrier'); <waiting ...>
|
||||
step DI: DROP INDEX test_index; <waiting ...>
|
||||
step Bc: ROLLBACK;
|
||||
step WPR: SELECT debug_waitpoint_release('indexing_done');
|
||||
debug_waitpoint_release
|
||||
|
||||
|
||||
step CI: <... completed>
|
||||
step DI: <... completed>
|
||||
error in steps WPR CI DI: ERROR: tuple concurrently updated
|
||||
step P: SELECT * FROM hypertable_index_size('test_index');
|
||||
hypertable_index_size
|
||||
|
||||
49152
|
||||
step Ic: COMMIT;
|
||||
step Sc: COMMIT;
|
||||
|
||||
starting permutation: CI RI Bc P Ic Sc
|
||||
step CI: CREATE INDEX test_index ON ts_index_test(location) WITH (timescaledb.transaction_per_chunk, timescaledb.barrier_table='barrier'); <waiting ...>
|
||||
step RI: ALTER TABLE test_index RENAME COLUMN location TO height; <waiting ...>
|
||||
|
@ -16,6 +16,7 @@ set(TEST_TEMPLATES
|
||||
|
||||
set(TEST_TEMPLATES_DEBUG
|
||||
dropchunks_race.spec.in
|
||||
multi_transaction_indexing.spec.in
|
||||
)
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
@ -29,11 +30,6 @@ foreach(TEMPLATE_FILE ${TEST_TEMPLATES})
|
||||
list(APPEND TEST_FILES "${TEST_FILE}")
|
||||
endforeach(TEMPLATE_FILE)
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
list(APPEND TEST_FILES
|
||||
multi_transaction_indexing.spec)
|
||||
endif (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
|
||||
foreach(TEST_FILE ${TEST_FILES})
|
||||
string(REGEX REPLACE "(.+)\.spec" "\\1" TESTS_TO_RUN ${TEST_FILE})
|
||||
file(APPEND ${ISOLATION_TEST_SCHEDULE} "test: ${TESTS_TO_RUN}\n")
|
||||
|
@ -10,6 +10,12 @@ setup {
|
||||
(21, 19.5, 3);
|
||||
|
||||
CREATE TABLE barrier(i INTEGER);
|
||||
|
||||
CREATE OR REPLACE FUNCTION debug_waitpoint_enable(TEXT) RETURNS VOID LANGUAGE C VOLATILE STRICT
|
||||
AS '@TS_MODULE_PATHNAME@', 'ts_debug_waitpoint_enable';
|
||||
|
||||
CREATE OR REPLACE FUNCTION debug_waitpoint_release(TEXT) RETURNS VOID LANGUAGE C VOLATILE STRICT
|
||||
AS '@TS_MODULE_PATHNAME@', 'ts_debug_waitpoint_release';
|
||||
}
|
||||
|
||||
teardown {
|
||||
@ -17,8 +23,12 @@ teardown {
|
||||
DROP TABLE barrier;
|
||||
}
|
||||
|
||||
session "Waitpoints"
|
||||
step "WPE" { SELECT debug_waitpoint_enable('indexing_done'); }
|
||||
step "WPR" { SELECT debug_waitpoint_release('indexing_done'); }
|
||||
|
||||
session "CREATE INDEX"
|
||||
#step "F" { SET client_min_messages TO 'error'; }
|
||||
step "F" { SET client_min_messages TO 'error'; }
|
||||
step "CI" { CREATE INDEX test_index ON ts_index_test(location) WITH (timescaledb.transaction_per_chunk, timescaledb.barrier_table='barrier'); }
|
||||
|
||||
session "RELEASE BARRIER"
|
||||
@ -35,8 +45,8 @@ setup { BEGIN; SET LOCAL lock_timeout = '500ms'; SET LOCAL deadlock_timeout = '
|
||||
step "I1" { INSERT INTO ts_index_test VALUES (31, 6.4, 1); }
|
||||
step "Ic" { COMMIT; }
|
||||
|
||||
#session "DROP INDEX"
|
||||
#step "DI" { DROP INDEX test_index; }
|
||||
session "DROP INDEX"
|
||||
step "DI" { DROP INDEX test_index; }
|
||||
|
||||
session "RENAME COLUMN"
|
||||
step "RI" { ALTER TABLE test_index RENAME COLUMN location TO height; }
|
||||
@ -55,11 +65,7 @@ permutation "I1" "CI" "Bc" "Ic" "P" "Sc"
|
||||
permutation "S1" "CI" "Bc" "Sc" "P" "Ic"
|
||||
|
||||
# drop works (the error message outputs an OID, remove the "F" to see the error)
|
||||
#
|
||||
# TODO(3021): Disabled since a race condition between CREATE INDEX
|
||||
# and DROP INDEX cause a flake. Enable when race condition is fixed.
|
||||
#
|
||||
#permutation "F" "CI" "DI" "Bc" "P" "Ic" "Sc"
|
||||
permutation "F" "WPE" "CI" "DI" "Bc" "WPR" "P" "Ic" "Sc"
|
||||
|
||||
# rename should block
|
||||
permutation "CI" "RI" "Bc" "P" "Ic" "Sc"
|
Loading…
x
Reference in New Issue
Block a user