Skip to content

Commit

Permalink
fix: update disjointset index preset
Browse files Browse the repository at this point in the history
  • Loading branch information
taloric authored and sharang committed Oct 31, 2024
1 parent 234374d commit e568b66
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/app/application/l7_flow_tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1725,8 +1725,8 @@ def split_to_multiple_process_span_set(self) -> list:

# 构建一个并查集,将 spans 按 root 划分成多个子树
disjoint_set = DisjointSet()
# 避免 parent_index out of range
disjoint_set.disjoint_set = [-1] * max_flow_index
# 这里会跳索引,不是连续顺序,避免 index out of range,预分配大小
disjoint_set.disjoint_set = [-1] * (max_flow_index + 1)
for i in range(len(self.spans)):
parent_span_index = flow_index_to_span_index.get(
self.spans[i].get_parent_id(), -1)
Expand Down Expand Up @@ -2336,7 +2336,7 @@ def _union_sys_spans(

# 对 client_sys_spans 按 syscall_trace_id 划分为一个个集合
cp_disjoint_set = DisjointSet()
cp_disjoint_set.disjoint_set = [-1] * len(client_sys_spans)
cp_disjoint_set.disjoint_set = [-1] * (len(client_sys_spans) + 1)
for i in range(len(client_sys_spans)):
span = client_sys_spans[i]
if span.get_syscall_trace_id_response() > 0:
Expand Down

0 comments on commit e568b66

Please sign in to comment.