@@ -82,9 +82,10 @@ func (c *DiskCache) doGet(buf []byte, fn Fn, bfn BufFunc) error {
8282 if err = func () error {
8383 c .wlock .Lock ()
8484 defer c .wlock .Unlock ()
85+
8586 return c .rotate ()
8687 }(); err != nil {
87- return err
88+ return fmt . Errorf ( "wakeup error: %w" , err )
8889 }
8990 }
9091
@@ -140,14 +141,15 @@ retry:
140141
141142 if len (readbuf ) < nbytes {
142143 // seek to next read position
143- if _ , err := c .rfd .Seek (int64 (nbytes ), io .SeekCurrent ); err != nil {
144+ if x , err := c .rfd .Seek (int64 (nbytes ), io .SeekCurrent ); err != nil {
144145 return fmt .Errorf ("rfd.Seek(%d): %w" , nbytes , err )
145- }
146+ } else {
147+ l .Warnf ("got %d bytes to buffer with len %d, seek to new read position %d, drop %d bytes within file %s" ,
148+ nbytes , len (readbuf ), x , nbytes , c .curReadfile )
146149
147- l .Warnf ("got %d bytes to read into buffer with length %d" , nbytes , len (readbuf ))
148-
149- droppedDataVec .WithLabelValues (c .path , reasonTooSmallReadBuffer ).Observe (float64 (nbytes ))
150- return ErrTooSmallReadBuf
150+ droppedDataVec .WithLabelValues (c .path , reasonTooSmallReadBuffer ).Observe (float64 (nbytes ))
151+ return ErrTooSmallReadBuf
152+ }
151153 }
152154
153155 if n , err := c .rfd .Read (readbuf [:nbytes ]); err != nil {
0 commit comments