Skip to content

Commit

Permalink
Fixes an issue with applying external updates
Browse files Browse the repository at this point in the history
And manages external updates after merge
  • Loading branch information
tinwelint authored and burqen committed Feb 18, 2019
1 parent 22bd340 commit 8723304
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ private void assertIndexedNodesMatchesStoreNodes() throws Exception
}
if ( !found )
{
mismatches.add( "Index is missing entry for " + name );
mismatches.add( "Index is missing entry for " + name + " " + node );
}
}
if ( !mismatches.isEmpty() )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class BlockBasedIndexPopulator<KEY extends NativeIndexKey<KEY>,VALUE exte
private final int blockSize;
private BlockStorage<KEY,VALUE> scanUpdates;
private IndexUpdateStorage<KEY,VALUE> externalUpdates;
private boolean merged;

BlockBasedIndexPopulator( PageCache pageCache, FileSystemAbstraction fs, File file, IndexLayout<KEY,VALUE> layout, IndexProvider.Monitor monitor,
StoreIndexDescriptor descriptor, IndexSpecificSpaceFillingCurveSettingsCache spatialSettings,
Expand Down Expand Up @@ -151,6 +152,7 @@ public void scanCompleted() throws IndexEntryConflictException

// Apply the external updates
writeExternalUpdatesToTree();
merged = true;
}
catch ( IOException e )
{
Expand All @@ -175,7 +177,7 @@ private void writeExternalUpdatesToTree() throws IOException
break;
case CHANGED:
writer.remove( updates.key() );
writer.put( updates.key(), updates.value() );
writer.put( updates.key2(), updates.value() );
break;
default:
throw new IllegalArgumentException( "Unknown update mode " + updates.updateMode() );
Expand Down Expand Up @@ -212,6 +214,11 @@ private void writeScanUpdatesToTree() throws IOException, IndexEntryConflictExce
@Override
public IndexUpdater newPopulatingUpdater( NodePropertyAccessor accessor )
{
if ( merged )
{
return super.newPopulatingUpdater( accessor );
}

return new IndexUpdater()
{
@Override
Expand Down

0 comments on commit 8723304

Please sign in to comment.