Skip to content

Commit 3d31a55

Browse files
committed
Fix: widen MotionLayerState stat counters from uint32 to uint64 (#366)
MotionLayerState accumulates stats across all MotionNodeEntry instances. Per-node entries already use uint64 [0]. The global sum ≥ any individual node, so it overflows first — at 4GB. Fix by widening to uint64. Also fix the debug elog() format specifiers to match. [0] https://github.com/open-gpdb/gpdb/blob/e0db8c33c80117241f88cecca225c9fcd39dd28f/src/include/cdb/cdbinterconnect.h#L498
1 parent 2ea3cfe commit 3d31a55

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/backend/cdb/motion/cdbmotion.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ RemoveMotionLayer(MotionLayerState *mlStates)
129129
/* Emit statistics to log */
130130
if (gp_log_interconnect >= GPVARS_VERBOSITY_VERBOSE)
131131
elog(LOG, "RemoveMotionLayer(): dumping stats\n"
132-
" Sent: %9u chunks %9u total bytes %9u tuple bytes\n"
133-
" Received: %9u chunks %9u total bytes %9u tuple bytes; "
132+
" Sent: %9lu chunks %9lu total bytes %9lu tuple bytes\n"
133+
" Received: %9lu chunks %9lu total bytes %9lu tuple bytes; "
134134
"%9u chunkproc calls\n",
135135
mlStates->stat_total_chunks_sent,
136136
mlStates->stat_total_bytes_sent,

src/include/cdb/cdbinterconnect.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,13 +485,13 @@ typedef struct MotionLayerState
485485
/*
486486
* GLOBAL MOTION-LAYER STATISTICS
487487
*/
488-
uint32 stat_total_chunks_sent; /* Tuple-chunks sent. */
489-
uint32 stat_total_bytes_sent; /* Bytes sent, including headers. */
490-
uint32 stat_tuple_bytes_sent; /* Bytes of pure tuple-data sent. */
488+
uint64 stat_total_chunks_sent; /* Tuple-chunks sent. */
489+
uint64 stat_total_bytes_sent; /* Bytes sent, including headers. */
490+
uint64 stat_tuple_bytes_sent; /* Bytes of pure tuple-data sent. */
491491

492-
uint32 stat_total_chunks_recvd;/* Tuple-chunks received. */
493-
uint32 stat_total_bytes_recvd; /* Bytes received, including headers. */
494-
uint32 stat_tuple_bytes_recvd; /* Bytes of pure tuple-data received. */
492+
uint64 stat_total_chunks_recvd;/* Tuple-chunks received. */
493+
uint64 stat_total_bytes_recvd; /* Bytes received, including headers. */
494+
uint64 stat_tuple_bytes_recvd; /* Bytes of pure tuple-data received. */
495495

496496
uint32 stat_total_chunkproc_calls; /* Calls to processIncomingChunks() */
497497

0 commit comments

Comments
 (0)