mirror of https://github.com/citusdata/citus.git
Give notice while converting table type
parent
ff003bccd8
commit
3b8fc62fc2
|
|
@ -216,6 +216,9 @@ PG_FUNCTION_INFO_V1(alter_distributed_table);
|
||||||
PG_FUNCTION_INFO_V1(alter_table_set_access_method);
|
PG_FUNCTION_INFO_V1(alter_table_set_access_method);
|
||||||
PG_FUNCTION_INFO_V1(worker_change_sequence_dependency);
|
PG_FUNCTION_INFO_V1(worker_change_sequence_dependency);
|
||||||
|
|
||||||
|
/* global variable keeping track of whether we are in a table type conversion function */
|
||||||
|
bool InTableTypeConversionFunctionCall = false;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* undistribute_table gets a distributed table name and
|
* undistribute_table gets a distributed table name and
|
||||||
|
|
@ -504,10 +507,16 @@ AlterTableSetAccessMethod(TableConversionParameters *params)
|
||||||
*
|
*
|
||||||
* The function returns a TableConversionReturn object that can stores variables that
|
* The function returns a TableConversionReturn object that can stores variables that
|
||||||
* can be used at the caller operations.
|
* can be used at the caller operations.
|
||||||
|
*
|
||||||
|
* To be able to provide more meaningful messages while converting a table type,
|
||||||
|
* Citus keeps InTableTypeConversionFunctionCall flag. Don't forget to set it properly
|
||||||
|
* in case you add a new way to return from this function.
|
||||||
*/
|
*/
|
||||||
TableConversionReturn *
|
TableConversionReturn *
|
||||||
ConvertTable(TableConversionState *con)
|
ConvertTable(TableConversionState *con)
|
||||||
{
|
{
|
||||||
|
InTableTypeConversionFunctionCall = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We undistribute citus local tables that are not chained with any reference
|
* We undistribute citus local tables that are not chained with any reference
|
||||||
* tables via foreign keys at the end of the utility hook.
|
* tables via foreign keys at the end of the utility hook.
|
||||||
|
|
@ -536,6 +545,7 @@ ConvertTable(TableConversionState *con)
|
||||||
* subgraph including itself, so return here.
|
* subgraph including itself, so return here.
|
||||||
*/
|
*/
|
||||||
SetLocalEnableLocalReferenceForeignKeys(oldEnableLocalReferenceForeignKeys);
|
SetLocalEnableLocalReferenceForeignKeys(oldEnableLocalReferenceForeignKeys);
|
||||||
|
InTableTypeConversionFunctionCall = false;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
char *newAccessMethod = con->accessMethod ? con->accessMethod :
|
char *newAccessMethod = con->accessMethod ? con->accessMethod :
|
||||||
|
|
@ -820,6 +830,7 @@ ConvertTable(TableConversionState *con)
|
||||||
|
|
||||||
SetLocalEnableLocalReferenceForeignKeys(oldEnableLocalReferenceForeignKeys);
|
SetLocalEnableLocalReferenceForeignKeys(oldEnableLocalReferenceForeignKeys);
|
||||||
|
|
||||||
|
InTableTypeConversionFunctionCall = false;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,16 @@ PostprocessViewStmt(Node *node, const char *queryString)
|
||||||
return NIL;
|
return NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Since Citus drops and recreates views while converting a table type, giving a
|
||||||
|
* NOTICE message is enough if the process in table type conversion function call
|
||||||
|
*/
|
||||||
|
if (InTableTypeConversionFunctionCall)
|
||||||
|
{
|
||||||
|
RaiseDeferredError(errMsg, NOTICE);
|
||||||
|
return NIL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the view is already distributed, we should provide an error to not have
|
* If the view is already distributed, we should provide an error to not have
|
||||||
* different definition of view on coordinator and worker nodes. If the view
|
* different definition of view on coordinator and worker nodes. If the view
|
||||||
|
|
|
||||||
|
|
@ -556,6 +556,7 @@ ResetGlobalVariables()
|
||||||
TransactionModifiedNodeMetadata = false;
|
TransactionModifiedNodeMetadata = false;
|
||||||
NodeMetadataSyncOnCommit = false;
|
NodeMetadataSyncOnCommit = false;
|
||||||
InTopLevelDelegatedFunctionCall = false;
|
InTopLevelDelegatedFunctionCall = false;
|
||||||
|
InTableTypeConversionFunctionCall = false;
|
||||||
ResetWorkerErrorIndication();
|
ResetWorkerErrorIndication();
|
||||||
memset(&AllowedDistributionColumnValue, 0,
|
memset(&AllowedDistributionColumnValue, 0,
|
||||||
sizeof(AllowedDistributionColumn));
|
sizeof(AllowedDistributionColumn));
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,12 @@
|
||||||
|
|
||||||
#define SHARD_SIZES_COLUMN_COUNT (3)
|
#define SHARD_SIZES_COLUMN_COUNT (3)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flag to keep track of whether the process is currently in a function converting the
|
||||||
|
* type of the table.
|
||||||
|
*/
|
||||||
|
extern bool InTableTypeConversionFunctionCall;
|
||||||
|
|
||||||
/* In-memory representation of a typed tuple in pg_dist_shard. */
|
/* In-memory representation of a typed tuple in pg_dist_shard. */
|
||||||
typedef struct ShardInterval
|
typedef struct ShardInterval
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -607,7 +607,7 @@ DETAIL: drop cascades to materialized view m_local
|
||||||
drop cascades to view v_local
|
drop cascades to view v_local
|
||||||
CONTEXT: SQL statement "DROP TABLE alter_table_set_access_method.local CASCADE"
|
CONTEXT: SQL statement "DROP TABLE alter_table_set_access_method.local CASCADE"
|
||||||
NOTICE: renaming the new table to alter_table_set_access_method.local
|
NOTICE: renaming the new table to alter_table_set_access_method.local
|
||||||
WARNING: "view v_local" has dependency to "table local" that is not in Citus' metadata
|
NOTICE: "view v_local" has dependency to "table local" that is not in Citus' metadata
|
||||||
DETAIL: "view v_local" will be created only locally
|
DETAIL: "view v_local" will be created only locally
|
||||||
HINT: Distribute "table local" first to distribute "view v_local"
|
HINT: Distribute "table local" first to distribute "view v_local"
|
||||||
CONTEXT: SQL statement "CREATE VIEW alter_table_set_access_method.v_local AS SELECT local.a,
|
CONTEXT: SQL statement "CREATE VIEW alter_table_set_access_method.v_local AS SELECT local.a,
|
||||||
|
|
@ -670,7 +670,7 @@ DETAIL: drop cascades to materialized view m_local
|
||||||
drop cascades to view v_local
|
drop cascades to view v_local
|
||||||
CONTEXT: SQL statement "DROP TABLE alter_table_set_access_method.local CASCADE"
|
CONTEXT: SQL statement "DROP TABLE alter_table_set_access_method.local CASCADE"
|
||||||
NOTICE: renaming the new table to alter_table_set_access_method.local
|
NOTICE: renaming the new table to alter_table_set_access_method.local
|
||||||
WARNING: "view v_local" has dependency to "table local" that is not in Citus' metadata
|
NOTICE: "view v_local" has dependency to "table local" that is not in Citus' metadata
|
||||||
DETAIL: "view v_local" will be created only locally
|
DETAIL: "view v_local" will be created only locally
|
||||||
HINT: Distribute "table local" first to distribute "view v_local"
|
HINT: Distribute "table local" first to distribute "view v_local"
|
||||||
CONTEXT: SQL statement "CREATE VIEW alter_table_set_access_method.v_local AS SELECT local.a,
|
CONTEXT: SQL statement "CREATE VIEW alter_table_set_access_method.v_local AS SELECT local.a,
|
||||||
|
|
|
||||||
|
|
@ -340,19 +340,19 @@ drop cascades to view undis_view2
|
||||||
drop cascades to view another_schema.undis_view3
|
drop cascades to view another_schema.undis_view3
|
||||||
CONTEXT: SQL statement "DROP TABLE undistribute_table.view_table CASCADE"
|
CONTEXT: SQL statement "DROP TABLE undistribute_table.view_table CASCADE"
|
||||||
NOTICE: renaming the new table to undistribute_table.view_table
|
NOTICE: renaming the new table to undistribute_table.view_table
|
||||||
WARNING: "view undis_view1" has dependency to "table view_table" that is not in Citus' metadata
|
NOTICE: "view undis_view1" has dependency to "table view_table" that is not in Citus' metadata
|
||||||
DETAIL: "view undis_view1" will be created only locally
|
DETAIL: "view undis_view1" will be created only locally
|
||||||
HINT: Distribute "table view_table" first to distribute "view undis_view1"
|
HINT: Distribute "table view_table" first to distribute "view undis_view1"
|
||||||
CONTEXT: SQL statement "CREATE VIEW undistribute_table.undis_view1 AS SELECT view_table.a,
|
CONTEXT: SQL statement "CREATE VIEW undistribute_table.undis_view1 AS SELECT view_table.a,
|
||||||
view_table.b
|
view_table.b
|
||||||
FROM view_table;"
|
FROM view_table;"
|
||||||
WARNING: "view undis_view2" has dependency to "table view_table" that is not in Citus' metadata
|
NOTICE: "view undis_view2" has dependency to "table view_table" that is not in Citus' metadata
|
||||||
DETAIL: "view undis_view2" will be created only locally
|
DETAIL: "view undis_view2" will be created only locally
|
||||||
HINT: Distribute "table view_table" first to distribute "view undis_view2"
|
HINT: Distribute "table view_table" first to distribute "view undis_view2"
|
||||||
CONTEXT: SQL statement "CREATE VIEW undistribute_table.undis_view2 AS SELECT view_table.a,
|
CONTEXT: SQL statement "CREATE VIEW undistribute_table.undis_view2 AS SELECT view_table.a,
|
||||||
view_table.c
|
view_table.c
|
||||||
FROM view_table;"
|
FROM view_table;"
|
||||||
WARNING: "view another_schema.undis_view3" has dependency to "table view_table" that is not in Citus' metadata
|
NOTICE: "view another_schema.undis_view3" has dependency to "table view_table" that is not in Citus' metadata
|
||||||
DETAIL: "view another_schema.undis_view3" will be created only locally
|
DETAIL: "view another_schema.undis_view3" will be created only locally
|
||||||
HINT: Distribute "table view_table" first to distribute "view another_schema.undis_view3"
|
HINT: Distribute "table view_table" first to distribute "view another_schema.undis_view3"
|
||||||
CONTEXT: SQL statement "CREATE VIEW another_schema.undis_view3 AS SELECT undis_view1.b,
|
CONTEXT: SQL statement "CREATE VIEW another_schema.undis_view3 AS SELECT undis_view1.b,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue