@@ -2165,20 +2165,21 @@ Datum mtm_dump_lock_graph(PG_FUNCTION_ARGS)
2165
2165
{
2166
2166
size_t size ;
2167
2167
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 ;
2178
2180
}
2179
- gtid += 1 ;
2181
+ appendStringInfo ( s , "\n" ) ;
2180
2182
}
2181
- appendStringInfo (s , "\n" );
2182
2183
}
2183
2184
return CStringGetTextDatum (s -> data );
2184
2185
}
0 commit comments