ignore empty state files stored
This commit is contained in:
parent
ba137df093
commit
d4d227ba6b
|
@ -384,7 +384,11 @@ public class LocalGateway extends AbstractLifecycleComponent<Gateway> implements
|
||||||
if (fileIndex >= index) {
|
if (fileIndex >= index) {
|
||||||
// try and read the meta data
|
// try and read the meta data
|
||||||
try {
|
try {
|
||||||
readStartedShards(Streams.copyToByteArray(new FileInputStream(stateFile)));
|
byte[] data = Streams.copyToByteArray(new FileInputStream(stateFile));
|
||||||
|
if (data.length == 0) {
|
||||||
|
logger.debug("[findLatestState]: not data for [" + name + "], ignoring...");
|
||||||
|
}
|
||||||
|
readStartedShards(data);
|
||||||
index = fileIndex;
|
index = fileIndex;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("[findLatestState]: Failed to read state from [" + name + "], ignoring...", e);
|
logger.warn("[findLatestState]: Failed to read state from [" + name + "], ignoring...", e);
|
||||||
|
@ -409,7 +413,12 @@ public class LocalGateway extends AbstractLifecycleComponent<Gateway> implements
|
||||||
if (fileIndex >= index) {
|
if (fileIndex >= index) {
|
||||||
// try and read the meta data
|
// try and read the meta data
|
||||||
try {
|
try {
|
||||||
readMetaState(Streams.copyToByteArray(new FileInputStream(stateFile)));
|
byte[] data = Streams.copyToByteArray(new FileInputStream(stateFile));
|
||||||
|
if (data.length == 0) {
|
||||||
|
logger.debug("[findLatestState]: not data for [" + name + "], ignoring...");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
readMetaState(data);
|
||||||
index = fileIndex;
|
index = fileIndex;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.warn("[findLatestState]: Failed to read state from [" + name + "], ignoring...", e);
|
logger.warn("[findLatestState]: Failed to read state from [" + name + "], ignoring...", e);
|
||||||
|
|
Loading…
Reference in New Issue