Commit e568b66 1 parent 234374d commit e568b66 Copy full SHA for e568b66
File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -1725,8 +1725,8 @@ def split_to_multiple_process_span_set(self) -> list:
1725
1725
1726
1726
# 构建一个并查集,将 spans 按 root 划分成多个子树
1727
1727
disjoint_set = DisjointSet ()
1728
- # 避免 parent_index out of range
1729
- disjoint_set .disjoint_set = [- 1 ] * max_flow_index
1728
+ # 这里会跳索引,不是连续顺序, 避免 index out of range,预分配大小
1729
+ disjoint_set .disjoint_set = [- 1 ] * ( max_flow_index + 1 )
1730
1730
for i in range (len (self .spans )):
1731
1731
parent_span_index = flow_index_to_span_index .get (
1732
1732
self .spans [i ].get_parent_id (), - 1 )
@@ -2336,7 +2336,7 @@ def _union_sys_spans(
2336
2336
2337
2337
# 对 client_sys_spans 按 syscall_trace_id 划分为一个个集合
2338
2338
cp_disjoint_set = DisjointSet ()
2339
- cp_disjoint_set .disjoint_set = [- 1 ] * len (client_sys_spans )
2339
+ cp_disjoint_set .disjoint_set = [- 1 ] * ( len (client_sys_spans ) + 1 )
2340
2340
for i in range (len (client_sys_spans )):
2341
2341
span = client_sys_spans [i ]
2342
2342
if span .get_syscall_trace_id_response () > 0 :
You can’t perform that action at this time.
0 commit comments