-
Notifications
You must be signed in to change notification settings - Fork 162
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
Add trace log while dropping the messages. #1607
Conversation
Signed-off-by: ChenYing Kuo <[email protected]>
PR missing one of the required labels: {'new feature', 'dependencies', 'internal', 'enhancement', 'breaking-change', 'bug', 'documentation'} |
Signed-off-by: ChenYing Kuo <[email protected]>
@@ -235,6 +235,10 @@ impl StageIn { | |||
// Still no available batch. | |||
// Restore the sequence number and drop the message | |||
$($restore_sn)? | |||
tracing::trace!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for catching it only now, but in case $restore_sn
returns early, the log will not be printed but the message will still be dropped. What about moving the log before $restore_sn
? Please double check what is actually executed in the $restore_sn
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I will double check that, although the return value is bool and I don't think it can be returned earlier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, then I'm a bit confused about the $($restore_sn)?
syntax. What is ?
? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means the code is optional. It will be added if the macro has the argument $restore_sn
For example, https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=07557c8c874e8944528c3f030c7f96dc
In our case, $($restore_sn)?
will become tch.sn.set(sn).unwrap()
according to
batch = zgetbatch_rets!(tch.sn.set(sn).unwrap()); |
And will become empty when it comes to
let mut batch = zgetbatch_rets!(); |
BTW, I just learned that we can easily get expanded macro with rust-analyzer in vscode
https://stackoverflow.com/a/71454821/22130710
Learn something new each day 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!
It will be convenient to debug if there is a trace log while dropping the messages