March 2021
Intermediate to advanced
260 pages
5h 45m
English
Now when our servers discover other servers, they replicate each other’s data. That’s a problem with our replication implementation: when one server discovers another, they replicate each other in a cycle! You can verify it by adding this code at the bottom of your test:
| | consumeResponse, err = leaderClient.Consume( |
| | context.Background(), |
| | &api.ConsumeRequest{ |
| | Offset: produceResponse.Offset + 1, |
| | }, |
| | ) |
| | require.Nil(t, consumeResponse) |
| | require.Error(t, err) |
| | got := grpc.Code(err) |
| | want := grpc.Code(api.ErrOffsetOutOfRange{}.GRPCStatus().Err()) |
| | require.Equal(t, got, want) |
We only produced one record to our service, and yet we’re able to consume multiple records from the original server because it’s replicated data from another ...
Read now
Unlock full access