erlang 当应用程序启动时,Mnesia disc_copies表是如何存储在RAM中的?

j91ykkif  于 2022-12-08  发布在  Erlang
关注(0)|答案(1)|浏览(169)

I have a table A of type disc_copies. It has two files on the disk.

  1. A.DCD - last modified time 30th Aug
  2. A.DCL - today(7th Sep)
    As per my understanding, A.DCL is log file and A.DCD has all the data. Today I have done multiple operations on A, however A.DCD remains same but size of A.DCL was increased. When my application starts how this table gets stored in ram when DCD file is not changed. Proper Documentation is not available, so can anyone tell what is the exact process ? Also DCD file gets very large over the time even though there is no data in the table, can anyone clarify ?
zpjtge22

zpjtge221#

对于disc_copies表,数据在Mnesia启动时读入ETS表,因此整个表存在于RAM中。DCD是最新的完整快照,DCL文件包含快照后所做的更改,因此首先加载DCD,然后应用DCL条目。在表上执行操作时,条目将附加到DCL。当DCL增长到足够大时,Mnesia将进行新的完全DCD转储并清空DCL。
由于在运行时所有数据都在RAM中,所以像全表搜索这样的操作非常快,但最终可能需要大量RAM,而且启动时间可能会相当长。

相关问题