Erlang “与”的区别是什么;生的;脏操作和mnesia内的脏操作:异步\u事务

Erlang “与”的区别是什么;生的;脏操作和mnesia内的脏操作:异步\u事务,erlang,mnesia,Erlang,Mnesia,在传递给mnesia:async_dirty()的函数中执行的一系列mnesia:dirty_uu命令与“原始”执行的相同事务之间有什么区别 即,执行以下操作之间是否有任何区别: mnesia:dirty_write({table, Rec1}), mnesia:dirty_write({table, Rec1}), mnesia:dirty_write({table, Rec1}) 及 谢谢让我们先引用一下关于async\u dirty上下文的用户指南: By passing the sam

在传递给mnesia:async_dirty()的函数中执行的一系列mnesia:dirty_uu命令与“原始”执行的相同事务之间有什么区别

即,执行以下操作之间是否有任何区别:

mnesia:dirty_write({table, Rec1}),
mnesia:dirty_write({table, Rec1}),
mnesia:dirty_write({table, Rec1})


谢谢

让我们先引用一下关于
async\u dirty
上下文的用户指南:

By passing the same "fun" as argument to the function
mnesia:async_dirty(Fun [, Args]) it will be performed in dirty context.
The function calls will be mapped to the corresponding dirty functions.
This will still involve logging, replication and subscriptions but there will be
no locking, local transaction storage or commit protocols involved. Checkpoint
retainers will be updated but will be updated "dirty". Thus, they will be updated
asynchronously. The functions will wait for the operation to be performed on one
node but not the others. If the table resides locally no waiting will occur. 通过将与参数相同的“fun”传递给函数
mnesia:async_dirty(fun[,Args]),它将在dirty上下文中执行
函数调用将映射到相应的脏函数。
这仍将涉及日志记录、复制和订阅,但不会涉及锁定、本地事务存储或提交协议。检查点
将更新夹持器,但将更新为“脏”。因此,它们将被异步更新。这些功能将等待在一个
节点上执行操作,而不是在其他节点上执行操作。如果表驻留在本地,则不会发生等待。
您提供的两个选项将以相同的方式执行。但是,当您在选项1中执行
fun
中的脏函数时,每个函数都是对mnesia的单独调用。使用
async\u dirty
,这3个调用将被捆绑,mnesia将只等待3个调用在本地节点上完成后返回
然而,在mnesia多节点集群中,这两者的行为可能不同。做一些测试:)

你是什么意思“…这两种行为在多节点集群中可能不同”,你是说你不知道它是否会不同,你知道它会不同但不知道如何,还是你知道但不告诉我?我知道它们会不同,但我不知道具体是如何做到的:)否决了这一点,因为我有同样的问题,而这个答案是不充分的。如果您阅读async_dirty文档,它会说:“对于正常的mnesia:dirty_*操作,这些操作是半异步执行的。”。半异步在这里意味着什么?来自的另一个注释。“”“无论启动了哪个活动访问上下文,函数mnesia:dirty_*始终以异步_dirty语义执行。它甚至可以在没有任何封闭的活动访问上下文的情况下启动上下文。”“” By passing the same "fun" as argument to the function
mnesia:async_dirty(Fun [, Args]) it will be performed in dirty context.
The function calls will be mapped to the corresponding dirty functions.
This will still involve logging, replication and subscriptions but there will be
no locking, local transaction storage or commit protocols involved. Checkpoint
retainers will be updated but will be updated "dirty". Thus, they will be updated
asynchronously. The functions will wait for the operation to be performed on one
node but not the others. If the table resides locally no waiting will occur.