Hi Ranchers How should we handle the following condition: Suppose a client calls lock(5) and then he calls lock(-1) without unlocking the previous rec 5. a. Should the lock manager wait for a call of unlock(-5) b. should the lock managet smart enough to give whole db lock as it knows the rec 5 is locked by the same client (subject to condition that all the other records are free) I know some people argue that lock(-1) is for shutdown so this will never happen but i still believe that db lock can also be taken by clients as the application grows
In what world will a client have to lock all the records?
IT world. Imagine you must add a record to a db based on the values of the last record stored. Imagine there is a field which contains a date value, so that you can compute which is the last stored record. So, you read and lock this last record, compute new values and add a new record. Let's suppose there is another application that is constantly modifying the date field of stored records and adding new records. How do you prevent this second application from corrupting your data? The only way is blocking the database (the table, at least). This block must prevent record modification, deletion and addition. Amit, I treat differently database locks from record locks. A client can get a database lock if all the locked records in the database are his. After that, to unlock all the records the client must unlock the database and still unlock the individual records previously locked. After getting a database lock no other client can add, delete or modify records. However, after seeing a lot of posts I don't think this is required in this assignment. I wish I had realized that before implementing it.
I think she's lovely. It's this tiny ad that called her crazy: