mirror of https://github.com/citusdata/citus.git
Remove source node argument from dump_local_wait_edges
parent
a67d10957f
commit
641420d79f
|
@ -11,7 +11,7 @@ EXTVERSIONS = 5.0 5.0-1 5.0-2 \
|
|||
6.0-1 6.0-2 6.0-3 6.0-4 6.0-5 6.0-6 6.0-7 6.0-8 6.0-9 6.0-10 6.0-11 6.0-12 6.0-13 6.0-14 6.0-15 6.0-16 6.0-17 6.0-18 \
|
||||
6.1-1 6.1-2 6.1-3 6.1-4 6.1-5 6.1-6 6.1-7 6.1-8 6.1-9 6.1-10 6.1-11 6.1-12 6.1-13 6.1-14 6.1-15 6.1-16 6.1-17 \
|
||||
6.2-1 6.2-2 6.2-3 6.2-4 \
|
||||
7.0-1 7.0-2 7.0-3 7.0-4 7.0-5 7.0-6 7.0-7 7.0-8 7.0-9 7.0-10 7.0-11 7.0-12 7.0-13 7.0-14
|
||||
7.0-1 7.0-2 7.0-3 7.0-4 7.0-5 7.0-6 7.0-7 7.0-8 7.0-9 7.0-10 7.0-11 7.0-12 7.0-13 7.0-14 7.0-15
|
||||
|
||||
# All citus--*.sql files in the source directory
|
||||
DATA = $(patsubst $(citus_abs_srcdir)/%.sql,%.sql,$(wildcard $(citus_abs_srcdir)/$(EXTENSION)--*--*.sql))
|
||||
|
@ -167,6 +167,8 @@ $(EXTENSION)--7.0-13.sql: $(EXTENSION)--7.0-12.sql $(EXTENSION)--7.0-12--7.0-13.
|
|||
cat $^ > $@
|
||||
$(EXTENSION)--7.0-14.sql: $(EXTENSION)--7.0-13.sql $(EXTENSION)--7.0-13--7.0-14.sql
|
||||
cat $^ > $@
|
||||
$(EXTENSION)--7.0-15.sql: $(EXTENSION)--7.0-14.sql $(EXTENSION)--7.0-14--7.0-15.sql
|
||||
cat $^ > $@
|
||||
|
||||
NO_PGXS = 1
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/* citus--7.0-14--7.0-15 */
|
||||
|
||||
DROP FUNCTION pg_catalog.dump_local_wait_edges(int4);
|
||||
|
||||
CREATE FUNCTION pg_catalog.dump_local_wait_edges(
|
||||
OUT waiting_pid int4,
|
||||
OUT waiting_node_id int4,
|
||||
OUT waiting_transaction_num int8,
|
||||
OUT waiting_transaction_stamp timestamptz,
|
||||
OUT blocking_pid int4,
|
||||
OUT blocking_node_id int4,
|
||||
OUT blocking_transaction_num int8,
|
||||
OUT blocking_transaction_stamp timestamptz,
|
||||
OUT blocking_transaction_waiting bool)
|
||||
RETURNS SETOF RECORD
|
||||
LANGUAGE C STRICT
|
||||
AS $$MODULE_PATHNAME$$, $$dump_local_wait_edges$$;
|
||||
COMMENT ON FUNCTION pg_catalog.dump_local_wait_edges()
|
||||
IS 'returns all local lock wait chains, that start from distributed transactions';
|
|
@ -1,6 +1,6 @@
|
|||
# Citus extension
|
||||
comment = 'Citus distributed database'
|
||||
default_version = '7.0-14'
|
||||
default_version = '7.0-15'
|
||||
module_pathname = '$libdir/citus'
|
||||
relocatable = false
|
||||
schema = pg_catalog
|
||||
|
|
|
@ -48,7 +48,7 @@ static int64 ParseIntField(PGresult *result, int rowIndex, int colIndex);
|
|||
static bool ParseBoolField(PGresult *result, int rowIndex, int colIndex);
|
||||
static TimestampTz ParseTimestampTzField(PGresult *result, int rowIndex, int colIndex);
|
||||
static void ReturnWaitGraph(WaitGraph *waitGraph, FunctionCallInfo fcinfo);
|
||||
static WaitGraph * BuildWaitGraphForSourceNode(int sourceNodeId);
|
||||
static WaitGraph * BuildLocalWaitGraph(void);
|
||||
static void LockLockData(void);
|
||||
static void UnlockLockData(void);
|
||||
static void AddEdgesForLockWaits(WaitGraph *waitGraph, PGPROC *waitingProc,
|
||||
|
@ -99,7 +99,7 @@ BuildGlobalWaitGraph(void)
|
|||
ListCell *connectionCell = NULL;
|
||||
int localNodeId = GetLocalGroupId();
|
||||
|
||||
WaitGraph *waitGraph = BuildWaitGraphForSourceNode(localNodeId);
|
||||
WaitGraph *waitGraph = BuildLocalWaitGraph();
|
||||
|
||||
/* open connections in parallel */
|
||||
foreach(workerNodeCell, workerNodeList)
|
||||
|
@ -129,14 +129,9 @@ BuildGlobalWaitGraph(void)
|
|||
{
|
||||
MultiConnection *connection = (MultiConnection *) lfirst(connectionCell);
|
||||
int querySent = false;
|
||||
char *command = NULL;
|
||||
const char *params[1];
|
||||
const char *command = "SELECT * FROM dump_local_wait_edges()";
|
||||
|
||||
params[0] = psprintf("%d", GetLocalGroupId());
|
||||
command = "SELECT * FROM dump_local_wait_edges($1)";
|
||||
|
||||
querySent = SendRemoteCommandParams(connection, command, 1,
|
||||
NULL, params);
|
||||
querySent = SendRemoteCommand(connection, command);
|
||||
if (querySent == 0)
|
||||
{
|
||||
ReportConnectionError(connection, ERROR);
|
||||
|
@ -277,9 +272,7 @@ ParseTimestampTzField(PGresult *result, int rowIndex, int colIndex)
|
|||
Datum
|
||||
dump_local_wait_edges(PG_FUNCTION_ARGS)
|
||||
{
|
||||
int32 sourceNodeId = PG_GETARG_INT32(0);
|
||||
|
||||
WaitGraph *waitGraph = BuildWaitGraphForSourceNode(sourceNodeId);
|
||||
WaitGraph *waitGraph = BuildLocalWaitGraph();
|
||||
ReturnWaitGraph(waitGraph, fcinfo);
|
||||
|
||||
return (Datum) 0;
|
||||
|
@ -387,11 +380,11 @@ ReturnWaitGraph(WaitGraph *waitGraph, FunctionCallInfo fcinfo)
|
|||
|
||||
|
||||
/*
|
||||
* BuildWaitGraphForSourceNode builds a wait graph for distributed transactions
|
||||
* that originate from the given source node.
|
||||
* BuildLocalWaitGraph builds a wait graph for distributed transactions
|
||||
* that originate from the local node.
|
||||
*/
|
||||
static WaitGraph *
|
||||
BuildWaitGraphForSourceNode(int sourceNodeId)
|
||||
BuildLocalWaitGraph(void)
|
||||
{
|
||||
WaitGraph *waitGraph = NULL;
|
||||
int curBackend = 0;
|
||||
|
@ -417,7 +410,7 @@ BuildWaitGraphForSourceNode(int sourceNodeId)
|
|||
|
||||
/*
|
||||
* Build lock-graph. We do so by first finding all procs which we are
|
||||
* interested in (originating on our source system, and blocked). Once
|
||||
* interested in (in a distributed transaction, and blocked). Once
|
||||
* those are collected, do depth first search over all procs blocking
|
||||
* those.
|
||||
*/
|
||||
|
@ -437,12 +430,11 @@ BuildWaitGraphForSourceNode(int sourceNodeId)
|
|||
GetBackendDataForProc(currentProc, ¤tBackendData);
|
||||
|
||||
/*
|
||||
* Only start searching from distributed transactions originating on the source
|
||||
* node. Other deadlocks may exist, but the source node can only resolve those
|
||||
* that involve its own transactions.
|
||||
* Only start searching from distributed transactions, since we only
|
||||
* care about distributed transactions for the purpose of distributed
|
||||
* deadlock detection.
|
||||
*/
|
||||
if (sourceNodeId != currentBackendData.transactionId.initiatorNodeIdentifier ||
|
||||
!IsInDistributedTransaction(¤tBackendData))
|
||||
if (!IsInDistributedTransaction(¤tBackendData))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,11 @@ step detector-dump-wait-edges:
|
|||
blocking_transaction_num,
|
||||
blocking_transaction_waiting
|
||||
FROM
|
||||
dump_local_wait_edges(13);
|
||||
dump_local_wait_edges()
|
||||
ORDER BY
|
||||
waiting_node_id,
|
||||
blocking_transaction_num,
|
||||
blocking_transaction_waiting;
|
||||
|
||||
waiting_node_idwaiting_transaction_numblocking_node_idblocking_transaction_numblocking_transaction_waiting
|
||||
|
||||
|
@ -67,7 +71,11 @@ step detector-dump-wait-edges:
|
|||
blocking_transaction_num,
|
||||
blocking_transaction_waiting
|
||||
FROM
|
||||
dump_local_wait_edges(13);
|
||||
dump_local_wait_edges()
|
||||
ORDER BY
|
||||
waiting_node_id,
|
||||
blocking_transaction_num,
|
||||
blocking_transaction_waiting;
|
||||
|
||||
waiting_node_idwaiting_transaction_numblocking_node_idblocking_transaction_numblocking_transaction_waiting
|
||||
|
||||
|
@ -115,12 +123,16 @@ step detector-dump-wait-edges:
|
|||
blocking_transaction_num,
|
||||
blocking_transaction_waiting
|
||||
FROM
|
||||
dump_local_wait_edges(13);
|
||||
dump_local_wait_edges()
|
||||
ORDER BY
|
||||
waiting_node_id,
|
||||
blocking_transaction_num,
|
||||
blocking_transaction_waiting;
|
||||
|
||||
waiting_node_idwaiting_transaction_numblocking_node_idblocking_transaction_numblocking_transaction_waiting
|
||||
|
||||
13 1 0 t
|
||||
0 11 1 f
|
||||
13 1 0 t
|
||||
step dist11-abort:
|
||||
ABORT;
|
||||
|
||||
|
|
|
@ -124,6 +124,7 @@ ALTER EXTENSION citus UPDATE TO '7.0-11';
|
|||
ALTER EXTENSION citus UPDATE TO '7.0-12';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-13';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-14';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-15';
|
||||
-- show running version
|
||||
SHOW citus.version;
|
||||
citus.version
|
||||
|
|
|
@ -20,7 +20,8 @@ test: isolation_concurrent_dml isolation_data_migration
|
|||
test: isolation_drop_shards isolation_copy_placement_vs_modification
|
||||
test: isolation_insert_vs_vacuum isolation_transaction_recovery
|
||||
test: isolation_distributed_transaction_id isolation_progress_monitoring
|
||||
test: isolation_dump_local_wait_edges isolation_dump_global_wait_edges
|
||||
test: isolation_dump_local_wait_edges
|
||||
test: isolation_dump_global_wait_edges
|
||||
|
||||
test: isolation_replace_wait_function
|
||||
test: isolation_distributed_deadlock_detection
|
||||
|
|
|
@ -74,7 +74,11 @@ step "detector-dump-wait-edges"
|
|||
blocking_transaction_num,
|
||||
blocking_transaction_waiting
|
||||
FROM
|
||||
dump_local_wait_edges(13);
|
||||
dump_local_wait_edges()
|
||||
ORDER BY
|
||||
waiting_node_id,
|
||||
blocking_transaction_num,
|
||||
blocking_transaction_waiting;
|
||||
}
|
||||
|
||||
# Distributed transaction blocked by another distributed transaction
|
||||
|
|
|
@ -124,6 +124,7 @@ ALTER EXTENSION citus UPDATE TO '7.0-11';
|
|||
ALTER EXTENSION citus UPDATE TO '7.0-12';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-13';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-14';
|
||||
ALTER EXTENSION citus UPDATE TO '7.0-15';
|
||||
|
||||
-- show running version
|
||||
SHOW citus.version;
|
||||
|
|
Loading…
Reference in New Issue