sqlg
sqlg copied to clipboard
supportsTransactionalSchema cause metadata sync problem in multi jvms
when we add graph change notify support by kafka for database not postgre, we found that metadata of different nodes is not the same in multi jvm nodes senario.
we implement notifyChange by send kafka message, and all nodes listen the same topic to recieve change and notifyFromJson.
but we found TestMultipleThreadMultipleJvm.java we reproduce the problem. and the root cause is the code in Topology.java as below:
this.sqlgGraph.tx().afterRollback(() -> {
if (this.sqlgGraph.getSqlDialect().supportsTransactionalSchema()) {
afterRollback();
} else {
afterCommit();
}
});
when the database not supportsTransactionalSchema, this code indicate that use commit instead of rollback, and this will cause the change is not be send.