Merge pull request #4588 from citusdata/copy_fix_connection

When reaches to pool size, COPY sets the placement access
pull/4596/head^2
Önder Kalacı 2021-01-28 13:08:47 +01:00 committed by GitHub
commit 34ccae8478
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 0 deletions

View File

@ -3583,6 +3583,12 @@ CopyGetPlacementConnection(HTAB *connectionStateHash, ShardPlacement *placement,
nodeName, nodeName,
nodePort); nodePort);
/*
* Make sure that the connection management remembers that Citus
* accesses this placement over the connection.
*/
AssignPlacementListToConnection(list_make1(placementAccess), connection);
return connection; return connection;
} }
@ -3643,6 +3649,12 @@ CopyGetPlacementConnection(HTAB *connectionStateHash, ShardPlacement *placement,
connection = connection =
GetLeastUtilisedCopyConnection(copyConnectionStateList, nodeName, GetLeastUtilisedCopyConnection(copyConnectionStateList, nodeName,
nodePort); nodePort);
/*
* Make sure that the connection management remembers that Citus
* accesses this placement over the connection.
*/
AssignPlacementListToConnection(list_make1(placementAccess), connection);
} }
else else
{ {

View File

@ -1415,6 +1415,18 @@ SELECT * FROM adt_ref ORDER BY 1;
5 5
(2 rows) (2 rows)
-- make sure that COPY (e.g., INSERT .. SELECT) and
-- alter_distributed_table works in the same TX
BEGIN;
SET LOCAL citus.enable_local_execution=OFF;
INSERT INTO adt_table SELECT x, x+1 FROM generate_series(1, 1000) x;
SELECT alter_distributed_table('adt_table', distribution_column:='a');
alter_distributed_table
---------------------------------------------------------------------
(1 row)
ROLLBACK;
BEGIN; BEGIN;
INSERT INTO adt_table SELECT x, x+1 FROM generate_series(1, 1000) x; INSERT INTO adt_table SELECT x, x+1 FROM generate_series(1, 1000) x;
SELECT alter_distributed_table('adt_table', distribution_column:='a'); SELECT alter_distributed_table('adt_table', distribution_column:='a');

View File

@ -737,6 +737,14 @@ SELECT * FROM adt_table ORDER BY 1;
SELECT * FROM adt_col ORDER BY 1; SELECT * FROM adt_col ORDER BY 1;
SELECT * FROM adt_ref ORDER BY 1; SELECT * FROM adt_ref ORDER BY 1;
-- make sure that COPY (e.g., INSERT .. SELECT) and
-- alter_distributed_table works in the same TX
BEGIN;
SET LOCAL citus.enable_local_execution=OFF;
INSERT INTO adt_table SELECT x, x+1 FROM generate_series(1, 1000) x;
SELECT alter_distributed_table('adt_table', distribution_column:='a');
ROLLBACK;
BEGIN; BEGIN;
INSERT INTO adt_table SELECT x, x+1 FROM generate_series(1, 1000) x; INSERT INTO adt_table SELECT x, x+1 FROM generate_series(1, 1000) x;
SELECT alter_distributed_table('adt_table', distribution_column:='a'); SELECT alter_distributed_table('adt_table', distribution_column:='a');