-
Notifications
You must be signed in to change notification settings - Fork 12
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
[walproposer] Async WAL append #105
Conversation
df3bde0
to
38967e6
Compare
38967e6
to
ef2315f
Compare
ef2315f
to
84e4691
Compare
707ce19
to
4aab715
Compare
5b99a64
to
beb4421
Compare
@@ -720,27 +727,14 @@ SendMessageToNode(int i, WalMessage *msg) | |||
msg = msg->next; | |||
|
|||
wk->currMsg = msg; | |||
wk->flushWrite = false; | |||
wk->state = SS_ACTIVE; |
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.
Let's move this to StartStreaming, as we need it only once
*/ | ||
wk->state = SS_SEND_WAL; | ||
/* Don't ned to update the event set; that's done by AdvancePollState */ | ||
/* TODO: do we need to send messages immediately? */ |
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.
That's ok, we can convert comment to smth like 'Note: we always send everything to the safekeeper until WOULDBLOCK or nothing left to send'
wk->state = SS_IDLE; | ||
UpdateEventSet(wk, WL_SOCKET_READABLE); | ||
} | ||
UpdateEventSet(wk, WL_SOCKET_READABLE | (wk->flushWrite ? WL_SOCKET_WRITEABLE : 0)); |
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.
Redundant? SendAppendRequests guts will set WL_SOCKET_WRITEABLE if needed.
* SendAppendRequests, but sent through a wire only with a flush in | ||
* reading routine. | ||
*/ | ||
while (wk->ackMsg != NULL && wk->ackMsg != wk->currMsg) |
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.
With this coding, if we don't wait for anything and connection is lost, we won't try reading from it and thus will never reset it, right? So better prepare to async responses right away and just expect here any ack message.
Also this 'sent with a flush in reading routine' shouldn't happen anymore...
On the second thought, it is not that bad as in case of any required action (data to send) connection reset will happen; better fix it right now, but I'm ok with doing it separately.
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.
'sent with a flush in reading routine' still can happen, it's in PQConsumeInput implementation: https://github.com/zenithdb/postgres/blob/main/src/interfaces/libpq/fe-exec.c#L1909-L1919
As we handle all read/write events and don't need to flush in PQConsumeInput, we may try to switch to using pqReadData instead. But for now we still can read responses ahead of requests, so I'd better create an issue for better async handling and fix it later.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies. New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.
Implement async wp <-> sk protocol, send WAL messages ahead of feedback replies.
New SS_ACTIVE state is introduced instead of former SS_SEND_WAL / SS_SEND_WAL_FLUSH / SS_RECV_FEEDBACK.