|
|
|
|||||
|
How to handle distributed transactions
My following question is not specific to Ice, but concerns a general issue in distributed computing.
For our DMS we need transactions which write files to a fileserver and simultaneously the corresponding metadata to a database. The file upload is handled by an interface CFileUpload(). This interface first writes the file to a temporary location on the file server, so that it can easily be removed in case of a failure. CFileUpload::commit() transfers the file to the persistent area on the file server and writes the metadata into the database. It can however not commit the database transaction as within that same transaction other database operations are executed via other interfaces to create other objects which may be associated with the file. For the client, the whole shebang must look like one transaction - either all the database objects and all uploaded files are committet or nothing of all. But how to hook this together? I suggested to proceed like this: --------------- class CDMSSessionI : virtual public CDMSSession { ... CFileUploadSequence openFileUploads; CDatabaseSession* dbSession; void registerFileUpload(CFileUploadPtr pFileUPload) { openFileUploads.push_back(pFileUpload); } void commit() { foreach pFileUpload in openFileUploads { // Pseudocode pFileUpload->commit(); } dbSession->commit(); } ... }; ... CFileUploadI::CFileUploadI(Ice::Current& current) { CDMSSessionI* pSess = getDMSSessionFromCurrent(current); pSess->registerFileUpload(this); } ----------------- So CFileUpload registers itself at the DMS Session which it uses to enable that DMS Session to commit all relevant file uploads within it's commit() method. Our project team is not sure if this is the best approach as for simplicity, elegance and encapsulation. Can you comment on it? Should you have a better idea, it would be welcome, of course! And by the way, can you give us an estimated target date for the release of Ice 1.6? Thanks! Robert. |
|
|||||
|
Hi Marc!
Quote:
).For example, is it likely that Ice 1.6 aka 2.0 will bring something like a transaction manager as seen in the CORBA specs or is there no customer demand apart from this question? So many critical points of distributed applications where solved with Ice due to its simplicity, so I'd expect something similar for the holy grail of distributed applications (-> distributed transactions) as well. I think, some additional comments from your side would be worth reading for the entire Ice community ![]() Kind regards, Stephan |
|
||||||
|
Quote:
However, so far we have no plans to implement a DTS as there is little customer demand.With respect to your problem. the simplest approach would be to avoid a distributed transaction. Distributed transactions are only really needed if you actually have physically seperate objects cooperating on multiple operations that should together have one atomic result. The simplest way to avoid this is to encapsulate the entire request in one operation call. If this isn't reasonable then the next question is whether the cooperating objects exist over multiple processes and use seperate databases. If it is using a single database in one process then your job becomes much easier since you can arrange to share the transaction contexts internally in your server and you have alot less error conditions, and database integration code to worry about. Regards, Matthew |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SmartPointer (aka Handle) question | g00fy | Help Center | 10 | 06-27-2006 05:17 PM |
| Freeze Evictor Transactions | acbell | Help Center | 2 | 12-19-2005 12:43 PM |
| Distributed Data Exchange.. Help! | JaneShang | Help Center | 1 | 04-30-2005 07:15 PM |
| IceInternal::Handle | RyanFogarty | Help Center | 7 | 12-18-2004 01:27 AM |
| Exception handle of ice php | fengxb | Help Center | 2 | 04-08-2004 10:38 PM |