-
Notifications
You must be signed in to change notification settings - Fork 455
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
[m3msg] Specialize messageWriter acker map #4113
Conversation
delete(a.ackMap, meta.metadataKey) | ||
a.Unlock() | ||
a.mtx.Lock() | ||
defer a.mtx.Unlock() |
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.
Not opposed to the defer here but the old way read just as well? Also just for internal consistency within the class--the other methods also don't defer, so could keep it the same here.
Not hugely important though.
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
defer w.RUnlock() | ||
w.m.messageConsumeLatency.Record(time.Duration(w.nowFn().UnixNano() - expectedProcessNanos)) | ||
w.m.messageAcked.Inc(1) | ||
m := w.m |
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.
Hmm w.m
is a pointer--do we not need to keep holding the lock when use it?
I guess w.m.messageConsumeLatency
might be safe.
Dunno maybe we should make the metrics type handle its own locking instead.
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 metrics thing is very awkward, might as well fix it now vs deferring
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.
w.m
is replaced wholesale when consumers are changed (and so are metric labels)
What this PR does / why we need it:
There's no need for shard in metadataKey for internal messageWriter ack map, as it's always the same shard.
Special notes for your reviewer:
Does this PR introduce a user-facing and/or backwards incompatible change?:
Does this PR require updating code package or user-facing documentation?: