Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Each thread adding batches of data from the index populator will add into its own thread-local index part and in the end all those parts will be merged into one complete index. The final merging is much faster than the part-building due to all sources being sorted. Due to the single-threaded merging in the end performance of this parallel population will hit a plateau at some core count, but scales reasonably well with current mainstream hardware.
- Loading branch information
Showing
12 changed files
with
457 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...unity/kernel/src/main/java/org/neo4j/kernel/impl/index/schema/CollectingIndexUpdater.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
/* | |||
* Copyright (c) 2002-2018 "Neo4j," | |||
* Neo4j Sweden AB [http://neo4j.com] | |||
* | |||
* This file is part of Neo4j. | |||
* | |||
* Neo4j is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 3 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.neo4j.kernel.impl.index.schema; | |||
|
|||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
|
|||
import org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException; | |||
import org.neo4j.kernel.api.index.IndexEntryUpdate; | |||
import org.neo4j.kernel.api.index.IndexUpdater; | |||
|
|||
public abstract class CollectingIndexUpdater<KEY extends NativeIndexKey<KEY>,VALUE extends NativeIndexValue> implements IndexUpdater | |||
{ | |||
private boolean closed; | |||
private final Collection<IndexEntryUpdate<?>> updates = new ArrayList<>(); | |||
|
|||
@Override | |||
public void process( IndexEntryUpdate<?> update ) | |||
{ | |||
assertOpen(); | |||
updates.add( update ); | |||
} | |||
|
|||
@Override | |||
public void close() throws IndexEntryConflictException | |||
{ | |||
assertOpen(); | |||
apply( updates ); | |||
closed = true; | |||
} | |||
|
|||
protected abstract void apply( Collection<IndexEntryUpdate<?>> updates ) throws IndexEntryConflictException; | |||
|
|||
private void assertOpen() | |||
{ | |||
if ( closed ) | |||
{ | |||
throw new IllegalStateException( "Updater has been closed" ); | |||
} | |||
} | |||
} |
25 changes: 25 additions & 0 deletions
25
.../src/main/java/org/neo4j/kernel/impl/index/schema/ConsistencyCheckableIndexPopulator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,25 @@ | |||
/* | |||
* Copyright (c) 2002-2018 "Neo4j," | |||
* Neo4j Sweden AB [http://neo4j.com] | |||
* | |||
* This file is part of Neo4j. | |||
* | |||
* Neo4j is free software: you can redistribute it and/or modify | |||
* it under the terms of the GNU General Public License as published by | |||
* the Free Software Foundation, either version 3 of the License, or | |||
* (at your option) any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU General Public License | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
package org.neo4j.kernel.impl.index.schema; | |||
|
|||
public interface ConsistencyCheckableIndexPopulator | |||
{ | |||
void consistencyCheck(); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.