Hi guys!
I've been testing basic h2 cluster setup and came across several issues.
Using version 1.4.191.
1. Documentation for cluster specifies "-urlSource
jdbc:h2:tcp://localhost:9101/~/test -urlTarget
jdbc:h2:tcp://localhost:9102/~/test", but starting CreateCluster tool
results in
org.h2.jdbc.JdbcSQLException: IO Exception: "/Users/dmitry.murashenkov/test
outside /Users/dmitry.murashenkov/test/server2" [90028-191]
I fixed it by using "." dir like this "-urlSource
jdbc:h2:tcp://localhost:9101/./test -urlTarget
jdbc:h2:tcp://localhost:9102/./test". Seems documentation should be updated?
2. I the started cluster according to documentation and launched a simple
test client. Schema consists of single table with single integer column and
1 row. Client performs infinite look of 2 sequential operations "update t1
set value = value + 1" and then "select value from t1" and prints value to
console.
So the output is simple:
1
2
3
Then I stop primary node - loop continues to run without problems. But then
I restart the node I just stopped - loop outputs:
61
62
... node1 stopped here
121
122
... node1 started here
63
64
So it seems that driver switches back to first node, but the data is
already inconsistent. I understand that current clustering is very basic,
so I just want to know - if this behavior is expected in current
implementation or am I doing something incorrectly?
One more issue here is that behavior is same even if I don't run
CreateCluster tool initialy - is this expected? Seems CreateCluster does
nothing.
3. Next comes hypothetical question about concurrent queries. Suppose I
have 2 h2 nodes in cluster and application which opens several sql
connections (connection pool, for example). App performs 2 queries
concurrently in different threads:
A: insert into t1 values ('123');
B: delete from t1;
For example on node1 first query A was executed and then B - final state is
that t1 is empty. Is there a guarantee that on node2 after statement
replication t1 will be empty too? Or can statements be replicated in
another order?
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.