-
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
Simplify walproposer code #114
Conversation
Approve on first two checkboxes. |
e793e23
to
bd51cd0
Compare
Now event set is updated only in the end of HandleActiveState, after all handlers code was executed.
Updating event set only on flushes is tricky, I optimized UpdateEventSet calls in SS_ACTIVE differently. Now all SS_ACTIVE code is executed only with calls to HandleActiveState, which calls UpdateEventSet in the end. This way we have single place for updating event set and it will not flip in the middle of the handler. Also, if event mask is not updated in the next call to UpdateEventSet, no extra calls will be done, because ModifyWaitEvent has early exit check for such case. Flushes are tricky mostly because we can have a call stack like |
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.
After looking for some time I now think that UpdateEventSet placement here is better than what I initially proposed :)
Another thing I remembered, that after HackyRemoveWalProposerEvent (happens on every reconnect) we always HandleActiveState isn't picky on events and will fix them in any case, but that's still extra work on every reconnect. |
Not that it is extremely expensive, but yeah, it would be nicer to check for flushWrite in WalKeeperStateDesiredEvents to fix it. |
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
* Clean up walproposer states * Migrate AsyncReadFixed to AsyncReadMessage * Handle flushWrite better a bit * Update SS_ACTIVE event set in single place Now event set is updated only in the end of HandleActiveState, after all handlers code was executed. * Add comment on SS_ACTIVE write event * Add TODO for SS_ACTIVE DesiredEvents
Closes neondatabase/neon#1041