Docsity

Client Recovery - E-Commerce - Lecture Slides, Slides of Fundamentals of E-Commerce

Toggle sidebar
bg1
Client Recovery (2)
•So, if the client knows the request id R, it can
determine state C and maybe state B.
•What if no queued message has the id R?
Could be in state A, B, or D.
•Can further clarify matters if the client has a local
database that can run 2-phase commit with the
queue manager
–Use the local database to store the state of the request
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Client Recovery - E-Commerce - Lecture Slides and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

Client Recovery (2)

So, if the client knows the request id R, it candetermine state C and maybe state B.

What if no queued message has the id R?Could be in state A, B, or D.

Can further clarify matters if the client has a localdatabase that can run 2-phase commit with thequeue manager

Use the local database to store the state of the request

Transaction Semantics - Client View

Txn1: Start

Get Request R from local DBEnqueue(Request R, Q1)State(R) = “Submitted”

Commit

Txn3: Start

Dequeue(Reply for R, Q2)decode reply & process outputState(R) = “Done”

Commit

Q

Q

Txn2: Start

Dequeue(Req, Q1)process request ReqEnqueue(Reply, Q2)

Commit

Txn0: Start

construct request & store it in local DBState(R) = “NotSubmitted”

Commit

Not in the textbook

Persistent Sessions

Suppose client doesn’t have a local database thatruns 2PC with the queue manager.

The queue manager can help by persistentlyremembering each client’s last operation, which isreturned when the client connects to a queue …amounts to a persistent session

Client Recovery with Persistent Sessions

// Let R be id of client’s last request// Assume client ran Txn0 for R before Txn1Client connects to request and reply queues;If (id of last request enqueued

R) { resubmit request }

elseif (id of last reply message dequeued

R)

{ dequeue (and wait for) reply with id R }

else // R was fully processed, nothing to recover

  • Now client can figure out
    • A – if last enqueued request is not R• D – if last dequeued reply is R• B – no evidence of R and not in states A, C, or D.

Testable Operations

Testable operations

After the operation runs, there is a test operation thatthe client can execute to tell whether the operationran

Typically, the non-undoable operation returns adescription of the state of the device (before-state)and then changes the state of the device

the test operation returns a description of the state ofthe device.

E.g., State description can be a uniqueticket/check/form number under the print head

Recovery Procedure for State C

To process a reply1. Start a transaction2. Dequeue the reply3. If there’s an earlier logged device state for this

reply and it differs from the current device state,then ask the operator whether to abort this txn

  1. Persistently log the current device state with

the reply’s ID. This operation is permanentwhether or not this transaction commits.

  1. Perform the operation on the physical device6. Commit

Log

9.3 Queue Manager

A queue supports most file-oriented operations

create and destroy queue database

create and destroy queue

show and modify queue’s attributes (e.g. security)

open-scan and get-next-element

enqueue and dequeue

next element or element identified by index

inside or outside a transaction

read element