mirror of https://github.com/citusdata/citus.git
Fixes compile errors
parent
ae9cd9c895
commit
8c93c65351
|
@ -24,6 +24,7 @@
|
|||
#include "distributed/deparse_shard_query.h"
|
||||
#include "distributed/listutils.h"
|
||||
#include "distributed/metadata_sync.h"
|
||||
#include "distributed/pooler/pgbouncer_manager.h"
|
||||
#include "distributed/remote_commands.h"
|
||||
#include "distributed/shared_library_init.h"
|
||||
#include "distributed/worker_transaction.h"
|
||||
|
@ -80,7 +81,7 @@ PreProcessUtilityInDatabaseShard(Node *parseTree, const char *queryString,
|
|||
{
|
||||
if (IsA(parseTree, CreatedbStmt))
|
||||
{
|
||||
char *command = DeparseCreatedbStmt(parseTree);
|
||||
char *command = DeparseCreateDatabaseStmt(parseTree);
|
||||
ExecuteCommandInControlDatabase(command);
|
||||
|
||||
/* command is fully delegated to control database */
|
||||
|
@ -88,7 +89,7 @@ PreProcessUtilityInDatabaseShard(Node *parseTree, const char *queryString,
|
|||
}
|
||||
else if (IsA(parseTree, DropdbStmt))
|
||||
{
|
||||
char *command = DeparseDropdbStmt(parseTree);
|
||||
char *command = DeparseDropDatabaseStmt(parseTree);
|
||||
ExecuteCommandInControlDatabase(command);
|
||||
|
||||
/* command is fully delegated to control database */
|
||||
|
|
|
@ -196,18 +196,6 @@ DeparseAlterDatabaseSetStmt(Node *node)
|
|||
return str.data;
|
||||
}
|
||||
|
||||
char *
|
||||
DeparseCreateDatabaseSetStmt(Node *node)
|
||||
{
|
||||
CreatedbStmt *stmt = castNode(CreatedbStmt, node);
|
||||
StringInfoData str = {0};
|
||||
initStringInfo(&str);
|
||||
|
||||
AppendCreatedbStmt(&str, stmt);
|
||||
|
||||
return str.data;
|
||||
}
|
||||
|
||||
static void
|
||||
AppendCreatedbStmt(StringInfo buf, CreatedbStmt *stmt)
|
||||
{
|
||||
|
@ -338,18 +326,17 @@ AppendCreatedbStmt(StringInfo buf, CreatedbStmt *stmt)
|
|||
}
|
||||
|
||||
char *
|
||||
DeparseDropDatabaseStmt(Node *node)
|
||||
DeparseCreateDatabaseStmt(Node *node)
|
||||
{
|
||||
DropdbStmt *stmt = castNode(DropdbStmt, node);
|
||||
StringInfoData str = { 0 };
|
||||
CreatedbStmt *stmt = castNode(CreatedbStmt, node);
|
||||
StringInfoData str = {0};
|
||||
initStringInfo(&str);
|
||||
|
||||
AppendDropDatabaseStmt(&str, stmt);
|
||||
AppendCreatedbStmt(&str, stmt);
|
||||
|
||||
return str.data;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
AppendDropDatabaseStmt(StringInfo buf, DropdbStmt *stmt)
|
||||
{
|
||||
|
@ -373,3 +360,18 @@ AppendDropDatabaseStmt(StringInfo buf, DropdbStmt *stmt)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
DeparseDropDatabaseStmt(Node *node)
|
||||
{
|
||||
DropdbStmt *stmt = castNode(DropdbStmt, node);
|
||||
StringInfoData str = { 0 };
|
||||
initStringInfo(&str);
|
||||
|
||||
AppendDropDatabaseStmt(&str, stmt);
|
||||
|
||||
return str.data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
static char * CreatePgDistObjectEntryCommand(const ObjectAddress *objectAddress);
|
||||
static int ExecuteCommandAsSuperuser(char *query, int paramCount, Oid *paramTypes,
|
||||
Datum *paramValues);
|
||||
static bool IsObjectDistributed(const ObjectAddress *address);
|
||||
bool IsObjectDistributed(const ObjectAddress *address);
|
||||
|
||||
PG_FUNCTION_INFO_V1(citus_unmark_object_distributed);
|
||||
PG_FUNCTION_INFO_V1(master_unmark_object_distributed);
|
||||
|
@ -392,7 +392,7 @@ UnmarkObjectDistributed(const ObjectAddress *address)
|
|||
* IsObjectDistributed returns if the object addressed is already distributed in the
|
||||
* cluster. This performs a local indexed lookup in pg_dist_object.
|
||||
*/
|
||||
static bool
|
||||
bool
|
||||
IsObjectDistributed(const ObjectAddress *address)
|
||||
{
|
||||
ScanKeyData key[3];
|
||||
|
|
|
@ -182,6 +182,8 @@ typedef struct MetadataCacheData
|
|||
Oid citusTaskStatusUnscheduledId;
|
||||
Oid citusTaskStatusCancelledId;
|
||||
Oid citusTaskStatusCancellingId;
|
||||
Oid databaseShardRelationId;
|
||||
Oid databaseShardPKeyIndexId;
|
||||
Oid distRebalanceStrategyRelationId;
|
||||
Oid distNodeRelationId;
|
||||
Oid distNodeNodeIdIndexId;
|
||||
|
@ -2769,12 +2771,34 @@ DistRebalanceStrategyRelationId(void)
|
|||
return MetadataCache.distRebalanceStrategyRelationId;
|
||||
}
|
||||
|
||||
/* return oid of citus_catalog.database_sharding relation */
|
||||
Oid
|
||||
DatabaseShardRelationId(void)
|
||||
{
|
||||
CachedRelationNamespaceLookup("database_shard", CitusCatalogNamespaceId(),
|
||||
&MetadataCache.databaseShardRelationId);
|
||||
|
||||
return MetadataCache.databaseShardRelationId;
|
||||
}
|
||||
|
||||
|
||||
/* return oid of citus_catalog.database_sharding primary key */
|
||||
Oid
|
||||
DatabaseShardPrimaryKeyIndexId(void)
|
||||
{
|
||||
CachedRelationNamespaceLookup("database_shard_pkey", CitusCatalogNamespaceId(),
|
||||
&MetadataCache.databaseShardPKeyIndexId);
|
||||
|
||||
return MetadataCache.databaseShardPKeyIndexId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* return the oid of citus namespace */
|
||||
Oid
|
||||
CitusCatalogNamespaceId(void)
|
||||
{
|
||||
CachedNamespaceLookup("citus", &MetadataCache.citusCatalogNamespaceId);
|
||||
CachedNamespaceLookup("citus_catalog", &MetadataCache.citusCatalogNamespaceId);
|
||||
return MetadataCache.citusCatalogNamespaceId;
|
||||
}
|
||||
|
||||
|
@ -2805,12 +2829,14 @@ DistObjectRelationId(void)
|
|||
true);
|
||||
if (!OidIsValid(MetadataCache.distObjectRelationId))
|
||||
{
|
||||
Oid citusNamespaceId = get_namespace_oid("citus", false);
|
||||
|
||||
/*
|
||||
* We can only ever reach here while we are creating/altering our extension before
|
||||
* the table is moved to pg_catalog.
|
||||
*/
|
||||
CachedRelationNamespaceLookupExtended("pg_dist_object",
|
||||
CitusCatalogNamespaceId(),
|
||||
citusNamespaceId,
|
||||
&MetadataCache.distObjectRelationId,
|
||||
false);
|
||||
}
|
||||
|
|
|
@ -172,6 +172,8 @@ static GucStringAssignHook OldApplicationNameAssignHook = NULL;
|
|||
*/
|
||||
static bool FinishedStartupCitusBackend = false;
|
||||
|
||||
char *CitusMainDatabase = "postgres";
|
||||
|
||||
static object_access_hook_type PrevObjectAccessHook = NULL;
|
||||
|
||||
#if PG_VERSION_NUM >= PG_VERSION_15
|
||||
|
|
|
@ -40,6 +40,7 @@ typedef enum
|
|||
extern PropSetCmdBehavior PropagateSetCommands;
|
||||
extern bool EnableDDLPropagation;
|
||||
extern int CreateObjectPropagationMode;
|
||||
extern bool EnableCreateDatabasePropagation;
|
||||
extern bool EnableCreateTypePropagation;
|
||||
extern bool EnableCreateRolePropagation;
|
||||
extern bool EnableAlterRolePropagation;
|
||||
|
|
|
@ -247,6 +247,7 @@ extern Oid DistLocalGroupIdRelationId(void);
|
|||
extern Oid DistObjectRelationId(void);
|
||||
extern Oid DistEnabledCustomAggregatesId(void);
|
||||
extern Oid DistTenantSchemaRelationId(void);
|
||||
extern Oid DatabaseShardRelationId(void);
|
||||
|
||||
/* index oids */
|
||||
extern Oid DistNodeNodeIdIndexId(void);
|
||||
|
@ -271,6 +272,7 @@ extern Oid DistObjectPrimaryKeyIndexId(void);
|
|||
extern Oid DistCleanupPrimaryKeyIndexId(void);
|
||||
extern Oid DistTenantSchemaPrimaryKeyIndexId(void);
|
||||
extern Oid DistTenantSchemaUniqueColocationIdIndexId(void);
|
||||
extern Oid DatabaseShardPrimaryKeyIndexId(void);
|
||||
|
||||
/* sequence oids */
|
||||
extern Oid DistBackgroundJobJobIdSequenceId(void);
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#define MAX_SHARD_COUNT 64000
|
||||
#define MAX_SHARD_REPLICATION_FACTOR 100
|
||||
|
||||
extern char *CitusMainDatabase;
|
||||
|
||||
extern PGDLLEXPORT ColumnarSupportsIndexAM_type extern_ColumnarSupportsIndexAM;
|
||||
extern PGDLLEXPORT CompressionTypeStr_type extern_CompressionTypeStr;
|
||||
extern PGDLLEXPORT IsColumnarTableAmTable_type extern_IsColumnarTableAmTable;
|
||||
|
|
Loading…
Reference in New Issue