Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slaves pulls and applies updates in a more batching fashion
more specifically avoids lucene index refreshing until after each batch. Main change is making choice of IndexUpdateMode explicit by the caller, rather than implicit by IndexingService and exposing a means of just flushing changes (in the Lucene case refreshing the searcher). These two changes are taked advantage of in TransactionCommittingResponseUnpacker to defer refreshing lucene indexes until once per batch (100 by default). The unpacker also uses batching of label scan store and legacy index updates, just like recovery does. All these changes makes update pulling 1-2 orders of magnitude faster than before and therefore makes transaction gap between slaves and master much smaller, also cluster commits faster where ha.tx_push_factor > 0.
- Loading branch information
Showing
47 changed files
with
1,230 additions
and
421 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
76 changes: 76 additions & 0 deletions
76
...rc/main/java/org/neo4j/kernel/impl/api/BatchingTransactionRepresentationStoreApplier.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright (c) 2002-2015 "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; | ||
|
||
import java.io.IOException; | ||
|
||
import org.neo4j.kernel.RecoveryLabelScanWriterProvider; | ||
import org.neo4j.kernel.api.labelscan.LabelScanStore; | ||
import org.neo4j.kernel.impl.api.index.IndexingService; | ||
import org.neo4j.kernel.impl.core.CacheAccessBackDoor; | ||
import org.neo4j.kernel.impl.index.IndexConfigStore; | ||
import org.neo4j.kernel.impl.locking.LockService; | ||
import org.neo4j.kernel.impl.store.NeoStore; | ||
import org.neo4j.kernel.impl.util.IdOrderingQueue; | ||
|
||
/** | ||
* {@link TransactionRepresentationStoreApplier} that builds services made for batching transactions. | ||
* Transaction data can be cached and applied as one batch when a threshold is reached, so ensuring that transaction | ||
* data is actually written will have to be done by calling {@link #closeBatch()}. | ||
*/ | ||
public class BatchingTransactionRepresentationStoreApplier extends TransactionRepresentationStoreApplier | ||
{ | ||
private final RecoveryLabelScanWriterProvider labelScanWriterProvider; | ||
private final RecoveryLegacyIndexApplierLookup legacyIndexApplierLookup; | ||
|
||
public BatchingTransactionRepresentationStoreApplier( IndexingService indexingService, | ||
LabelScanStore labelScanStore, NeoStore neoStore, CacheAccessBackDoor cacheAccess, | ||
LockService lockService, LegacyIndexApplierLookup legacyIndexProviderLookup, | ||
IndexConfigStore indexConfigStore, IdOrderingQueue legacyIndexTransactionOrdering ) | ||
{ | ||
this( indexingService, new RecoveryLabelScanWriterProvider( labelScanStore, 1000 ), | ||
neoStore, cacheAccess, lockService, | ||
new RecoveryLegacyIndexApplierLookup( legacyIndexProviderLookup, 1000 ), | ||
indexConfigStore, legacyIndexTransactionOrdering ); | ||
} | ||
|
||
private BatchingTransactionRepresentationStoreApplier( | ||
IndexingService indexingService, | ||
RecoveryLabelScanWriterProvider labelScanWriterProvider, | ||
NeoStore neoStore, | ||
CacheAccessBackDoor cacheAccess, | ||
LockService lockService, | ||
RecoveryLegacyIndexApplierLookup legacyIndexApplierLookup, | ||
IndexConfigStore indexConfigStore, | ||
IdOrderingQueue legacyIndexTransactionOrdering ) | ||
{ | ||
super( indexingService, labelScanWriterProvider, neoStore, cacheAccess, lockService, legacyIndexApplierLookup, | ||
indexConfigStore, legacyIndexTransactionOrdering ); | ||
this.labelScanWriterProvider = labelScanWriterProvider; | ||
this.legacyIndexApplierLookup = legacyIndexApplierLookup; | ||
} | ||
|
||
public void closeBatch() throws IOException | ||
{ | ||
labelScanWriterProvider.close(); | ||
legacyIndexApplierLookup.close(); | ||
indexingService.flushAll(); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,5 @@ | |
public enum IndexUpdateMode | ||
{ | ||
ONLINE, | ||
RECOVERY | ||
BATCHED | ||
} |
Oops, something went wrong.