[erlang-questions] DETS - {error,{not_closed, <FILE>}}

Ahmed Omar spawn.think@REDACTED
Thu Sep 12 10:15:23 CEST 2013


Hi Philip,


1) Yes, you can. You need to make sure the table is flushed to disk, not to
require repair. So your options are

a) call dets:sync on your table from process A, and then start process B
from there

b) maintain a low auto_save value.


I would recommend you open the file, do sync, and then wait for B to start
before writing to the table.


2) Yes, because repair is done then.


Note: I don't think it's a good idea to post same question twice on the
list (with one different condition).

Maybe it's better you reply to the original one with extra cases.


Best Regards,
- Ahmed Omar
http://about.me/spawn.think/


On Wed, Sep 11, 2013 at 3:59 PM, Phillip Sibanda <
phillips@REDACTED> wrote:

>  Hello Everyone,
>
> I have a Proc A which has an open Dets table and is doing a high rate of
> read and writes to the Dets table.
>
> I would like Proc B to have read-only access to same Dets table. An
> attempt to open the file with read-only access by Proc B results in  {error,{not_closed,
> <FILE>}} as follows
>
>     > dets:open_file(tab, [{access, read}, {file, <FILE>}]).
>     {error,{not_closed, <FILE>}}
>
> However when Proc B attempts to open the table in read-write(default)
> mode, the table is opened successfully. From my understanding the default
> option works because it will result in an attempt to repair the table
> before it is opened. I'm bit wary of this because I want only Process A to
> make any changes to the table.
>
> My questions:
>
> 1. Is there an alternative way to allow Process B read-only access to the
> table?
>         - preferably without Process A closing the table
>
> 2. Do I understand correctly that the default option works because the
> table is repaired?
>
> Regards,
> Phillip
>
>
> --
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130912/98d7b9dd/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pharos_signature.jpg
Type: image/jpeg
Size: 22822 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130912/98d7b9dd/attachment.jpg>


More information about the erlang-questions mailing list