mirror of https://github.com/citusdata/citus.git
Skip deleting options if columnar.options is already dropped (#5458)
Drop extension might cascade to columnar.options before dropping a columnar table. In that case, we were getting below error when opening columnar.options to delete records for the columnar table that we are about to drop.: "ERROR: could not open relation with OID 0". I somehow reproduced this bug easily when upgrading pg, that is why adding added the test to after_pg_upgrade_schedule.pull/5462/head
parent
1aa32d5dbc
commit
25024b776e
|
@ -335,8 +335,13 @@ DeleteColumnarTableOptions(Oid regclass, bool missingOk)
|
||||||
*/
|
*/
|
||||||
Assert(!IsBinaryUpgrade);
|
Assert(!IsBinaryUpgrade);
|
||||||
|
|
||||||
Relation columnarOptions = relation_open(ColumnarOptionsRelationId(),
|
Relation columnarOptions = try_relation_open(ColumnarOptionsRelationId(),
|
||||||
RowExclusiveLock);
|
RowExclusiveLock);
|
||||||
|
if (columnarOptions == NULL)
|
||||||
|
{
|
||||||
|
/* extension has been dropped */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* find existing item to remove */
|
/* find existing item to remove */
|
||||||
ScanKeyData scanKey[1] = { 0 };
|
ScanKeyData scanKey[1] = { 0 };
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
test: upgrade_basic_after upgrade_columnar_after upgrade_type_after upgrade_ref2ref_after upgrade_distributed_function_after upgrade_rebalance_strategy_after upgrade_list_citus_objects upgrade_autoconverted_after
|
test: upgrade_basic_after upgrade_type_after upgrade_ref2ref_after upgrade_distributed_function_after upgrade_rebalance_strategy_after upgrade_list_citus_objects upgrade_autoconverted_after
|
||||||
|
|
||||||
|
# This attempts dropping citus extension (and rollbacks), so please do
|
||||||
|
# not run in parallel with any other tests.
|
||||||
|
test: upgrade_columnar_after
|
||||||
|
|
|
@ -247,3 +247,15 @@ BEGIN;
|
||||||
-- since we run "after schedule" twice, rollback the transaction
|
-- since we run "after schedule" twice, rollback the transaction
|
||||||
-- to avoid getting "table already exists" errors
|
-- to avoid getting "table already exists" errors
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
BEGIN;
|
||||||
|
-- Show that we can still drop the extension after upgrading
|
||||||
|
SET client_min_messages TO WARNING;
|
||||||
|
-- Drop extension migth cascade to columnar.options before dropping a
|
||||||
|
-- columnar table. In that case, we were getting below error when opening
|
||||||
|
-- columnar.options to delete records for the columnar table that we are
|
||||||
|
-- about to drop.: "ERROR: could not open relation with OID 0".
|
||||||
|
--
|
||||||
|
-- I somehow reproduced this bug easily when upgrading pg, that is why
|
||||||
|
-- adding the test to this file.
|
||||||
|
DROP EXTENSION citus CASCADE;
|
||||||
|
ROLLBACK;
|
||||||
|
|
|
@ -117,3 +117,17 @@ BEGIN;
|
||||||
-- since we run "after schedule" twice, rollback the transaction
|
-- since we run "after schedule" twice, rollback the transaction
|
||||||
-- to avoid getting "table already exists" errors
|
-- to avoid getting "table already exists" errors
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
-- Show that we can still drop the extension after upgrading
|
||||||
|
SET client_min_messages TO WARNING;
|
||||||
|
|
||||||
|
-- Drop extension migth cascade to columnar.options before dropping a
|
||||||
|
-- columnar table. In that case, we were getting below error when opening
|
||||||
|
-- columnar.options to delete records for the columnar table that we are
|
||||||
|
-- about to drop.: "ERROR: could not open relation with OID 0".
|
||||||
|
--
|
||||||
|
-- I somehow reproduced this bug easily when upgrading pg, that is why
|
||||||
|
-- adding the test to this file.
|
||||||
|
DROP EXTENSION citus CASCADE;
|
||||||
|
ROLLBACK;
|
||||||
|
|
Loading…
Reference in New Issue