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
SubscribeToAllFiltered delivers log positions with prepare value 0 #3989
Comments
It looks weird, but I don't think there's a real issue there. In 99.9% of cases, commit position is the only one you want. Prepare position can only be different if you use explicit transactions, and it's a very marginal, as well as very questionable feature, which we might remove at some point. |
@alexeyzimarev It seems a bit meaningless to filter out checkpoints with commit != prepare and prepare == 0 as the majority of the checkpoints have prepare == 0 until caughtup. Especially, If I have 10 millions events and the events that my filter predicates true are in the last 1000. |
@alexeyzimarev It might be that I used too few events for my testing and the log positions with prepare 0 I see is from esdb internal events or something like that. I will investigate this further with more data. Edit: Seems like it is not just in the beginning I get prepare == 0. In another run when writing more events, I see:
|
I still don't understand why are you interested in prepare position. My reply was about that. |
I am not interested in it per say, I wanted to know the reason for getting checkpoints where prepare is 0 (I am not using transactions) and if storing log positions where prepare equals 0 in read model db is expected of SubscribeToAllFiltered consumers. |
I'm curious about this too. It seems it originates here 91f929b#diff-0a8d496f35c459188e6f3669d71414e3fefa57e162ccfac14a2c5692079e47afR86 but it is quite likely that there isnt a need for the 0 any longer, I'll give this some thought. Aside from being mysterious, this should work fine as a checkpoint to persist and continue the reads or subscription from later |
This is what I was fishing a bit for. According to the commit message it should be safe to use prepare with 0:
So, I'll go with prepares with 0 returned from SubscribeToAllFiltered as valid positions. @timothycoleman You are welcome to close this, but I am curious about what you are going to do with this. |
Concerning the expected behaviour, unless you are doing explicit transactions (which are only available via the old client), the commit and prepare positions will always be the same. I don't think it's a big issue. Do you have events appended using explicit transactions in the database? |
I am not appending with explicit transactions and I get commit and prepare versions with different values as stated earlier:
|
I mean, we realise it is weird, and it can be fixed. My thoughts were more around the issue importance. Right now, it doesn't seem to be creating any problems, so we don't plan fixing it right now. Unless, of course, you actually have a problem. That's what I am trying to clarify :) |
I do not have any actual problem with that as long it is expected that clients can get checkpoints with prepare values with 0. I am just curious about how the eventstore event / index reader behaves when it gets a log position with prepare values that are 0 compared to values where commit and prepare are the same. I probably just update my client to ignore checkpoints with 0 based prepare values because I am not any wiser about semantics. |
You can always use the position composed from the commit position value you received, and prepare position set to the same value as the commit position. Unless you are using explicit transactions, they are both the same. |
This seems not to be the case. I am not using transactions and I get those prepares with 0. So what you are saying is not true. Anyway, feel free to close this. |
What I meant that in the log those positions are the same, and there's no need to explicitly provide prepare position that is different from commit position. Prepare position is never null. Consider getting zero value as an indicator of prepare position being the same as commit position. In fact, we only keep prepare position being used for subscriptions to ensure compatibility as it's lo longer possible to use explicit transactions. |
Describe the bug
When I subscribe to all stream with filter I get a lot of checkpoints with prepare value being 0.
An example output using
23.6.0-alpha.184-focal
:It is not until after the CaughtUp message above we see a log position with commit and prepare being equal.
Similar behavior is on other tested versions except the caught up message.
To Reproduce
Subscribe to all stream with a prefix filter and output messages from ESDB in order to see the checkpoint values. Turn on debug on server as well.
Expected behavior
I am not sure what the expected behavior should be. I would expect log positions with equal prepare and commit values. But if it is expected to use log positions with values like C:216468/:P0 then I suppose this issue can be closed. Just want to be certain.
Actual behavior
Lots of log positions with prepare value being 0.
EventStore details
DB-487
The text was updated successfully, but these errors were encountered: