Handling partially written hint files

Patch by  Garvit Juniwal; Reviewed by Aleksey Yeschenko for CASSANDRA-12728
This commit is contained in:
Jeff Jirsa 2017-04-04 11:31:29 -07:00
parent 71d4f66d72
commit 3110d27dde
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,5 @@
3.0.14
*
* Handling partially written hint files (CASSANDRA-12728)
3.0.13
* Make reading of range tombstones more reliable (CASSANDRA-12811)

View File

@ -17,6 +17,7 @@
*/
package org.apache.cassandra.hints;
import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
@ -188,6 +189,11 @@ class HintsReader implements AutoCloseable, Iterable<HintsReader.Page>
{
hint = computeNextInternal();
}
catch (EOFException e)
{
logger.warn("Unexpected EOF replaying hints ({}), likely due to unflushed hint file on shutdown; continuing", descriptor.fileName(), e);
return endOfData();
}
catch (IOException e)
{
throw new FSReadError(e, file);
@ -280,6 +286,11 @@ class HintsReader implements AutoCloseable, Iterable<HintsReader.Page>
{
buffer = computeNextInternal();
}
catch (EOFException e)
{
logger.warn("Unexpected EOF replaying hints ({}), likely due to unflushed hint file on shutdown; continuing", descriptor.fileName(), e);
return endOfData();
}
catch (IOException e)
{
throw new FSReadError(e, file);