Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process all property updates from particular node as single update du…
…ring index population Group all updates from all properties on single node into container that will be processed in atomic fashion - all of the updates will be processed before check of population queue for current node. All updates need to be processed as single unit to avoid duplicates in index that can appear when queue already contains update for current node, but for some other property.
- Loading branch information
1 parent
2caeb94
commit 9a78361
Showing
16 changed files
with
523 additions
and
318 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
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
90 changes: 90 additions & 0 deletions
90
community/kernel/src/main/java/org/neo4j/kernel/impl/api/index/NodePropertyUpdates.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,90 @@ | |||
/* | |||
* Copyright (c) 2002-2016 "Neo Technology," | |||
* Network Engine for Objects in Lund AB [http://neotechnology.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.api.index; | |||
|
|||
import java.util.ArrayList; | |||
import java.util.Collection; | |||
|
|||
import org.neo4j.kernel.api.index.NodePropertyUpdate; | |||
|
|||
import static org.neo4j.kernel.impl.store.record.AbstractBaseRecord.NO_ID; | |||
|
|||
/** | |||
* Container for all properties updates for one node identified by {@linkplain #nodeId} | |||
* Used to group node properties updates and and pass in processing chain, so all updates can be processed together. | |||
*/ | |||
public class NodePropertyUpdates | |||
{ | |||
private Collection<NodePropertyUpdate> propertyUpdates = new ArrayList<>(); | |||
private long nodeId; | |||
|
|||
public NodePropertyUpdates() | |||
{ | |||
} | |||
|
|||
public void reset() | |||
{ | |||
propertyUpdates.clear(); | |||
nodeId = NO_ID; | |||
} | |||
|
|||
public void initForNodeId( long nodeId ) | |||
{ | |||
if ( containsUpdates() ) | |||
{ | |||
throw new AssertionError( "Please clear updates fom previous node." ); | |||
} | |||
this.nodeId = nodeId; | |||
} | |||
|
|||
public long getNodeId() | |||
{ | |||
return nodeId; | |||
} | |||
|
|||
public void add( NodePropertyUpdate update ) | |||
{ | |||
propertyUpdates.add( update ); | |||
} | |||
|
|||
public void add( int propertyKeyId, Object value, long[] labels ) | |||
{ | |||
if ( nodeId == NO_ID ) | |||
{ | |||
throw new AssertionError( "Please init property updates container for specific node." ); | |||
} | |||
propertyUpdates.add( NodePropertyUpdate.add( nodeId, propertyKeyId, value, labels ) ); | |||
} | |||
|
|||
public boolean containsUpdates() | |||
{ | |||
return !propertyUpdates.isEmpty(); | |||
} | |||
|
|||
public Collection<NodePropertyUpdate> getPropertyUpdates() | |||
{ | |||
return propertyUpdates; | |||
} | |||
|
|||
public void addAll( Collection<NodePropertyUpdate> propertyUpdates ) | |||
{ | |||
this.propertyUpdates.addAll( propertyUpdates ); | |||
} | |||
} |
Oops, something went wrong.