mirror of https://github.com/citusdata/citus.git
Clean up UDFs and remove unnecessary permissions
parent
27930aa462
commit
5a63deab2e
|
@ -1,6 +1,6 @@
|
||||||
# Citus extension
|
# Citus extension
|
||||||
comment = 'Citus distributed database'
|
comment = 'Citus distributed database'
|
||||||
default_version = '8.0-10'
|
default_version = '8.0-11'
|
||||||
module_pathname = '$libdir/citus'
|
module_pathname = '$libdir/citus'
|
||||||
relocatable = false
|
relocatable = false
|
||||||
schema = pg_catalog
|
schema = pg_catalog
|
||||||
|
|
|
@ -17,7 +17,7 @@ EXTVERSIONS = 5.0 5.0-1 5.0-2 \
|
||||||
7.3-1 7.3-2 7.3-3 \
|
7.3-1 7.3-2 7.3-3 \
|
||||||
7.4-1 7.4-2 7.4-3 \
|
7.4-1 7.4-2 7.4-3 \
|
||||||
7.5-1 7.5-2 7.5-3 7.5-4 7.5-5 7.5-6 7.5-7 \
|
7.5-1 7.5-2 7.5-3 7.5-4 7.5-5 7.5-6 7.5-7 \
|
||||||
8.0-1 8.0-2 8.0-3 8.0-4 8.0-5 8.0-6 8.0-7 8.0-8 8.0-9 8.0-10
|
8.0-1 8.0-2 8.0-3 8.0-4 8.0-5 8.0-6 8.0-7 8.0-8 8.0-9 8.0-10 8.0-11
|
||||||
|
|
||||||
# All citus--*.sql files in the source directory
|
# All citus--*.sql files in the source directory
|
||||||
DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql))
|
DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql))
|
||||||
|
@ -235,6 +235,8 @@ $(EXTENSION)--8.0-9.sql: $(EXTENSION)--8.0-8.sql $(EXTENSION)--8.0-8--8.0-9.sql
|
||||||
cat $^ > $@
|
cat $^ > $@
|
||||||
$(EXTENSION)--8.0-10.sql: $(EXTENSION)--8.0-9.sql $(EXTENSION)--8.0-9--8.0-10.sql
|
$(EXTENSION)--8.0-10.sql: $(EXTENSION)--8.0-9.sql $(EXTENSION)--8.0-9--8.0-10.sql
|
||||||
cat $^ > $@
|
cat $^ > $@
|
||||||
|
$(EXTENSION)--8.0-11.sql: $(EXTENSION)--8.0-10.sql $(EXTENSION)--8.0-10--8.0-11.sql
|
||||||
|
cat $^ > $@
|
||||||
|
|
||||||
NO_PGXS = 1
|
NO_PGXS = 1
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
/* citus--8.0-10--8.0-11 */
|
||||||
|
SET search_path = 'pg_catalog';
|
||||||
|
|
||||||
|
-- Deprecated functions
|
||||||
|
DROP FUNCTION IF EXISTS worker_foreign_file_path(text);
|
||||||
|
DROP FUNCTION IF EXISTS worker_find_block_local_path(bigint,text[]);
|
||||||
|
DROP FUNCTION IF EXISTS worker_fetch_query_results_file(bigint,integer,integer,text,integer);
|
||||||
|
DROP FUNCTION IF EXISTS master_drop_distributed_table_metadata(regclass,text,text);
|
||||||
|
REVOKE ALL ON FUNCTION create_insert_proxy_for_table(regclass,regclass) FROM PUBLIC;
|
||||||
|
|
||||||
|
-- Testing functions
|
||||||
|
REVOKE ALL ON FUNCTION citus_blocking_pids(integer) FROM PUBLIC;
|
||||||
|
REVOKE ALL ON FUNCTION citus_isolation_test_session_is_blocked(integer,integer[]) FROM PUBLIC;
|
||||||
|
|
||||||
|
-- Maintenance function
|
||||||
|
REVOKE ALL ON FUNCTION worker_cleanup_job_schema_cache() FROM PUBLIC;
|
||||||
|
REVOKE ALL ON FUNCTION recover_prepared_transactions() FROM PUBLIC;
|
||||||
|
REVOKE ALL ON FUNCTION check_distributed_deadlocks() FROM PUBLIC;
|
||||||
|
|
||||||
|
RESET search_path;
|
|
@ -1,6 +1,6 @@
|
||||||
# Citus extension
|
# Citus extension
|
||||||
comment = 'Citus distributed database'
|
comment = 'Citus distributed database'
|
||||||
default_version = '8.0-10'
|
default_version = '8.0-11'
|
||||||
module_pathname = '$libdir/citus'
|
module_pathname = '$libdir/citus'
|
||||||
relocatable = false
|
relocatable = false
|
||||||
schema = pg_catalog
|
schema = pg_catalog
|
||||||
|
|
|
@ -219,28 +219,6 @@ COMMENT ON FUNCTION worker_fetch_partition_file(bigint, integer, integer, intege
|
||||||
integer)
|
integer)
|
||||||
IS 'fetch partition file from remote node';
|
IS 'fetch partition file from remote node';
|
||||||
|
|
||||||
CREATE FUNCTION worker_fetch_query_results_file(bigint, integer, integer, text, integer)
|
|
||||||
RETURNS void
|
|
||||||
LANGUAGE C STRICT
|
|
||||||
AS 'MODULE_PATHNAME', $$worker_fetch_query_results_file$$;
|
|
||||||
COMMENT ON FUNCTION worker_fetch_query_results_file(bigint, integer, integer, text,
|
|
||||||
integer)
|
|
||||||
IS 'fetch query results file from remote node';
|
|
||||||
|
|
||||||
CREATE FUNCTION worker_fetch_foreign_file(text, bigint, text[], integer[])
|
|
||||||
RETURNS void
|
|
||||||
LANGUAGE C STRICT
|
|
||||||
AS 'MODULE_PATHNAME', $$worker_fetch_foreign_file$$;
|
|
||||||
COMMENT ON FUNCTION worker_fetch_foreign_file(text, bigint, text[], integer[])
|
|
||||||
IS 'fetch foreign file from remote node and apply file';
|
|
||||||
|
|
||||||
CREATE FUNCTION worker_fetch_regular_table(text, bigint, text[], integer[])
|
|
||||||
RETURNS void
|
|
||||||
LANGUAGE C STRICT
|
|
||||||
AS 'MODULE_PATHNAME', $$worker_fetch_regular_table$$;
|
|
||||||
COMMENT ON FUNCTION worker_fetch_regular_table(text, bigint, text[], integer[])
|
|
||||||
IS 'fetch PostgreSQL table from remote node';
|
|
||||||
|
|
||||||
CREATE FUNCTION worker_range_partition_table(bigint, integer, text, text, oid, anyarray)
|
CREATE FUNCTION worker_range_partition_table(bigint, integer, text, text, oid, anyarray)
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE C STRICT
|
LANGUAGE C STRICT
|
||||||
|
@ -278,20 +256,6 @@ CREATE FUNCTION worker_cleanup_job_schema_cache()
|
||||||
COMMENT ON FUNCTION worker_cleanup_job_schema_cache()
|
COMMENT ON FUNCTION worker_cleanup_job_schema_cache()
|
||||||
IS 'cleanup all job schemas in current database';
|
IS 'cleanup all job schemas in current database';
|
||||||
|
|
||||||
CREATE FUNCTION worker_foreign_file_path(text)
|
|
||||||
RETURNS text
|
|
||||||
LANGUAGE C STRICT
|
|
||||||
AS 'MODULE_PATHNAME', $$worker_foreign_file_path$$;
|
|
||||||
COMMENT ON FUNCTION worker_foreign_file_path(text)
|
|
||||||
IS 'get a foreign table''s local file path';
|
|
||||||
|
|
||||||
CREATE FUNCTION worker_find_block_local_path(bigint, text[])
|
|
||||||
RETURNS text
|
|
||||||
LANGUAGE C STRICT
|
|
||||||
AS 'MODULE_PATHNAME', $$worker_find_block_local_path$$;
|
|
||||||
COMMENT ON FUNCTION worker_find_block_local_path(bigint, text[])
|
|
||||||
IS 'find an HDFS block''s local file path';
|
|
||||||
|
|
||||||
CREATE FUNCTION worker_apply_shard_ddl_command(bigint, text)
|
CREATE FUNCTION worker_apply_shard_ddl_command(bigint, text)
|
||||||
RETURNS void
|
RETURNS void
|
||||||
LANGUAGE C STRICT
|
LANGUAGE C STRICT
|
||||||
|
|
|
@ -71,7 +71,6 @@ static void SetDefElemArg(AlterSeqStmt *statement, const char *name, Node *arg);
|
||||||
|
|
||||||
/* exports for SQL callable functions */
|
/* exports for SQL callable functions */
|
||||||
PG_FUNCTION_INFO_V1(worker_fetch_partition_file);
|
PG_FUNCTION_INFO_V1(worker_fetch_partition_file);
|
||||||
PG_FUNCTION_INFO_V1(worker_fetch_query_results_file);
|
|
||||||
PG_FUNCTION_INFO_V1(worker_apply_shard_ddl_command);
|
PG_FUNCTION_INFO_V1(worker_apply_shard_ddl_command);
|
||||||
PG_FUNCTION_INFO_V1(worker_apply_inter_shard_ddl_command);
|
PG_FUNCTION_INFO_V1(worker_apply_inter_shard_ddl_command);
|
||||||
PG_FUNCTION_INFO_V1(worker_apply_sequence_command);
|
PG_FUNCTION_INFO_V1(worker_apply_sequence_command);
|
||||||
|
@ -81,6 +80,7 @@ PG_FUNCTION_INFO_V1(worker_append_table_to_shard);
|
||||||
* Following UDFs are stub functions, you can check their comments for more
|
* Following UDFs are stub functions, you can check their comments for more
|
||||||
* detail.
|
* detail.
|
||||||
*/
|
*/
|
||||||
|
PG_FUNCTION_INFO_V1(worker_fetch_query_results_file);
|
||||||
PG_FUNCTION_INFO_V1(worker_fetch_regular_table);
|
PG_FUNCTION_INFO_V1(worker_fetch_regular_table);
|
||||||
PG_FUNCTION_INFO_V1(worker_fetch_foreign_file);
|
PG_FUNCTION_INFO_V1(worker_fetch_foreign_file);
|
||||||
PG_FUNCTION_INFO_V1(master_expire_table_cache);
|
PG_FUNCTION_INFO_V1(master_expire_table_cache);
|
||||||
|
@ -132,52 +132,6 @@ worker_fetch_partition_file(PG_FUNCTION_ARGS)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* worker_fetch_query_results_file fetches a query results file from the remote
|
|
||||||
* node. The function assumes an upstream compute task depends on this query
|
|
||||||
* results file, and therefore directly fetches the file into the upstream
|
|
||||||
* task's directory.
|
|
||||||
*/
|
|
||||||
Datum
|
|
||||||
worker_fetch_query_results_file(PG_FUNCTION_ARGS)
|
|
||||||
{
|
|
||||||
uint64 jobId = PG_GETARG_INT64(0);
|
|
||||||
uint32 queryTaskId = PG_GETARG_UINT32(1);
|
|
||||||
uint32 upstreamTaskId = PG_GETARG_UINT32(2);
|
|
||||||
text *nodeNameText = PG_GETARG_TEXT_P(3);
|
|
||||||
uint32 nodePort = PG_GETARG_UINT32(4);
|
|
||||||
char *nodeName = NULL;
|
|
||||||
|
|
||||||
/* remote filename is <jobId>/<queryTaskId> */
|
|
||||||
StringInfo remoteDirectoryName = JobDirectoryName(jobId);
|
|
||||||
StringInfo remoteFilename = TaskFilename(remoteDirectoryName, queryTaskId);
|
|
||||||
|
|
||||||
/* local filename is <jobId>/<upstreamTaskId>/<queryTaskId> */
|
|
||||||
StringInfo taskDirectoryName = TaskDirectoryName(jobId, upstreamTaskId);
|
|
||||||
StringInfo taskFilename = UserTaskFilename(taskDirectoryName, queryTaskId);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If we are the first function to fetch a file for the upstream task, the
|
|
||||||
* task directory does not exist. We then lock and create the directory.
|
|
||||||
*/
|
|
||||||
bool taskDirectoryExists = DirectoryExists(taskDirectoryName);
|
|
||||||
|
|
||||||
CheckCitusVersion(ERROR);
|
|
||||||
|
|
||||||
if (!taskDirectoryExists)
|
|
||||||
{
|
|
||||||
InitTaskDirectory(jobId, upstreamTaskId);
|
|
||||||
}
|
|
||||||
|
|
||||||
nodeName = text_to_cstring(nodeNameText);
|
|
||||||
|
|
||||||
/* we've made sure the file names are sanitized, safe to fetch as superuser */
|
|
||||||
FetchRegularFileAsSuperUser(nodeName, nodePort, remoteFilename, taskFilename);
|
|
||||||
|
|
||||||
PG_RETURN_VOID();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Constructs a standardized task file path for given directory and task id. */
|
/* Constructs a standardized task file path for given directory and task id. */
|
||||||
StringInfo
|
StringInfo
|
||||||
TaskFilename(StringInfo directoryName, uint32 taskId)
|
TaskFilename(StringInfo directoryName, uint32 taskId)
|
||||||
|
@ -1007,6 +961,20 @@ SetDefElemArg(AlterSeqStmt *statement, const char *name, Node *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* worker_fetch_query_results_file is a stub UDF to allow the function object
|
||||||
|
* to be re-created during upgrades. We should keep this around until we drop
|
||||||
|
* support for Postgres 11, since Postgres 11 is the highest version for which
|
||||||
|
* this object may have been created.
|
||||||
|
*/
|
||||||
|
Datum
|
||||||
|
worker_fetch_query_results_file(PG_FUNCTION_ARGS)
|
||||||
|
{
|
||||||
|
ereport(DEBUG2, (errmsg("this function is deprecated and no longer is used")));
|
||||||
|
PG_RETURN_VOID();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* worker_fetch_regular_table UDF is a stub UDF to install Citus flawlessly.
|
* worker_fetch_regular_table UDF is a stub UDF to install Citus flawlessly.
|
||||||
* Otherwise we need to delete them from our sql files, which is confusing
|
* Otherwise we need to delete them from our sql files, which is confusing
|
||||||
|
|
|
@ -153,6 +153,7 @@ ALTER EXTENSION citus UPDATE TO '8.0-7';
|
||||||
ALTER EXTENSION citus UPDATE TO '8.0-8';
|
ALTER EXTENSION citus UPDATE TO '8.0-8';
|
||||||
ALTER EXTENSION citus UPDATE TO '8.0-9';
|
ALTER EXTENSION citus UPDATE TO '8.0-9';
|
||||||
ALTER EXTENSION citus UPDATE TO '8.0-10';
|
ALTER EXTENSION citus UPDATE TO '8.0-10';
|
||||||
|
ALTER EXTENSION citus UPDATE TO '8.0-11';
|
||||||
-- show running version
|
-- show running version
|
||||||
SHOW citus.version;
|
SHOW citus.version;
|
||||||
citus.version
|
citus.version
|
||||||
|
|
|
@ -153,6 +153,7 @@ ALTER EXTENSION citus UPDATE TO '8.0-7';
|
||||||
ALTER EXTENSION citus UPDATE TO '8.0-8';
|
ALTER EXTENSION citus UPDATE TO '8.0-8';
|
||||||
ALTER EXTENSION citus UPDATE TO '8.0-9';
|
ALTER EXTENSION citus UPDATE TO '8.0-9';
|
||||||
ALTER EXTENSION citus UPDATE TO '8.0-10';
|
ALTER EXTENSION citus UPDATE TO '8.0-10';
|
||||||
|
ALTER EXTENSION citus UPDATE TO '8.0-11';
|
||||||
|
|
||||||
-- show running version
|
-- show running version
|
||||||
SHOW citus.version;
|
SHOW citus.version;
|
||||||
|
|
Loading…
Reference in New Issue