-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleting scalar map just zeros out the entry #3498
Comments
Deleting scalar maps has actually been allowed since the very beginning of bpftrace. Here's an old example of a script using it: https://github.com/brendangregg/bpf-perf-tools-book/blob/09f8a3a101fdc23b0e51c33158ea3a1782aea427/originals/Ch14_Kernel/numamove.bt#L36-L37 It was actually #3300 which unintentionally changed this functionality in the current release cycle. That said, I think the new behaviour is reasonable. RE aggregate types: we'll hopefully have support for constructing them in BpfScript soon, which will fix that issue. Another case we don't yet have a solution for is suppressing the printing of scalar map values at the end of a script. The previous solution of:
won't work to stop |
Tagging this with v0.22 for now as the inability to suppress scalar map printing is a breaking change. |
Partial workaround landed in #3547 We'll still want to fix this |
#3611 to revert hash optimization |
What reproduces the bug? Provide code if possible.
This was added in 39f3996 ("Support delete() on count()-based map").
It seemed reasonable at the time, but thinking about this again, not sure
it makes sense. Seems better to just disallow this. What is the user supposed
to expect?
One edge case to consider is if user is storing aggregate type in scalar map.
Eg:
There's no other way for user to synchronously set the value to 0, as they cannot construct an aggregate. But
clear()
and zero()` exist. Unfortunately they're asynchronous.We could only allow
delete()
on aggregate scalar maps, but maybe that's getting too confusing.An alternate acceptable answer is to just do nothing. Maybe things do make sense.
bpftrace --info
outputThe text was updated successfully, but these errors were encountered: