Conversation
|
@jipanyang @zhenggen-xu As we offline discussed I submit this PR. Please help review. Thanks for your solution and inspiration. #Closed |
jipanyang
left a comment
There was a problem hiding this comment.
Compared with the existing implementation, changes in this PR optimized the processing of notification at Select() of consumerStateTable side.
We need to confirm if it is good enough to cope with the route flapping case seen previously. @zhenggen-xu
common/redisselect.cpp
Outdated
| * This is no big harm since all the late messages will be selected and nothing popped | ||
| * when the channel is not completely busy. | ||
| */ | ||
| n -= m_queueLength; |
There was a problem hiding this comment.
Any usage of "n" after this operation? #Resolved
There was a problem hiding this comment.
No. It will be optimized out by compiler. It may help readability a little bit.
In reply to: 276422184 [](ancestors = 276422184)
There was a problem hiding this comment.
No. It will be optimized out by compiler. It may help readability a little bit.
In reply to: 276422184 [](ancestors = 276422184)
I think it causes more confusion than helping readability. #Resolved
There was a problem hiding this comment.
| * in the select-pop(s) pattern | ||
| */ | ||
| if (n <= 0) | ||
| n = 1; |
There was a problem hiding this comment.
In what scenario n <= 0?
#Resolved
There was a problem hiding this comment.
I am trying to prevent any logic error outside the scope of RedisSelect. Considering the case if there are redundant notifications but there is no data popped, caller may call discard(0), and here the function consumes one message in the queue if there is any. discard(negative) is not for protection purpose and should be not in a true case.
In reply to: 276515380 [](ancestors = 276515380)
common/redisselect.cpp
Outdated
| * This is no big harm since all the late messages will be selected and nothing popped | ||
| * when the channel is not completely busy. | ||
| */ | ||
| n -= m_queueLength; |
There was a problem hiding this comment.
No. It will be optimized out by compiler. It may help readability a little bit.
In reply to: 276422184 [](ancestors = 276422184)
I think it causes more confusion than helping readability. #Resolved
…() (sonic-net#214)" This reverts commit c5d5434.
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
Signed-off-by: Qi Luo <qiluo-msft@users.noreply.github.com>
40e9e79 to
74778c0
Compare
|
retest this please |
pavel-shirshov
left a comment
There was a problem hiding this comment.
Have we made any tests checking the new implementation is faster than previous?
Other as comments
| // Override with an empty body, and subclasses will explicitly discard messages in the channel | ||
| void ConsumerTableBase::updateAfterRead() | ||
| { | ||
| } |
There was a problem hiding this comment.
I don't understand why do we need this?
The base class already has an empty body
| r = cs.isQueueEmpty(); | ||
| EXPECT_TRUE(r); | ||
| } | ||
| } |
There was a problem hiding this comment.
Why this test was removed?
| bool ConsumerTableBase::hasCachedData() | ||
| { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
The base class has the same implementation. It doesn't need to be implemented here.
| bool SubscriberStateTable::hasCachedData() | ||
| { | ||
| return m_buffer.size() > 1 || m_keyspace_event_buffer.size() > 1; | ||
| return true; |
There was a problem hiding this comment.
It's default implementation in the base class. We could remove whole method.
sonic-net#271 Signed-off-by: Kebo Liu kebol@nvidia.com Description Judge the self._parse_re return value, if it's N/A then stop further string slice handling to avoid a crash. Update the regular expression pattern for Innodisk SSD health, to handle the case that the output of the health section is different when its lifetime reaches the end. Motivation and Context Original code doesn't handle the case that self._parse_re returns N/A, it's assuming that self._parse_re will always return a none N/A value thus further handling the result w/o judge, which could in a crash. On Innodisk SSD, when the SSD remaining lifetime reaches the end, the output of the Health section will be a number w/o %, e.g. Health: 0.00 instead of Health: 95.0% in the normal case, need to update the regular expression to handle this case. How Has This Been Tested? UT test has been added. Tested the change on platforms with different types of SSD.
This is a competing PR to #258
I reverted #214 since it exposed unnecessary implementation details.
Problem statement is same as #258, so I shamelessly copied it here.
The implementation proposed here follows some design principles.