Focal Point
[SOLVED] Can we wait for release of a file lock?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8947050776

July 02, 2015, 05:10 AM
Wep5622
[SOLVED] Can we wait for release of a file lock?
We have three reporting servers, a production server, a test server and a remote server. The first two both run a scheduled (rcaster) job to create a permanent HOLD-file on the remote server.

Obviously, this creates problems when they attempt to do so at the same time, as they would be writing to the same remote file on the same server.

It's easy enough to add a check to the procedure that causes it to skip the creation of the remote HOLD-file on the test-server (we have global variables in the server profiles that identify whether a reporting server is 'Production' or 'Test'), but that leaves us with another problem:

If the test-server skips the creation of the remote HOLD-file, it continues with the code after the creation bit and will attempt to read the file. Since creation of that file (now only done by the production server) takes a while, the test server would be reading an incomplete file!

I assume that the file will be locked while the production server is still writing to it on the remote server. Is there some way we can make the procedure on the test server wait until that lock is released?

Are there other solutions or ideas?

For the record, we would prefer to keep procedures and schedules on production and test the same, so that we can safely deploy them without the need (=chance that we forget) to adjust them for their environment.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
July 02, 2015, 10:35 AM
eric.woerle
Wep,

Why not write a temporary file that says the status of the load? You could check the status of the load and if its not complete, sleep the procedure or exit out with a message.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
July 03, 2015, 04:58 AM
Wep5622
Right, just create a PID-file like it's done on many UNIX systems like forever. So simple that it escaped me. Thanks!


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :