Closed euloh closed 1 year ago
With DTv1, aggregations were accumulated in user space. Each printa() would read buffers and add them to the already fetched data.
With DTv2, aggregations are accumulated by the kernel in BPF maps. Each printa() reads the BPF map afresh. It should not add newly read data to older data.
Actually, even just multiple printa() actions are enough to demonstrate the problem.
BEGIN {
@a = sum(1);
@b = count();
@c = sum(1);
printa(@a);
printa(@b);
printa(@c);
exit(0)
}
This should print 1, 1, 1, as it does with DTv1, but it prints 1, 2, 3 with DTv2. This was causing tst.llquantize_basic.d to fail.
Verified as fixed.
Consider:
One sees the anticipated behavior -- "1" printed three times -- with DTv1. In contrast, with DTv2, the output is
Or, consider
We would expect the aggregation to increase from 1 to 5, with it being printed five times along the way. The difference is the timing, and output can depend on buffering, aggregation rate, and so on. With DTv1, we observe
("fast" firing rate) and
("slow" firing rate) respectively, both reasonable results. In contrast, with DTv2, we get