-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
In the case of: Put -> Delete -> Put, the oxia server may cause data loss,
you can reproduce the issue by the test:
func TestPutThenDeleteThenPut(t *testing.T) {
standaloneServer, err := NewStandalone(NewTestConfig(t.TempDir()))
assert.NoError(t, err)
defer standaloneServer.Close()
client, err := oxia.NewAsyncClient(standaloneServer.ServiceAddr(), oxia.WithBatchLinger(1*time.Second), oxia.WithMaxRequestsPerBatch(1000))
assert.NoError(t, err)
defer client.Close()
putResult := client.Put("test-key", []byte("test-value"))
deleteResult := client.Delete("test-key")
putResult2 := client.Put("test-key", []byte("test-value2"))
r1 := <-putResult
r2 := <-deleteResult
r3 := <-putResult2
assert.NoError(t, r1.Err)
assert.NoError(t, r2)
assert.NoError(t, r3.Err)
v := <-client.Get("test-key")
assert.NoError(t, v.Err)
assert.Equal(t, []byte("test-value2"), v.Value)
}This is because of the write ops in WriteRequest send to server is out of ordering, the oxia client will split Put -> Delete -> Put into
2 batches: [put, put], [delete]
Metadata
Metadata
Assignees
Labels
No labels