mirror of https://github.com/citusdata/citus.git
Remove the unused drop event trigger
parent
1d69519bd8
commit
5a077f2308
|
@ -31,33 +31,6 @@ RETURNS bigint
|
||||||
AS 'MODULE_PATHNAME'
|
AS 'MODULE_PATHNAME'
|
||||||
LANGUAGE C STRICT;
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cstore_clean_table_resources(oid)
|
|
||||||
RETURNS void
|
|
||||||
AS 'MODULE_PATHNAME'
|
|
||||||
LANGUAGE C STRICT;
|
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION cstore_drop_trigger()
|
|
||||||
RETURNS event_trigger
|
|
||||||
LANGUAGE plpgsql
|
|
||||||
AS $csdt$
|
|
||||||
DECLARE v_obj record;
|
|
||||||
BEGIN
|
|
||||||
FOR v_obj IN SELECT * FROM pg_event_trigger_dropped_objects() LOOP
|
|
||||||
|
|
||||||
IF v_obj.object_type NOT IN ('table', 'foreign table') THEN
|
|
||||||
CONTINUE;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
PERFORM cstore.cstore_clean_table_resources(v_obj.objid);
|
|
||||||
|
|
||||||
END LOOP;
|
|
||||||
END;
|
|
||||||
$csdt$;
|
|
||||||
|
|
||||||
CREATE EVENT TRIGGER cstore_drop_event
|
|
||||||
ON SQL_DROP
|
|
||||||
EXECUTE PROCEDURE cstore_drop_trigger();
|
|
||||||
|
|
||||||
CREATE TABLE cstore_tables (
|
CREATE TABLE cstore_tables (
|
||||||
relid oid NOT NULL,
|
relid oid NOT NULL,
|
||||||
block_row_count int NOT NULL,
|
block_row_count int NOT NULL,
|
||||||
|
|
25
cstore_fdw.c
25
cstore_fdw.c
|
@ -196,7 +196,6 @@ PG_FUNCTION_INFO_V1(cstore_ddl_event_end_trigger);
|
||||||
PG_FUNCTION_INFO_V1(cstore_table_size);
|
PG_FUNCTION_INFO_V1(cstore_table_size);
|
||||||
PG_FUNCTION_INFO_V1(cstore_fdw_handler);
|
PG_FUNCTION_INFO_V1(cstore_fdw_handler);
|
||||||
PG_FUNCTION_INFO_V1(cstore_fdw_validator);
|
PG_FUNCTION_INFO_V1(cstore_fdw_validator);
|
||||||
PG_FUNCTION_INFO_V1(cstore_clean_table_resources);
|
|
||||||
|
|
||||||
|
|
||||||
/* saved hook value in case of unload */
|
/* saved hook value in case of unload */
|
||||||
|
@ -1179,30 +1178,6 @@ cstore_fdw_validator(PG_FUNCTION_ARGS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* cstore_clean_table_resources cleans up table data and metadata with provided
|
|
||||||
* relation id. The function is meant to be called from drop_event_trigger. It
|
|
||||||
* has no way of knowing if the provided relation id belongs to a cstore table.
|
|
||||||
* Therefore it first checks if data file exists at default location before
|
|
||||||
* attempting to remove data and footer files. If the table is created at a
|
|
||||||
* custom path than its resources would not be removed.
|
|
||||||
*/
|
|
||||||
Datum
|
|
||||||
cstore_clean_table_resources(PG_FUNCTION_ARGS)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* TODO: Event triggers do not offer the relfilenode of the
|
|
||||||
* dropped table, and by the time the sql_drop event trigger
|
|
||||||
* is called, the object is already gone so we can't look it
|
|
||||||
* up. Therefore, we can't drop the Smgr storage here, which
|
|
||||||
* means that cascaded drops of cstore foreign tables will
|
|
||||||
* leak storage.
|
|
||||||
*/
|
|
||||||
|
|
||||||
PG_RETURN_VOID();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OptionNamesString finds all options that are valid for the current context,
|
* OptionNamesString finds all options that are valid for the current context,
|
||||||
* and concatenates these option names in a comma separated string. The function
|
* and concatenates these option names in a comma separated string. The function
|
||||||
|
|
Loading…
Reference in New Issue