"rtdb open old failed" on BG/Q when old rtdb file exists


Click here for full thread
Clicked A Few Times
solution
I have found the cause of this problem, as well as a simple solution. It would seem that rtdb_open_seq is failing when set to "old" mode because it checks for file existence using the access() syscall. Apparently the BG/Q access() implementation (at least on our BG/Q - I do not know if it is universal) always fails for R_OK | W_OK flags unless the file permission bits are set to 777 (or possibly 666, it occurred to me just now that I did not test this case). In any case, these are not the default permission bits for new files, so rtdb files produced by a calculation cannot be reused without first modifying the permissions accordingly.

To get around this, I have modified src/rtdb/rtdb_seq.c, changing the code near line 313 in rtdb_seq_open():
   int exists = access(filename, R_OK | W_OK) == 0;

to
 #if defined(__bgq__)
   int exists = access(filename, F_OK) == 0;
 #else
   int exists = access(filename, R_OK | W_OK) == 0;
 #endif

This fixes this behavior on BG/Q while leaving behavior on other platforms unchanged.