A call to ctdbSetBatch() with the CTBATCH_LOCK_KEEP option did not prevent ctdbEndBatch() from releasing locks on records acquired by a batch read. Here is an example that demonstrates this behavior:
if ((rc = ctdbSetBatch(pRecord,CTBATCH_GET | CTBATCH_PHYS | BAT_RET_BLK | CTBATCH_LOCK_WRITE | CTBATCH_LOCK_KEEP,0,rbufsiz))) {
printf(""Error: Failed to initialize batch: %d\n"",
rc);
goto err_ret;
}
rc = ctdbNextBatch(pRecord);
rc = ctdbEndBatch(pRecord);
/* locks have been released--unexpected */
You can use the ctstat utility's filelocks option to check that the locks were still being held after the ctdbEndBatch() call. For example:
ctstat -filelocks myfile.dat -h 1 -i 2 -u ADMIN -p ADMIN -s FAIRCOMS
The logic has been modified to address this issue.