Open tr11 opened 10 years ago
Its an interesting idea, but I don't really know if it is that useful. I mean, one could always lock the table explicitly.
I'm keeping it open for now.
Thanks for looking into this. I agree, we can always specify the lock explicitly. The reason I put this together was to be able to enforce the lock at the server/table creation instead of relying on the client to do the right thing and lock the table on any write operation. In the meantime, part of the changes in my branch fix an apparent issue with the refcount of the python instances. I moved that part a new branch (link). Let me know, I can submit a pull request for this if it seems good.
I created a branch (link) witch code that recognizes a new option on the table creation statement, "write_lock_mode". Please take a look at it. I can submit a pull request if this is a desirable feature.
The current behavior remains the default one; if the option is not specified, the code behaves similarly to how it works right now. If, otherwise, one passes a valid lock mode, the (local) foreign table is locked accordingly. This is useful for remotes that have no natural mechanism for concurrent writes (for example, writing to a file).
The code locks the table when it enters a modify block and keeps the lock until the transaction commits or rolls back.