i have a key/data hash table database. In which i have exposed an interface to traverse and print the the entire table (say, getall_contents()). I am using cursor implementation to go to the each record in a loop.
This interface is present in an application(say, mydbapplication) and can be accessed by other applications (say, test_mydbapplication).
My algorithm in getall_contents() function is,
while(End of table)
cursor(); // getcursor
c_get(,,,DB_SET_RANGE);//set cursor to last fetched item in the table. This statement will be exempted for first item of the table.
c_get(,,,DB_NEXT);//get the next item
c_close();//close cursor, to allow other application to write(if any) and avoid any deadlocks.
This function works fine if accessed by one application at a time. However if accessed by more than one application simultaneously, then c_get(,,,DB_SET_RANGE) returns -30989, even if data that i want to set is in the mid of the table.
My testing environment output :
i access API getall_contents() through my test_mydbapplication in two consoles, first console's output is incomplete, meaning it doesnt print all the contents of hash table and returns with return value -30989. But the second console prints all the contents and returns with return value -30989.
Note : -30989 is the return value am getting when an end of table is reached, in a working scenario as well.
So my question is,
Why does c_get(,,,DB_SET_RANGE) returns end of table, when accessed by more than one application ?
Note : Same logic works fine when accessed through single application.