fix: handle weird drives sporadic read O_DIRECT behavior (#11832)

on freshReads if drive returns errInvalidArgument, we
should simply turn-off DirectIO and read normally, there
are situations in k8s like environments where the drives
behave sporadically in a single deployment and may not
have been implemented properly to handle O_DIRECT for
reads.
This commit is contained in:
Harshavardhana
2021-03-18 20:16:50 -07:00
committed by GitHub
parent be5910b87e
commit b92a220db1
3 changed files with 26 additions and 33 deletions

View File

@@ -50,14 +50,14 @@ func TestDeadlineWriter(t *testing.T) {
if err != context.Canceled {
t.Error("DeadlineWriter shouldn't be successful - should return context.Canceled")
}
w = NewDeadlineWriter(&sleepWriter{timeout: 500 * time.Millisecond}, 600*time.Millisecond)
w = NewDeadlineWriter(&sleepWriter{timeout: 100 * time.Millisecond}, 600*time.Millisecond)
n, err := w.Write([]byte("abcd"))
w.Close()
if err != nil {
t.Errorf("DeadlineWriter should succeed but failed with %s", err)
}
if n != 4 {
t.Errorf("DeadlineWriter should succeed but should have only written 0 bytes, but returned %d instead", n)
t.Errorf("DeadlineWriter should succeed but should have only written 4 bytes, but returned %d instead", n)
}
}