Tracking: disabling call BCAST mode again when BCAST already enabled#8135
Tracking: disabling call BCAST mode again when BCAST already enabled#8135hwware wants to merge 1 commit into
Conversation
|
I would vote for option 1. Yes it's O(N^2), but how many prefixes are people really using? This is really an enabling configuration. |
|
Also technically backwards breaking, so @redis/core-team |
|
Hi @madolson , thank you for your optionion, actually I also think application or user shouldn't have many prefixes for the BCAST tracking call , so option 1 should be good to handle... But just not sure if it is ok for us to assume something in the application even though we did not see that. Maybe we can wait for some other comments? |
|
@hwware @madolson on my way to merge it and edit the commit message i have doubts. i don't recall our previous discussions about the matter and what state i had in my brain at the time (volatile memory). this change actually prevents users that wants to enable two different BCAST prefixes using two consecutive calls from achieving their purpose, and is of course a braking change (evident by the test that had to be modified). i'm afraid that when we roll this out we'll break some applications. looking again at the discussion, maybe at the time i belied that this is a partial (non hermetic) solution to the problem, which we can later improve to be more hermetic. but now i realize (correct me if i'm wrong) that if we implement the O(N^2) search later on, this limitation will be lifted. [i'll downvote this till we finish the discussion, so that we don't risk accidentally merging it before then] |
oranagra
left a comment
There was a problem hiding this comment.
this is a breaking change and i have doubts (see message above)
|
thanks @oranagra for the concern, it is better we clearify everything before we merge it. We discussed this issue in #8003 and our chat. I was actually had same concern before if we disabled te second BCAST call, which will disable the ability to register new prefixes. Since currently there is no APIs for managing BCAST prefixes separatelly, this is the way how we can register prefix in a accumulating way. but as @madolson mentioned, clients can still do a disable/enable approach for registering the new prefixes(but not a accumulating way) and this might be the most common way client manage this. In some stateless application I am not sure if the incremental way might be the case client side choosed, but we maybe can leave the discussion and implementsion for prefix add/delete functionality after client opened this request? but for now I think fixing this bug is necessary. How do you think on this? thanks |
|
I guess that's fair, I was in the mindset that most of the client tracking APIs are setting the state, not adding to the state. So in this case, calling this function twice was basically a bug. But, if instead we think of this as an add prefix API, like you are suggesting, then this use case is perfectly valid. We can just solve the deduplication bug, it shouldn't be that hard to to loop over all the already registered prefixes and see if either are a substring of another one. Would deduplicate to having two prefixes, 'bar' and 'f'. @hwware We should be able to do that easily right? |
|
@madolson i felt this might introduce some level of complexity, if we doing deduplicate. since the prefixes will be saved in two places: the global PrefixTable for all clients prefixes and for each client itself which is in client_tracking_prefixes .. If we do deduplicates we need to search and delete in these two rax trees, for client rax itself i would't consider much, but for the global Prefix, since it contains all the client registered prefix, it maybe inefficient for searching and operating in some scenario. Therefore i would vote for fail early before actually insert the prefix... Please let me know if i miss anything. thanks |
|
Hi @madolson @oranagra , i am thinking this dupicate invalidation message issue could have another way to solve. I think we put too much complexity in managing the prefixes but maybe when we doing the invalidate we can do something.
I think this way we can also avoid the duplicate invalidation message issue, also since the invalidation happens in beforeSleep call, this rax tree shouldn't grow big. not sure if that make sense to your guys or is there anything that I was missing? thanks! Sorry about the previous notification, i made a mistake :( |
|
@hwware I don't like the idea of adding complexity on the hot path. The deduplication work is harder, but we don't expect people to be updating them very often. |
|
Hi @madolson , for the deduplication work, I have one concern regarding this: it may potentically close the door for us to implement some other prefix APIs, if user request and we need to extend in the future: such as show registered prefixes, or delete prefixes.. Not sure for now we have a valid use case or not, but just want to leave a note here. otherwise this idea seems ok to me.. |
|
closing this PR since we agree to use #8176 for this fix. |
This PR fixes #8003 . The cause of this issue is if we did not specify any prefixes, "" will be used as the default prefix since an empty string is a prefix for all other string. However if we call the CLIENT TRACKING ON BCAST with prefixes again both "" and other prefixes will be registered in the prefixes radix tree for bcast tracking, this will cause same client receive duplicate invalidation messages.
For a side note regarding my comment if user specifying one prefix is a subset of another in the same call: #8003 (comment) . There are two ways we handle this:
The first one has O(n^2) performance and we are trying to avoid, the second is optimal but we may not doing it for now since it need to change the lower level Radix tree code for providing this API, maybe we can do this later, but for now since we don't want to bring much complexity, we can just simply solving the original issue now first..