Merge branch 'master' into velioglu/table_wo_seq_prototype

velioglu/wo_seq_test_1
Burak Velioglu 2022-01-16 17:11:04 +03:00
commit 4ae87e8057
No known key found for this signature in database
GPG Key ID: F6827E620F6549C6
6 changed files with 29 additions and 18 deletions

View File

@ -10,13 +10,13 @@
#include "postgres.h" #include "postgres.h"
#include "funcapi.h"
#include "pg_config.h" #include "pg_config.h"
#include "access/nbtree.h" #include "access/nbtree.h"
#include "access/table.h" #include "access/table.h"
#include "catalog/pg_am.h" #include "catalog/pg_am.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
#include "distributed/pg_version_constants.h" #include "distributed/pg_version_constants.h"
#include "distributed/tuplestore.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "storage/fd.h" #include "storage/fd.h"
#include "storage/smgr.h" #include "storage/smgr.h"
@ -54,6 +54,8 @@ columnar_store_memory_stats(PG_FUNCTION_ARGS)
TupleDescInitEntry(tupleDescriptor, (AttrNumber) 3, "WriteStateContext", TupleDescInitEntry(tupleDescriptor, (AttrNumber) 3, "WriteStateContext",
INT8OID, -1, 0); INT8OID, -1, 0);
tupleDescriptor = BlessTupleDesc(tupleDescriptor);
MemoryContextCounters transactionCounters = { 0 }; MemoryContextCounters transactionCounters = { 0 };
MemoryContextCounters topCounters = { 0 }; MemoryContextCounters topCounters = { 0 };
MemoryContextCounters writeStateCounters = { 0 }; MemoryContextCounters writeStateCounters = { 0 };
@ -68,9 +70,9 @@ columnar_store_memory_stats(PG_FUNCTION_ARGS)
Int64GetDatum(writeStateCounters.totalspace) Int64GetDatum(writeStateCounters.totalspace)
}; };
Tuplestorestate *tupleStore = SetupTuplestore(fcinfo, &tupleDescriptor); HeapTuple tuple = heap_form_tuple(tupleDescriptor, values, nulls);
tuplestore_putvalues(tupleStore, tupleDescriptor, values, nulls);
PG_RETURN_DATUM(0); PG_RETURN_DATUM(HeapTupleGetDatum(tuple));
} }

View File

@ -42,7 +42,6 @@
#include "commands/defrem.h" #include "commands/defrem.h"
#include "commands/sequence.h" #include "commands/sequence.h"
#include "commands/trigger.h" #include "commands/trigger.h"
#include "distributed/metadata_cache.h"
#include "executor/executor.h" #include "executor/executor.h"
#include "executor/spi.h" #include "executor/spi.h"
#include "miscadmin.h" #include "miscadmin.h"

View File

@ -32,6 +32,7 @@
#include "nodes/makefuncs.h" #include "nodes/makefuncs.h"
#include "optimizer/plancat.h" #include "optimizer/plancat.h"
#include "pgstat.h" #include "pgstat.h"
#include "safe_lib.h"
#include "storage/bufmgr.h" #include "storage/bufmgr.h"
#include "storage/bufpage.h" #include "storage/bufpage.h"
#include "storage/bufmgr.h" #include "storage/bufmgr.h"
@ -48,16 +49,12 @@
#include "utils/relcache.h" #include "utils/relcache.h"
#include "utils/lsyscache.h" #include "utils/lsyscache.h"
#include "utils/syscache.h" #include "utils/syscache.h"
#include "columnar/columnar.h" #include "columnar/columnar.h"
#include "columnar/columnar_customscan.h" #include "columnar/columnar_customscan.h"
#include "columnar/columnar_storage.h" #include "columnar/columnar_storage.h"
#include "columnar/columnar_tableam.h" #include "columnar/columnar_tableam.h"
#include "columnar/columnar_version_compat.h" #include "columnar/columnar_version_compat.h"
#include "distributed/commands.h"
#include "distributed/commands/utility_hook.h"
#include "distributed/listutils.h" #include "distributed/listutils.h"
#include "distributed/metadata_cache.h"
/* /*
* Timing parameters for truncate locking heuristics. * Timing parameters for truncate locking heuristics.
@ -2098,7 +2095,9 @@ ColumnarProcessUtility(PlannedStmt *pstmt,
IndexStmt *indexStmt = (IndexStmt *) parsetree; IndexStmt *indexStmt = (IndexStmt *) parsetree;
Relation rel = relation_openrv(indexStmt->relation, Relation rel = relation_openrv(indexStmt->relation,
GetCreateIndexRelationLockMode(indexStmt)); indexStmt->concurrent ? ShareUpdateExclusiveLock :
ShareLock);
if (rel->rd_tableam == GetColumnarTableAmRoutine()) if (rel->rd_tableam == GetColumnarTableAmRoutine())
{ {
CheckCitusVersion(ERROR); CheckCitusVersion(ERROR);

View File

@ -1201,6 +1201,15 @@ ExecuteDistributedDDLJob(DDLJob *ddlJob)
* snapshots via adaptive executor. * snapshots via adaptive executor.
*/ */
set_indexsafe_procflags(); set_indexsafe_procflags();
/*
* We should not have any CREATE INDEX commands go through the
* local backend as we signaled other backends that this backend
* is executing a "safe" index command (PROC_IN_SAFE_IC), which
* is NOT true, we are only faking postgres based on the reasoning
* given above.
*/
Assert(localExecutionSupported == false);
#endif #endif
} }

View File

@ -67,10 +67,11 @@ BEGIN
RETURN false; RETURN false;
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION columnar_store_memory_stats() CREATE OR REPLACE FUNCTION columnar_store_memory_stats(
RETURNS TABLE(TopMemoryContext BIGINT, OUT TopMemoryContext BIGINT,
TopTransactionContext BIGINT, OUT TopTransactionContext BIGINT,
WriteStateContext BIGINT) OUT WriteStateContext BIGINT)
RETURNS RECORD
LANGUAGE C STRICT VOLATILE LANGUAGE C STRICT VOLATILE
AS 'citus', $$columnar_store_memory_stats$$; AS 'citus', $$columnar_store_memory_stats$$;
CREATE FUNCTION top_memory_context_usage() CREATE FUNCTION top_memory_context_usage()

View File

@ -73,10 +73,11 @@ BEGIN
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION columnar_store_memory_stats() CREATE OR REPLACE FUNCTION columnar_store_memory_stats(
RETURNS TABLE(TopMemoryContext BIGINT, OUT TopMemoryContext BIGINT,
TopTransactionContext BIGINT, OUT TopTransactionContext BIGINT,
WriteStateContext BIGINT) OUT WriteStateContext BIGINT)
RETURNS RECORD
LANGUAGE C STRICT VOLATILE LANGUAGE C STRICT VOLATILE
AS 'citus', $$columnar_store_memory_stats$$; AS 'citus', $$columnar_store_memory_stats$$;