How to read Apache Derby database log?

筅森魡賤 提交于 2019-11-29 22:45:11

问题


I'd like to have a peek at Derby's database log; I don't mean the derby.log file, I'm talking about the binary log files in the /[database name]/log directory. Is there a tool that can display them in a human-readable format?

My reason for asking is that I'm using Apache Derby (version 10.6.1.0) for automatic integration tests, with the help of Maven Failsafe plug-in. Some tests execute transactional code that locks records (OpenJPA is used as an ORM tool). Sometimes, with a certain ordering of tests, it happens that a test waits forever for a lock, causing the build to hang. The same test, when run separately, passes. All the stranger thing is that every test drops, creates and fills all tables before it runs, so it's hard to see obvious reasons for this behaviour.

The problem has been worked around by putting the failing tests in a separate Failsafe execution; still, I'd like to read the log to see what's going on.


回答1:


There do exist such tools, but they're quite low-level. Here's a place you can find them: https://issues.apache.org/jira/browse/DERBY-5195

Diagnosing locking problems such as these is very challenging; hopefully reading the logs will give you some clues. The logs will only contain information about update activity, so you will need to infer read activity using other means.

Another thing you might try is to see if you can augment your testing process to include invocations of the lock_table data (http://db.apache.org/derby/docs/10.8/devguide/cdevconcepts50894.html).

Probably either: (a) your ORM tool is running more/different code than you think it's running, or (b) your ORM tool is not expressing the transaction boundaries the way you think it is.

Best of luck!



来源:https://stackoverflow.com/questions/6744985/how-to-read-apache-derby-database-log

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!