• Logs contain entries for both the data and cluster membership • Entries are appended and subsequently committed if a simple majority agree • Implication: majority agree with the log as proposed • Anyone can call an election: highest term (logical clock) wins, followed by highest committed, followed by highest appended • Appended but uncommitted entries can be truncated, but this is safe (transaction aborted)
dri ver< / gr oupI d> < art i f act I d> neo4j -j ava-dri ver< / art i f act I d> < / dependency> Python pi p i nst al l neo4j -dri ver .NET PM > I nst al l - Package N eo4j . D ri ver JavaScript npm i nst al l neo4j -dri ver
dri ver( "bol t + r out i ng: / / aCor eServer" ) ; t ry ( Sessi on sessi on = dri ver. sessi on( AccessM ode. W RI TE ) ) { t ry ( Transact i on t x = sessi on. begi nTransact i on( ) ) { t x. run( "M ERG E ( user : User {userI d: {userI d}}) ", param et ers( "userI d", userI d ) ) ; t x. success( ) ; } }
dri ver( "bol t + r out i ng: / / aCor eServer" ) ; t ry ( Sessi on sessi on = dri ver. sessi on( AccessM ode. READ ) ) { t ry ( Transact i on t x = sessi on. begi nTransact i on( ) ) { t x. run( "M ATCH ( user : User {userI d: {userI d}}) - [ *] - ( : Pr oduct ) RETURN *", param et ers( "userI d", userI d ) ) ; t x. success( ) ; } }
1 2 3 4 5 6 7 8 9 10 1 1 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 If I query this server I won’t see the updates from transaction . If I query this server, I’ll see all updates from all committed transactions 1 1 1 1 This is normal behaviour
dri ver. sessi on( AccessM ode. W RI TE ) ) { t ry ( Transact i on t x = sessi on. begi nTransact i on( ) ) { t x. run( "CREATE ( user : User {userI d: {userI d}, passw or dHash: {passw or dHash}) ", param et ers( "userI d", userI d, "passw or dH ash", passw or dH ash ) ); t x. success( ) ; } St ri ng bookm ark = sessi on. l ast Bookm ark( ) ; }
= dri ver. sessi on( AccessM ode. READ ) ) { t ry ( Transact i on t x = sessi on. begi nTransact i on( bookm ark ) ) { t x. run( "M ATCH ( user : User {userI d: {userI d}}) RETURN *", param et ers( "userI d", userI d ) ) ; t x. success( ) ; } }