mirror of https://github.com/citusdata/citus.git
Making Columnar Dependency Free from Citus (#5622)
* Removed distributed dependency in columnar_metadata.c * Changed columnar_debug.c so that it no longer needed distributed/tuplestore and made it return a record instead of a tuplestore * removed distributed/commands.h dependency * Made columnar_tableam.c dependency-free * Fixed spacing for columnar_store_memory_stats function * indentation fix * fixed test failurespull/5623/head
parent
70d8e1fe97
commit
4dca662e97
|
@ -10,13 +10,13 @@
|
|||
|
||||
#include "postgres.h"
|
||||
|
||||
#include "funcapi.h"
|
||||
#include "pg_config.h"
|
||||
#include "access/nbtree.h"
|
||||
#include "access/table.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "distributed/pg_version_constants.h"
|
||||
#include "distributed/tuplestore.h"
|
||||
#include "miscadmin.h"
|
||||
#include "storage/fd.h"
|
||||
#include "storage/smgr.h"
|
||||
|
@ -54,6 +54,8 @@ columnar_store_memory_stats(PG_FUNCTION_ARGS)
|
|||
TupleDescInitEntry(tupleDescriptor, (AttrNumber) 3, "WriteStateContext",
|
||||
INT8OID, -1, 0);
|
||||
|
||||
tupleDescriptor = BlessTupleDesc(tupleDescriptor);
|
||||
|
||||
MemoryContextCounters transactionCounters = { 0 };
|
||||
MemoryContextCounters topCounters = { 0 };
|
||||
MemoryContextCounters writeStateCounters = { 0 };
|
||||
|
@ -68,9 +70,9 @@ columnar_store_memory_stats(PG_FUNCTION_ARGS)
|
|||
Int64GetDatum(writeStateCounters.totalspace)
|
||||
};
|
||||
|
||||
Tuplestorestate *tupleStore = SetupTuplestore(fcinfo, &tupleDescriptor);
|
||||
tuplestore_putvalues(tupleStore, tupleDescriptor, values, nulls);
|
||||
PG_RETURN_DATUM(0);
|
||||
HeapTuple tuple = heap_form_tuple(tupleDescriptor, values, nulls);
|
||||
|
||||
PG_RETURN_DATUM(HeapTupleGetDatum(tuple));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "commands/defrem.h"
|
||||
#include "commands/sequence.h"
|
||||
#include "commands/trigger.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
#include "executor/executor.h"
|
||||
#include "executor/spi.h"
|
||||
#include "miscadmin.h"
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "nodes/makefuncs.h"
|
||||
#include "optimizer/plancat.h"
|
||||
#include "pgstat.h"
|
||||
#include "safe_lib.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/bufpage.h"
|
||||
#include "storage/bufmgr.h"
|
||||
|
@ -48,16 +49,12 @@
|
|||
#include "utils/relcache.h"
|
||||
#include "utils/lsyscache.h"
|
||||
#include "utils/syscache.h"
|
||||
|
||||
#include "columnar/columnar.h"
|
||||
#include "columnar/columnar_customscan.h"
|
||||
#include "columnar/columnar_storage.h"
|
||||
#include "columnar/columnar_tableam.h"
|
||||
#include "columnar/columnar_version_compat.h"
|
||||
#include "distributed/commands.h"
|
||||
#include "distributed/commands/utility_hook.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_cache.h"
|
||||
|
||||
/*
|
||||
* Timing parameters for truncate locking heuristics.
|
||||
|
@ -2098,7 +2095,9 @@ ColumnarProcessUtility(PlannedStmt *pstmt,
|
|||
IndexStmt *indexStmt = (IndexStmt *) parsetree;
|
||||
|
||||
Relation rel = relation_openrv(indexStmt->relation,
|
||||
GetCreateIndexRelationLockMode(indexStmt));
|
||||
indexStmt->concurrent ? ShareUpdateExclusiveLock :
|
||||
ShareLock);
|
||||
|
||||
if (rel->rd_tableam == GetColumnarTableAmRoutine())
|
||||
{
|
||||
CheckCitusVersion(ERROR);
|
||||
|
|
|
@ -67,10 +67,11 @@ BEGIN
|
|||
RETURN false;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
CREATE OR REPLACE FUNCTION columnar_store_memory_stats()
|
||||
RETURNS TABLE(TopMemoryContext BIGINT,
|
||||
TopTransactionContext BIGINT,
|
||||
WriteStateContext BIGINT)
|
||||
CREATE OR REPLACE FUNCTION columnar_store_memory_stats(
|
||||
OUT TopMemoryContext BIGINT,
|
||||
OUT TopTransactionContext BIGINT,
|
||||
OUT WriteStateContext BIGINT)
|
||||
RETURNS RECORD
|
||||
LANGUAGE C STRICT VOLATILE
|
||||
AS 'citus', $$columnar_store_memory_stats$$;
|
||||
CREATE FUNCTION top_memory_context_usage()
|
||||
|
|
|
@ -73,10 +73,11 @@ BEGIN
|
|||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE OR REPLACE FUNCTION columnar_store_memory_stats()
|
||||
RETURNS TABLE(TopMemoryContext BIGINT,
|
||||
TopTransactionContext BIGINT,
|
||||
WriteStateContext BIGINT)
|
||||
CREATE OR REPLACE FUNCTION columnar_store_memory_stats(
|
||||
OUT TopMemoryContext BIGINT,
|
||||
OUT TopTransactionContext BIGINT,
|
||||
OUT WriteStateContext BIGINT)
|
||||
RETURNS RECORD
|
||||
LANGUAGE C STRICT VOLATILE
|
||||
AS 'citus', $$columnar_store_memory_stats$$;
|
||||
|
||||
|
|
Loading…
Reference in New Issue