Commit 2da2a08 1 parent bfdf426 commit 2da2a08 Copy full SHA for 2da2a08
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 @@ -1617,8 +1617,8 @@ def split_to_multiple_process_span_set(self) -> list:
1617
1617
1618
1618
# 构建一个并查集,将 spans 按 root 划分成多个子树
1619
1619
disjoint_set = DisjointSet ()
1620
- # 避免 parent_index out of range
1621
- disjoint_set .disjoint_set = [- 1 ] * max_flow_index
1620
+ # 这里会跳索引,不是连续顺序, 避免 index out of range,预分配大小
1621
+ disjoint_set .disjoint_set = [- 1 ] * ( max_flow_index + 1 )
1622
1622
for i in range (len (self .spans )):
1623
1623
parent_span_index = flow_index_to_span_index .get (
1624
1624
self .spans [i ].get_parent_id (), - 1 )
@@ -2168,7 +2168,7 @@ def _union_sys_spans(
2168
2168
2169
2169
# 对 client_sys_spans 按 syscall_trace_id 划分为一个个集合
2170
2170
cp_disjoint_set = DisjointSet ()
2171
- cp_disjoint_set .disjoint_set = [- 1 ] * len (client_sys_spans )
2171
+ cp_disjoint_set .disjoint_set = [- 1 ] * ( len (client_sys_spans ) + 1 )
2172
2172
for i in range (len (client_sys_spans )):
2173
2173
span = client_sys_spans [i ]
2174
2174
if span .get_syscall_trace_id_response () > 0 :
You can’t perform that action at this time.
0 commit comments