-
Notifications
You must be signed in to change notification settings - Fork 4
Add PgLsn::INVALID; Add PgTimestamp for standby_status_update #1
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
Conversation
This is the equivalent of InvalidXLogRecPtr in postgres C sources.
Create a type to represent a timestamp, stored as an i64 in microseconds relative to the postgres epoch. This needs improvement: - It should move to somewhere in the postgres-type crate, unless this timestamp type is specific to replication. - The name is confusingly similar to postgres_types::Timestamp.
These are a couple of (proposed) small additions to the replication PR, sfackler#752 |
What is a reason for adding the constant —
|
A fair question. Some context might be helpful. I am currently copying the behavior from postgres'
So it always sends This C code defines the values that would be sent by this PR's fn standby_status_update(
self: Pin<&mut Self>,
write_lsn: PgLsn,
flush_lsn: PgLsn,
apply_lsn: PgLsn,
ts: i64,
reply: u8,
) ... so to emulate the code above I need to put an LSN of 0 into one or more fields of It might be that this is a very exotic use case, and doesn't justify putting this in the library. I can drop this change if it seems questionable. |
Another strategy might be to change some or all of the parameters of |
What do you think of changing XLogData's |
Yes, I agree What do you think about the idea of |
I implemented the Regarding the |
I have started to think that Reason: once it exists, people might be tempted to pass it as a parameter anywhere that And then I think, it would have been nice if the type system could clarify where it's OK to send I like the idea of making |
Even if |
Are all the fields able to accept this invalid Lsn? In the base backup example you sent it's definitely the case for apply and flush, do you know about write? |
Sorry, I don't know whether the write LSN could ever be 0. @hlinnaka might know? He once wrote this:
It seems a little bonkers for a peer to be receiving data, but claiming it has never received anything. I'm tempted to say this can never be zero. Is it possible for this to be a new connection, that has never received any data but has received a keepalive message? |
PgLsn:
InvalidXLogRecPtr
, and I find this easier to understand thanPgLsn(0)
.PgTimestamp:
postgres_types::Timestamp
, so there's some risk of confusion. Maybe if this were namedReplicationTimestamp
instead? I'm not sure what the right name should be.