@@ -2165,20 +2165,21 @@ Datum mtm_dump_lock_graph(PG_FUNCTION_ARGS)
21652165 {
21662166 size_t size ;
21672167 char * data = RaftableGet (psprintf ("lock-graph-%d" , i + 1 ), & size , NULL , true);
2168- if (!data ) continue ;
2169- GlobalTransactionId * gtid = (GlobalTransactionId * )data ;
2170- GlobalTransactionId * last = (GlobalTransactionId * )(data + size );
2171- appendStringInfo (s , "node-%d lock graph: " , i + 1 );
2172- while (gtid != last ) {
2173- GlobalTransactionId * src = gtid ++ ;
2174- appendStringInfo (s , "%d:%d -> " , src -> node , src -> xid );
2175- while (gtid -> node != 0 ) {
2176- GlobalTransactionId * dst = gtid ++ ;
2177- appendStringInfo (s , "%d:%d, " , dst -> node , dst -> xid );
2168+ if (data ) {
2169+ GlobalTransactionId * gtid = (GlobalTransactionId * )data ;
2170+ GlobalTransactionId * last = (GlobalTransactionId * )(data + size );
2171+ appendStringInfo (s , "node-%d lock graph: " , i + 1 );
2172+ while (gtid != last ) {
2173+ GlobalTransactionId * src = gtid ++ ;
2174+ appendStringInfo (s , "%d:%d -> " , src -> node , src -> xid );
2175+ while (gtid -> node != 0 ) {
2176+ GlobalTransactionId * dst = gtid ++ ;
2177+ appendStringInfo (s , "%d:%d, " , dst -> node , dst -> xid );
2178+ }
2179+ gtid += 1 ;
21782180 }
2179- gtid += 1 ;
2181+ appendStringInfo ( s , "\n" ) ;
21802182 }
2181- appendStringInfo (s , "\n" );
21822183 }
21832184 return CStringGetTextDatum (s -> data );
21842185}
0 commit comments