cancel
Showing results for 
Search instead for 
Did you mean: 

LOAD CSV failed to apply transaction and Neo4j cannot accept any query until restart

ichiban
Node

Question:
When I tried to query using LOAD CSV, Neo4j failed to apply transaction.
After that, Neo4j cannot accept any query until restart.
Lookin at debug.log, It seems that index updating is failed.

Reproduction Procedure:
1. Import all data using Neo4j Admin Import tool.
2. Start Neo4j.
3. Create constrains on all of nodes.
4. Create index on all of propeties. (1 node has approximately 100 properties.)
5. Query using LOAD CSV.

Data Size:
32739330 nodes
43958078 relationships
1109136060 properties

Neo4j:
Community Edition 4.1.1

Neo4j Configuration:
dbms.memory.heap.initial_size 24600m
dbms.memory.heap.max_size 24600m
dbms.memory.pagecache.size 28700m

Java:
OpenJDK 11.0.2

Server:
Windows Server 2016
CPU: 4core
Memory: 64GB

Query example:

USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS FROM 'file:///data/example.csv' AS row
MERGE (n:Node1 { id: row.id })
SET 
	n.property1 = row.property1,
	n.property2 = row.property2,
	n.property3 = row.property3,
	... 
;

LOAD CSV log:

Could not apply the transaction to the store after written to log

debug.log:

	2021-11-25 09:55:01.304+0000 ERROR [o.n.m.DatabaseHealth] [neo4j] Database panic: The database has encountered a critical error, and needs to be restarted. Please see database logs for more details. Failed to apply transaction: Transaction #1713 at log position LogPosition{logVersion=5, byteOffset=21668873} {started 2021-11-25 09:55:01.226+0000, committed 2021-11-25 09:55:01.273+0000, with 101 commands in this transaction, lease -1, latest committed transaction id when started was 1712, additional header bytes: }
org.neo4j.internal.kernel.api.exceptions.TransactionApplyKernelException: Failed to apply transaction: Transaction #1713 at log position LogPosition{logVersion=5, byteOffset=21668873} {started 2021-11-25 09:55:01.226+0000, committed 2021-11-25 09:55:01.273+0000, with 101 commands in this transaction, lease -1, latest committed transaction id when started was 1712, additional header bytes: }
	at org.neo4j.internal.recordstorage.RecordStorageEngine.apply(RecordStorageEngine.java:367)
	at org.neo4j.kernel.impl.api.TransactionRepresentationCommitProcess.applyToStore(TransactionRepresentationCommitProcess.java:77)
	at org.neo4j.kernel.impl.api.TransactionRepresentationCommitProcess.commit(TransactionRepresentationCommitProcess.java:50)
	at org.neo4j.kernel.impl.api.KernelTransactionImplementation.commitTransaction(KernelTransactionImplementation.java:761)
	at org.neo4j.kernel.impl.api.KernelTransactionImplementation.closeTransaction(KernelTransactionImplementation.java:635)
	at org.neo4j.kernel.impl.api.KernelTransactionImplementation.commit(KernelTransactionImplementation.java:602)
	at org.neo4j.kernel.impl.coreapi.TransactionImpl.safeTerminalOperation(TransactionImpl.java:510)
	at org.neo4j.kernel.impl.coreapi.TransactionImpl.commit(TransactionImpl.java:142)
	at org.neo4j.fabric.executor.FabricKernelTransaction.commit(FabricKernelTransaction.java:142)
	at org.neo4j.fabric.executor.FabricLocalExecutor$KernelTxWrapper.doCommit(FabricLocalExecutor.java:261)
	at reactor.core.publisher.MonoRunnable.call(MonoRunnable.java:73)
	at reactor.core.publisher.MonoRunnable.call(MonoRunnable.java:32)
	at reactor.core.publisher.FluxFlatMap.trySubscribeScalarMap(FluxFlatMap.java:126)
	at reactor.core.publisher.MonoFlatMap.subscribeOrReturn(MonoFlatMap.java:53)
	at reactor.core.publisher.Mono.subscribe(Mono.java:4203)
	at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:418)
	at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onNext(FluxConcatArray.java:176)
	at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2317)
	at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2125)
	at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:1999)
	at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:54)
	at reactor.core.publisher.Mono.subscribe(Mono.java:4218)
	at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onComplete(FluxConcatArray.java:207)
	at reactor.core.publisher.FluxConcatArray.subscribe(FluxConcatArray.java:80)
	at reactor.core.publisher.Mono.subscribe(Mono.java:4218)
	at reactor.core.publisher.Mono.block(Mono.java:1677)
	at org.neo4j.fabric.transaction.FabricTransactionImpl.doOnChildren(FabricTransactionImpl.java:268)
	at org.neo4j.fabric.transaction.FabricTransactionImpl.commit(FabricTransactionImpl.java:179)
	at org.neo4j.fabric.bolt.BoltFabricDatabaseService$BoltTransactionImpl.commit(BoltFabricDatabaseService.java:129)
	at org.neo4j.bolt.runtime.statemachine.impl.TransactionStateMachine$State.closeTransaction(TransactionStateMachine.java:410)
	at org.neo4j.bolt.runtime.statemachine.impl.TransactionStateMachine$State$1.streamResult(TransactionStateMachine.java:268)
	at org.neo4j.bolt.runtime.statemachine.impl.TransactionStateMachine.streamResult(TransactionStateMachine.java:94)
	at org.neo4j.bolt.v4.runtime.AutoCommitState.processStreamResultMessage(AutoCommitState.java:41)
	at org.neo4j.bolt.v4.runtime.AbstractStreamingState.processUnsafe(AbstractStreamingState.java:49)
	at org.neo4j.bolt.v3.runtime.FailSafeBoltStateMachineState.process(FailSafeBoltStateMachineState.java:48)
	at org.neo4j.bolt.runtime.statemachine.impl.AbstractBoltStateMachine.nextState(AbstractBoltStateMachine.java:143)
	at org.neo4j.bolt.runtime.statemachine.impl.AbstractBoltStateMachine.process(AbstractBoltStateMachine.java:91)
	at org.neo4j.bolt.messaging.BoltRequestMessageReader.lambda$doRead$1(BoltRequestMessageReader.java:90)
	at org.neo4j.bolt.runtime.DefaultBoltConnection.lambda$enqueue$0(DefaultBoltConnection.java:148)
	at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatchInternal(DefaultBoltConnection.java:237)
	at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:172)
	at org.neo4j.bolt.runtime.DefaultBoltConnection.processNextBatch(DefaultBoltConnection.java:162)
	at org.neo4j.bolt.runtime.scheduling.ExecutorBoltScheduler.executeBatch(ExecutorBoltScheduler.java:246)
	at org.neo4j.bolt.runtime.scheduling.ExecutorBoltScheduler.lambda$scheduleBatchOrHandleError$3(ExecutorBoltScheduler.java:229)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.io.IOException: Failed to flush index updates
	at org.neo4j.internal.recordstorage.BatchContext.applyPendingLabelAndIndexUpdates(BatchContext.java:123)
	at org.neo4j.internal.recordstorage.BatchContext.close(BatchContext.java:89)
	at org.neo4j.internal.recordstorage.RecordStorageEngine.apply(RecordStorageEngine.java:363)
	... 48 more
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Cannot call update() when index state is INIT
	at org.neo4j.util.concurrent.WorkSync.checkFailure(WorkSync.java:178)
	at org.neo4j.util.concurrent.WorkSync.apply(WorkSync.java:89)
	at org.neo4j.internal.recordstorage.BatchContext.applyPendingLabelAndIndexUpdates(BatchContext.java:119)
	... 50 more
Caused by: java.lang.IllegalStateException: Cannot call update() when index state is INIT
	at org.neo4j.kernel.impl.api.index.ContractCheckingIndexProxy.openCall(ContractCheckingIndexProxy.java:209)
	at org.neo4j.kernel.impl.api.index.ContractCheckingIndexProxy.newUpdater(ContractCheckingIndexProxy.java:99)
	at org.neo4j.kernel.impl.api.index.IndexUpdaterMap.getUpdater(IndexUpdaterMap.java:66)
	at org.neo4j.kernel.impl.api.index.IndexingService.processUpdate(IndexingService.java:644)
	at org.neo4j.kernel.impl.api.index.IndexingService.apply(IndexingService.java:603)
	at org.neo4j.kernel.impl.api.index.IndexingService.applyUpdates(IndexingService.java:588)
	at org.neo4j.internal.recordstorage.IndexUpdatesWork.apply(IndexUpdatesWork.java:62)
	at org.neo4j.internal.recordstorage.IndexUpdatesWork.apply(IndexUpdatesWork.java:39)
	at org.neo4j.util.concurrent.WorkSync.doSynchronizedWork(WorkSync.java:222)
	at org.neo4j.util.concurrent.WorkSync.tryDoWork(WorkSync.java:153)
	... 52 more
0 REPLIES 0