1

I'm having the following situation:

  • A configuration file (config.cfg) that gets accessed a lot by different processes.
  • Config.cfg is under version control - SVN.

I develop and test on a staging environment, when everything is working I go to the server and execute svn up on the config.cfg.

The problem is: During svn up I get an exception by the processes accessing config.cfg: "config.cfg" not found.

It seems that svn causes a short period where the file is beeing replaced and therefore not accessible for my processes.

Any input on how to solve this issue is very much appreciated.

4
  • 1
    Updating a file while processes are actively reading from it seems...not wise. I would consider some kind of file locking mechanism to avoid this. Aug 27, 2014 at 16:01
  • I don't see how I can apply this concept in my case. I'm running "svn up" in the shell when I'm rolling out new configuration files. So there is nothing I can do programmatically.
    – elToro
    Aug 28, 2014 at 8:17
  • 1
    "there is nothing I can do" is a pretty broad statement. You might want to investigate more before coming to a conclusion like that. If you control the code to the processes accessing the config file(s), you can add a bit to access a semaphore file; then you can wrap svn up in a script that checks the same semaphore file to see if it's safe to update the file. There are many different permutations you could consider. Aug 28, 2014 at 14:31
  • True :-) Shame on me. I will implement your suggestion.
    – elToro
    Aug 29, 2014 at 7:46

1 Answer 1

1

As suggested by ThisSuitIsBlackNot the way to go is to use a semaphor file.

Another solution which just came to my mind is to cache the config file in the process. If it is not there the cached version of the config file is used. As "svn update" doesn't take very long the process will work with cached version until it needs to use the config file the next time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.