mirror of https://github.com/citusdata/citus.git
Merge branch 'users/paragjain/mergeWriteFix' of https://github.com/paragikjain/citus into users/paragjain/mergeWriteFix
commit
5318c40a4b
|
@ -3,5 +3,5 @@
|
|||
\pset border 2
|
||||
\setenv PAGER 'pspg --no-mouse -bX --no-commandbar --no-topbar'
|
||||
\set HISTSIZE 100000
|
||||
\set PROMPT1 '\n%[%033[1m%]%M %n@%/:%>-%p%R%[%033[0m%]%# '
|
||||
\set PROMPT1 '\n%[%033[1m%]%M %n@%/:%> (PID: %p)%R%[%033[0m%]%# '
|
||||
\set PROMPT2 ' '
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
### citus v12.1.5 (July 17, 2024) ###
|
||||
|
||||
* Adds support for MERGE commands with single shard distributed target tables
|
||||
(#7643)
|
||||
|
||||
* Fixes an error with MERGE commands when insert value does not have source
|
||||
distribution column (#7627)
|
||||
|
||||
### citus v12.1.4 (May 28, 2024) ###
|
||||
|
||||
* Adds null check for node in HasRangeTableRef (#7604)
|
||||
|
|
|
@ -35,6 +35,28 @@ To get citus installed from source we run `make install -s` in the first termina
|
|||
|
||||
With the Citus cluster running you can connect to the coordinator in the first terminal via `psql -p9700`. Because the coordinator is the most common entrypoint the `PGPORT` environment is set accordingly, so a simple `psql` will connect directly to the coordinator.
|
||||
|
||||
### Debugging in the VS code
|
||||
|
||||
1. Start Debugging: Press F5 in VS Code to start debugging. When prompted, you'll need to attach the debugger to the appropriate PostgreSQL process.
|
||||
|
||||
2. Identify the Process: If you're running a psql command, take note of the PID that appears in your psql prompt. For example:
|
||||
```
|
||||
[local] citus@citus:9700 (PID: 5436)=#
|
||||
```
|
||||
This PID (5436 in this case) indicates the process that you should attach the debugger to.
|
||||
If you are uncertain about which process to attach, you can list all running PostgreSQL processes using the following command:
|
||||
```
|
||||
ps aux | grep postgres
|
||||
```
|
||||
|
||||
Look for the process associated with the PID you noted. For example:
|
||||
```
|
||||
citus 5436 0.0 0.0 0 0 ? S 14:00 0:00 postgres: citus citus
|
||||
```
|
||||
4. Attach the Debugger: Once you've identified the correct PID, select that process when prompted in VS Code to attach the debugger. You should now be able to debug the PostgreSQL session tied to the psql command.
|
||||
|
||||
5. Set Breakpoints and Debug: With the debugger attached, you can set breakpoints within the code. This allows you to step through the code execution, inspect variables, and fully debug the PostgreSQL instance running in your container.
|
||||
|
||||
### Getting and building
|
||||
|
||||
[PostgreSQL documentation](https://www.postgresql.org/support/versioning/) has a
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 3376bd6845f0614908ed304f5033bd644c82d3bf
|
|
@ -217,6 +217,9 @@ citus_set_coordinator_host(PG_FUNCTION_ARGS)
|
|||
EnsureTransactionalMetadataSyncMode();
|
||||
}
|
||||
|
||||
/* prevent concurrent modification */
|
||||
LockRelationOid(DistNodeRelationId(), RowExclusiveLock);
|
||||
|
||||
bool isCoordinatorInMetadata = false;
|
||||
WorkerNode *coordinatorNode = PrimaryNodeForGroup(COORDINATOR_GROUP_ID,
|
||||
&isCoordinatorInMetadata);
|
||||
|
|
|
@ -4753,22 +4753,35 @@ WorkerLimitCount(Node *limitCount, Node *limitOffset, OrderByLimitReference
|
|||
if (workerLimitNode != NULL && limitOffset != NULL)
|
||||
{
|
||||
Const *workerLimitConst = (Const *) workerLimitNode;
|
||||
Const *workerOffsetConst = (Const *) limitOffset;
|
||||
int64 workerLimitCount = DatumGetInt64(workerLimitConst->constvalue);
|
||||
int64 workerOffsetCount = DatumGetInt64(workerOffsetConst->constvalue);
|
||||
|
||||
workerLimitCount = workerLimitCount + workerOffsetCount;
|
||||
workerLimitNode = (Node *) MakeIntegerConstInt64(workerLimitCount);
|
||||
/* Only update the worker limit if the const is not null.*/
|
||||
if (!workerLimitConst->constisnull)
|
||||
{
|
||||
Const *workerOffsetConst = (Const *) limitOffset;
|
||||
int64 workerLimitCount = DatumGetInt64(workerLimitConst->constvalue);
|
||||
|
||||
/* If the offset is null, it defaults to 0 when cast to int64. */
|
||||
int64 workerOffsetCount = DatumGetInt64(workerOffsetConst->constvalue);
|
||||
workerLimitCount = workerLimitCount + workerOffsetCount;
|
||||
workerLimitNode = (Node *) MakeIntegerConstInt64(workerLimitCount);
|
||||
}
|
||||
}
|
||||
|
||||
/* display debug message on limit push down */
|
||||
if (workerLimitNode != NULL)
|
||||
{
|
||||
Const *workerLimitConst = (Const *) workerLimitNode;
|
||||
int64 workerLimitCount = DatumGetInt64(workerLimitConst->constvalue);
|
||||
if (!workerLimitConst->constisnull)
|
||||
{
|
||||
int64 workerLimitCount = DatumGetInt64(workerLimitConst->constvalue);
|
||||
|
||||
ereport(DEBUG1, (errmsg("push down of limit count: " INT64_FORMAT,
|
||||
workerLimitCount)));
|
||||
ereport(DEBUG1, (errmsg("push down of limit count: " INT64_FORMAT,
|
||||
workerLimitCount)));
|
||||
}
|
||||
else
|
||||
{
|
||||
ereport(DEBUG1, (errmsg("push down of limit count: ALL")));
|
||||
}
|
||||
}
|
||||
|
||||
return workerLimitNode;
|
||||
|
|
|
@ -521,6 +521,86 @@ SELECT
|
|||
1 | 1
|
||||
(1 row)
|
||||
|
||||
-- check if we can correctly push the limit when it is null
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey LIMIT null;
|
||||
DEBUG: push down of limit count: ALL
|
||||
l_orderkey
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
2
|
||||
(7 rows)
|
||||
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey OFFSET 1 LIMIT null;
|
||||
DEBUG: push down of limit count: ALL
|
||||
l_orderkey
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
2
|
||||
(6 rows)
|
||||
|
||||
SELECT count(*) FROM lineitem LIMIT null;
|
||||
DEBUG: push down of limit count: ALL
|
||||
count
|
||||
---------------------------------------------------------------------
|
||||
12000
|
||||
(1 row)
|
||||
|
||||
SELECT count(*) FROM lineitem OFFSET 0 LIMIT null;
|
||||
DEBUG: push down of limit count: ALL
|
||||
count
|
||||
---------------------------------------------------------------------
|
||||
12000
|
||||
(1 row)
|
||||
|
||||
-- check if we push the right limit when both offset and limit are given
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey OFFSET 1 LIMIT 3;
|
||||
DEBUG: push down of limit count: 4
|
||||
l_orderkey
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
1
|
||||
1
|
||||
(3 rows)
|
||||
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey OFFSET null LIMIT 1;
|
||||
DEBUG: push down of limit count: 1
|
||||
l_orderkey
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
(1 row)
|
||||
|
||||
-- check if we can correctly push the limit when it is all
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 2 LIMIT all;
|
||||
DEBUG: push down of limit count: ALL
|
||||
l_orderkey
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
(6 rows)
|
||||
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 2 OFFSET 2 LIMIT all;
|
||||
DEBUG: push down of limit count: ALL
|
||||
l_orderkey
|
||||
---------------------------------------------------------------------
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
(4 rows)
|
||||
|
||||
SET client_min_messages TO NOTICE;
|
||||
-- non constants should not push down
|
||||
CREATE OR REPLACE FUNCTION my_limit()
|
||||
|
|
|
@ -222,6 +222,25 @@ SELECT
|
|||
ORDER BY 2 DESC, 1
|
||||
LIMIT 5;
|
||||
|
||||
-- check if we can correctly push the limit when it is null
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey LIMIT null;
|
||||
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey OFFSET 1 LIMIT null;
|
||||
|
||||
SELECT count(*) FROM lineitem LIMIT null;
|
||||
|
||||
SELECT count(*) FROM lineitem OFFSET 0 LIMIT null;
|
||||
|
||||
-- check if we push the right limit when both offset and limit are given
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey OFFSET 1 LIMIT 3;
|
||||
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 3 ORDER BY l_orderkey OFFSET null LIMIT 1;
|
||||
|
||||
-- check if we can correctly push the limit when it is all
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 2 LIMIT all;
|
||||
|
||||
SELECT l_orderkey FROM lineitem WHERE l_orderkey < 2 OFFSET 2 LIMIT all;
|
||||
|
||||
SET client_min_messages TO NOTICE;
|
||||
|
||||
-- non constants should not push down
|
||||
|
|
Loading…
Reference in New Issue