Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Will these functions for use with Storable properly lock my file?

by stevieb (Canon)
on Aug 03, 2021 at 14:59 UTC ( #11135579=note: print w/replies, xml ) Need Help??


in reply to Will these functions for use with Storable properly lock my file?

But I'm worried that there might be something I'm missing that will cause me to lose data.

What happens if a process finds it can't write to the file? Will you queue that data for later? If not, there's data loss right there.

If losing data is the real concern, why not use a database that has no issues with simultaneous writes? How about an asynchronous system where one function queues up all of the data from all processes, then writes the file when it knows it's safe to do so?

You haven't described the type of data being written, so I'm just guessing.

  • Comment on Re: Will these functions for use with Storable properly lock my file?

Replies are listed 'Best First'.
Re^2: Will these functions for use with Storable properly lock my file?
by nysus (Parson) on Aug 04, 2021 at 01:49 UTC

    These are definitely things to think about. Fortunately, this data I'm working with is just a cache of information that's on the network that can be restored pretty easily. It's not a huge deal if the file gets corrupted. But I should definitely figure out a way to get alerted to a problem so I can reload the data from the network.

    No database on this server and it would be overkill for a non-critical cache.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

Re^2: Will these functions for use with Storable properly lock my file?
by nysus (Parson) on Aug 04, 2021 at 02:02 UTC

    As I noodle this out in my head, I don't think a database would help in this case. The process has to lock the file for the entire duration of the time it has the data file "checked out," not just for the brief periods while performing write and read operations.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
    $nysus = $PM . ' ' . $MCF;
    Click here if you love Perl Monks

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135579]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2022-01-25 17:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (67 votes). Check out past polls.

    Notices?