Skip to content
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

Fix processing bug #107

Merged
merged 2 commits into from
Jan 9, 2025
Merged

Fix processing bug #107

merged 2 commits into from
Jan 9, 2025

Conversation

eminano
Copy link
Collaborator

@eminano eminano commented Jan 9, 2025

This PR fixes a bug in the WAL processors where the send/notify channels are closed when the enqueuing fails for any reason, but it should only be closed when the send/notify thread stops (this signals the processor has stopped).

This can cause issues if the error returned by the ProcessWALEvent method is not treated as fatal, and the processor is called after an error, attempting to send a message on a closed channel with a send/notify thread still running.

Preventative nil checks added for the search indexer message.

@eminano eminano changed the title Fix processors bug Fix processing bug Jan 9, 2025
@eminano eminano requested a review from exekias January 9, 2025 14:58
@eminano eminano merged commit 5a9ce87 into main Jan 9, 2025
6 checks passed
@eminano eminano deleted the fix-processors-bug branch January 9, 2025 15:04
@eminano eminano added the bug Something isn't working label Jan 9, 2025
Copy link

github-actions bot commented Jan 9, 2025

Merging this branch will not change overall coverage

Impacted Packages Coverage Δ 🤖
github.com/xataio/pgstream/pkg/wal/processor/kafka 71.23% (ø)
github.com/xataio/pgstream/pkg/wal/processor/search 85.83% (ø)
github.com/xataio/pgstream/pkg/wal/processor/webhook/notifier 86.09% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/xataio/pgstream/pkg/wal/processor/kafka/wal_kafka_batch_writer.go 76.47% (ø) 119 91 28
github.com/xataio/pgstream/pkg/wal/processor/search/search_batch_indexer.go 87.40% (ø) 127 111 16
github.com/xataio/pgstream/pkg/wal/processor/search/search_msg_batch.go 88.24% (ø) 17 15 2
github.com/xataio/pgstream/pkg/wal/processor/webhook/notifier/webhook_notifier.go 84.78% (ø) 92 78 14

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants