[erlang-bugs] ets:new/2 and ets:all/0 concurrency issue

Sverker Eriksson <>
Thu Feb 6 14:55:48 CET 2014


On 02/06/2014 12:57 PM, Florian Schintke wrote:
>> Just to clearify on the subject of ets:all() and concurrency.
>>
>> ets:all() does not give any guarantee of consistency. Each table
>> created or deleted by other processes "during" the ets:all() call
>> may or may not be included in the result.
>>
>> However, as pointed out, tables known to have been created/deleted
>> *before* the call to ets:all() should of course be included/excluded
>> in the result (or so they will in 17.0).
> To 'know' may be a bit vague, so please could you clarify further
> which guarantee ets:all() should provide (and may be include it in the
> documentation then:
>
> (1) When process A creates/deletes a table T and sends a message to
>      process B with the table id, process B will always see the change in
>      the result of ets:all()?
>
> or
>
> (2) Inside a single process ets:all() represents locally known changes
>      to table-existence (create/delete)?
>
>
By 'know' I mean your (1) with the extension that "sends a message to" 
can be any inter processes communication (!, TCP, ETS or any other 
protocol or shared memory)
and "with the table id" is irrelevant. The important thing is that 
process B must 'know', when calling ets:all(), that process A has 
returned from ets:new or ets:delete to be guaranteed to see the result.


Clear and precise formulations to be included in the docs are welcome :-)

/Sverker



More information about the erlang-bugs mailing list