内存数据库H2的Clustering模式数据操作测试 (2)

 

Test_Update

  1. 初始数据:

Server1:

ID  

NAME  

1

1

2

22

3

3

4

4

5

5

Server2:

ID  

NAME  

1

1

2

2

4

4

5

55

6

6

 

  1. Server1Server2正常启动,Client基于Server1

update test set name = '111' where id = 1;

commit;

update test set name = '222' where id = 2;

commit;

update test set name = '333' where id = 3;

commit;

update test set name = '555' where id = 5;

commit;

update test set name = '666' where id = 6;

commit;

 

结果:

update test set name = '111' where id = 1;

Update count: 1

(15 ms)

 

commit;

Update count: 0

(0 ms)

 

update test set name = '222' where id = 2;

Update count: 1

(0 ms)

 

commit;

Update count: 0

(0 ms)

 

update test set name = '333' where id = 3;

Update count: 0

(0 ms)

 

commit;

Update count: 0

(0 ms)

 

update test set name = '555' where id = 5;

Update count: 1

(0 ms)

 

commit;

Update count: 0

(0 ms)

 

update test set name = '666' where id = 6;

Update count: 1

(16 ms)

 

commit;

Update count: 0

(0 ms)

 

Server1:

ID  

NAME  

1

111

2

222

3

333

4

4

5

555

 

Server2:

ID  

NAME  

1

111

2

222

4

4

5

555

6

666

 

说明更新对两个DB都启作用了,即使DB中的记录不一致

 

  1. 重启Server1Client 不重连接(基于Server2

update test set name = '3333' where id = 3;

commit;

update test set name = '444' where id = 4;

commit;

 

结果:

update test set name = '3333' where id = 3;

Update count: 0

(0 ms)

 

commit;

Update count: 0

(0 ms)

 

update test set name = '444' where id = 4;

Update count: 1

(0 ms)

 

commit;

Update count: 0

(0 ms)

 

Server1:

ID  

NAME  

1

111

2

222

3

333

4

4

5

555

 

Server2:

ID  

NAME  

1

111

2

222

4

444

5

555

6

666

 

说明没重连,对Server2的操作没有同步到Server1

 

  1. 重启Server2Client 不重连接(基于Server1

update test set name = '1111' where id = 1;

commit;

update test set name = '44' where id = 4;

commit;

结果:

update test set name = '1111' where id = 1;

Update count: 1

(0 ms)

 

commit;

Update count: 0

(0 ms)

 

update test set name = '44' where id = 4;

Update count: 1

(0 ms)

 

commit;

Update count: 0

(0 ms)

Server1:

ID  

NAME  

1

1111

2

222

3

333

4

44

5

555

Server2:

ID  

NAME  

1

111

2

222

4

444

5

555

6

666

说明没重连,Server2没有影响

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值