hsqldb忽略对服务器上的表的首次插入操作(服务器是否需要“预热"?) [英] hsqldb ignores first insert operation on table at server (server needs to be "warmed up"?)

查看:68
本文介绍了hsqldb忽略对服务器上的表的首次插入操作(服务器是否需要“预热"?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hsqldb存在一个非常奇怪的问题.我们正在运行一些在MySQL上运行良好的测试,但是最近我们已将hsqldb转换为单元测试.这样做时,我们注意到我们的某些测试开始失败.其中一个测试会插入三个记录A,B和C,并尝试检索前两个记录A和B.但是,当我们第一次在新配置的(空)数据库上运行测试时,仅返回B.但是,如果我们在同一数据库上重复测试,则将同时返回A'和B'(在您询问之前,是的,A,B和C与A',B'和C'不同).

We're having a very curious problem with hsqldb. We are running some tests which works perfectly well on MySQL, but we have recently switched to hsqldb for our unit tests. In doing so, we noticed that some of our tests started to fail. One of the tests inserts three records A, B and C, and attempts to retrieve the first two, A and B. However, only B is returned the first time we run the test on a freshly configured (empty) database. However, if we repeat the test on the same database, both A' and B' are returned (before you ask, yes A, B and C are different from A', B' and C').

我们试图强迫数据库保留记录,并且插入了延迟.似乎没有任何帮助,只需要一次插入即可预热数据库".如果我们随后检查hsqldb日志,它们将包含所有插入语句,甚至是我们第一次在数据库上运行时都无法使用SELECT检索的语句.

We have attempted to force the database to persist the records, and we have inserted delays. Nothing seems to help, except "warming up the database" with a single insert. If we check the hsqldb logs afterwards they contain all the insert statements, even the ones we are unable to retrieve using SELECT in our first run on the database.

是否有人需要通过虚拟插入语句预热" hsqldb的问题?如果我们在运行测试之前使用垃圾执行插入语句,它们也将成功完成.

Has anybody ever experienced issues with hsqldb needing to be "warmed up" with a dummy insert statement? If we perform an insert statement with garbage before running our tests they will also complete successfully.

我们已经在hsqldb 2.0.0和2.1.0上进行了测试.两种版本产生相同的结果.

We have tested on hsqldb 2.0.0 and 2.1.0. Both versions yield the same result.

推荐答案

我从未使用过hsqldb,但是您尝试过INSERT INTO ...; COMMIT;然后运行SELECT ..吗?

I have never used hsqldb but have you tried INSERT INTO ...; COMMIT; and then run SELECT ..?

延迟数据库操作(INSERT,UPDATE或DELETE)并非没有道理.当数据库负载不高但您不能指望它时,应该不会发生这种情况.

It's not unreasonable for a database operation (INSERT, UPDATE or DELETE) to be delayed. It probably shouldn't happen when database is not under heavy load but you can't count on it.

这篇关于hsqldb忽略对服务器上的表的首次插入操作(服务器是否需要“预热"?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆