java - Berkeley DB JE JDB文件不断增加

标签 java berkeley-db-je

我正在调试系统中的磁盘空间问题,发现 .jdb 文件占用了大部分空间。

浏览时,发现此链接https://backstage.forgerock.com/knowledge/kb/article/a14630082 ,就我而言,lnSizeCorrectionFactor 约为 1.4 并且 fileDeleted=false。 我运行磁盘空间命令来查找空间利用率,结果发现所有 jdb 文件都非零,但大多数文件的利用率为 2-9 之间的个位数值。

我使用的是je-5.0.58版本,这不是最新的。我的问题是根据 BDB 文档 https://docs.oracle.com/cd/E17277_02/html/GettingStartedGuide/backgroundthreads.html#cleaner ,如果jdb文件达到小于默认值50%,则需要清理。就我而言,即使它们只有个位数,为什么它们没有得到清理?

我没有明确设置任何环境配置,因此根据定义它应该使用默认值。下面是创建 bdb 存储库的代码。

 private static Repository createBDBRepository(File environmentHome) throws 
 RepositoryException {
            BDBRepositoryBuilder builder = new BDBRepositoryBuilder();
            builder.setName("localbdb");
            builder.setEnvironmentHomeFile(environmentHome);
            builder.setTransactionNoSync(false);

            // Set BDB-JE flavor
            builder.setProduct("JE");

            builder.setCacheSize(20 * 1024 * 1024L);
            return builder.build();
    }

来自 je.info 文件的日志行

   Chose lowest utilized file for cleaning. fileChosen: 0x50cbecc totalUtilization: 49 bestFileUtilization: 8 lnSizeCorrectionFactor: 1.1012049 isProbe: false
   No file selected for cleaning. totalUtilization: 50 bestFileUtilization: 8 lnSizeCorrectionFactor: 1.1012049 isProbe: false

最佳答案

正如 ForgeRock 文档所述,这是由于 BDB JE 版本 5 中的错误造成的,该错误已在版本 6 及更高版本中得到解决。

引用 BDB JE 6.x 发行说明:

An improvement was made to the calculation of log utilization to avoid under-cleaning or over-cleaning. For example, when log utilization was estimated to be lower than actual utilization, unnecessary over-cleaning would occur, which could reduce performance. Or when log utilization was estimated to be higher than actual utilization, under-cleaning would prevent reclaiming unused disk space. To prevent these problems, the size of each logged record is now stored in the Btree BINs (bottom internal nodes), so that utilization can be calculated correctly during record updates and deletions, while still avoiding a fetch of the old version of the record. With this change, the utilization adjustment facility in the log cleaner, which attempted to compensate for this problem by estimating utilization, is no longer needed by most applications.

Therefore the EnvironmentConfig.CLEANER_ADJUST_UTILIZATION parameter is now false by default rather than true, and will be disabled completely in a future version of JE. For more information, see the javadoc for this parameter.

[#22275] (6.0.7)

关于java - Berkeley DB JE JDB文件不断增加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53721182/

相关文章:

java - 使用 ActionListeners 并且无法将文本字段设置为不可见

java - 使用 Ant 部署 Web 应用程序导致 NoClassDefFoundError

java - 扫描仪和用户输入

javascript - Java 和 Javascript - Lastmodified 在 Linux 上

java - 在多数据库、单 Berkeley DB JE 环境中删除数据库

java - 使用 JPL 在 Java 中的 BDB 中存储子类

performance - Berkeley DB Java 版 - 调整大量数据

java - 在测试用例期间部署工件 - JBoss AS

berkeley-db - berkeley-db-je 的最新版本是什么?