如果开启journal,在dbpath选项指定的目录下会创建journal目录来存放journal文件,文件名形如j._<n>。journal文件用于数据库异常退出时恢复数据。这里是解析journal文件的示例代码。

journal文件的大小定义如下,smallfiles选项可以指定为128M。

// Rotate after reaching this data size in a journal (j._<n>) file
// We use a smaller size for 32 bit as the journal is mmapped during recovery (only)
// Note if you take a set of datafiles, including journal files, from 32->64 or vice-versa, it must 
// work.  (and should as-is)
// --smallfiles makes the limit small.

#if defined(_DEBUG)
        unsigned long long DataLimitPerJournalFile = 128 * 1024 * 1024;
#elif defined(__APPLE__)
        // assuming a developer box if OS X
        unsigned long long DataLimitPerJournalFile = 256 * 1024 * 1024;
#else
        unsigned long long DataLimitPerJournalFile
            = (sizeof(void*)==4) ? 256 * 1024 * 1024 : 1 * 1024 * 1024 * 1024;
#endif
DataLimitPerJournalFile

相关文章:

  • 2022-02-01
  • 2022-12-23
  • 2021-09-27
  • 2022-01-07
  • 2021-09-13
  • 2021-12-12
  • 2022-12-23
猜你喜欢
  • 2021-08-19
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-02-20
  • 2021-09-27
  • 2021-07-19
相关资源
相似解决方案