Skip to content

Commit

Permalink
Skip bucket after detecting data corruption in neo
Browse files Browse the repository at this point in the history
This makes the NeoStorageEngineStepIterator work in the same way
as legacy StorageEngineStepIterator - upon detecting the data
corruption, the iterator should just skip to the next bucket.
  • Loading branch information
nemanja-boric-sociomantic authored and Gavin Norman committed Sep 18, 2018
1 parent 237d883 commit 78938d9
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions src/dlsnode/storage/iterator/NeoStorageEngineStepIterator.d
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public class NeoStorageEngineStepIterator

// State machine. Start from the last state and move through
// the records.
do
try do
{
switch (this.state)
{
Expand Down Expand Up @@ -319,8 +319,16 @@ public class NeoStorageEngineStepIterator
else
{
// We have the record, let's read value
this.record_header = this.header_future.get();
this.state = State.ExpectingRecordValue;
try
{
this.record_header = this.header_future.get();
this.state = State.ExpectingRecordValue;
}
catch (Exception e)
{
// on error reading, skip this bucket
this.state = State.LookingForNextBucket;
}
}
break;

Expand All @@ -342,20 +350,35 @@ public class NeoStorageEngineStepIterator
// move to the next bucket
this.file.close();
this.state = State.LookingForNextBucket;
break;
}
else
{
key = cast(time_t)this.record_header.key;
value.copy(this.value_future.get());
this.state = State.ExpectingRecordHeader;
return NextResult.RecordRead;
try
{
key = cast(time_t)this.record_header.key;
value.copy(this.value_future.get());
this.state = State.ExpectingRecordHeader;
return NextResult.RecordRead;
}
catch (Exception e)
{
// on error reading, skip this bucket
this.state = State.LookingForNextBucket;
}
}
break;

default:
assert(false);
}
}
while ( true );
catch (Exception e)
{
// just silently ignore possible data errors (the storage layer
// will already report them)
return NextResult.NoMoreData;
}

assert(false);
}
Expand Down

0 comments on commit 78938d9

Please sign in to comment.