Skip to content

Commit 3e9bfd2

Browse files
Merge pull request #174 from rabbitmq/error-handling
Handle a couple of potential errors a bit better
2 parents 876f456 + bec9c50 commit 3e9bfd2

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

.github/workflows/erlang.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,3 @@ jobs:
2929
run: make
3030
- name: Run tests
3131
run: make check
32-
33-
build-bazel:
34-
runs-on: ubuntu-latest
35-
strategy:
36-
fail-fast: false
37-
matrix:
38-
otp_major:
39-
- "26"
40-
steps:
41-
- name: Clone the repository
42-
uses: actions/checkout@v2
43-
- name: Run tests
44-
run: |
45-
bazelisk test //... --config=rbe-${{ matrix.otp_major }}

src/osiris_replica.erl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,17 @@ handle_continue(#{name := Name0,
160160
{error, no_process} ->
161161
?INFO_(Name, "Writer process not alive, exiting...", []),
162162
{stop, {shutdown, writer_unavailable}, undefined};
163+
missing_file ->
164+
?INFO_(Name, "missing file returned from writer, exiting...", []),
165+
{stop, {shutdown, missing_file}, undefined};
163166
{error, _} = Err ->
164167
{stop, Err, undefined};
168+
{badrpc, {'EXIT', shutdown}} ->
169+
?INFO_(Name, "Writer process shutting down, exiting...", []),
170+
{stop, {shutdown, writer_unavailable}, undefined};
171+
{badrpc, nodedown} ->
172+
?INFO_(Name, "Writer process node is down, exiting...", []),
173+
{stop, {shutdown, writer_unavailable}, undefined};
165174
{badrpc, Reason} ->
166175
{stop, {badrpc, Reason}, undefined};
167176
{ok, {LeaderRange, LeaderEpochOffs}} ->

src/osiris_replica_reader.erl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,9 @@ do_sendfile0(#state{name = Name,
330330
{ok, Log} ->
331331
do_sendfile0(State#state{log = Log});
332332
{error, _Err} ->
333-
ok = setopts(Transport, Sock, [{nopush, false}]),
333+
%% ignore return value here as we've already hit an error
334+
%% and it is likely we'll get another one when setting opts
335+
_ = setopts(Transport, Sock, [{nopush, false}]),
334336
?DEBUG_(Name, "sendfile err ~w", [_Err]),
335337
State;
336338
{end_of_stream, Log} ->

0 commit comments

Comments
 (0)