Question

I'm creating a resource manager by implementing IEnlistmentNotification. I'm trying to create a durable RM which has brought up a few questions for me.

  1. Should there be an IEnlistmentNotification object per transaction or should a single IEnlistmentNotification object handle all transactions?

    I would think each transaction would want it's own so it could do a Prepare/Commit/Rollback for each transaction.

  2. How is the recovery file handled?

    My assumption is that everything happening in the transaction will get written to a recovery file during the Prepare.

    How can the info for each transaction be separated? I would think each transaction would have a separate file, or that a single file would have a transaction id of some sort for each recovery operation.

    When a recovery is happening, is the Transaction.Current.TransactionInformation.DistributedIdentifier/LocalIdentifier the same as before the crash? So, can one of these IDs be used to identify the transaction during a recovery.

  3. How does a recovery happen?

    If I have a TransactionScope with my resource manager being used inside of it, and the system crashes (plug is pulled or whatever) in the middle of the scope, how does a recovery happen when the system start back up? I'm assuming some process that was running the code that has the scope in it knows about system crashes or something? In that case, what systems/programs/services are setup to actually handle a recovery?

Was it helpful?

Solution

I believe I found all my answers in the RavenDB Source Code.

  1. Yes, every transaction should have it's own IEnlistmentNotification.
  2. Yes, you use the `Transaction.TransactionInformation.DistributedIdentifier/LocalIdentifier' to keep track of the transactions in the recovery file or files.
  3. The app that is running the code will do the checking if a recovery is needed, and re-enlist the transactions that didn't complete when the plug was pulled.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top