Search code examples
javaneo4jtransactionsspring-data-neo4j-4neo4j-ogm

Neo4j-ogm X-Write header management for HA


I'm using:

  • spring-data-neo4j 4.2.0.BUILD-SNAPSHOT
  • neo4j-ogm 2.1.0-SNAPSHOT
  • neo4j 3.0.7

and I'm having problems with the new X-Write HTTP header set by neo4j-ogm.

We use this header in our HAProxy configuration to redirect write transactions to master neo4j node.

Our spring-data-neo4j write transactions are doing multiple calls to neo4j:

  • POST .../db/data/transaction/1 {"statements":[{"statement":"request1"}...]}
  • POST .../db/data/transaction/1 {"statements":[{"statement":"request2"}...]}
  • POST .../db/data/transaction/1/commit

All HTTP REST calls correctly contain the X-WRITE header, except the last call to commit the transaction that seem not to contain this header. So this call is sometimes sent to a slave node where the transaction is not existing.

Is it a bug in neo4j-ogm ?


Solution

  • This has been fixed in neo4j-ogm 2.1.1-SNAPSHOT via https://github.com/neo4j/neo4j-ogm/pull/300.

    X-WRITE should now appear in the header on commit/rollback.