1. Trang chủ
  2. » Công Nghệ Thông Tin

Distributed Database Management Systems: Lecture 29

49 2 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Locking Based CC and Timestamp Ordering Based CC
Trường học University
Chuyên ngành Distributed Database Management Systems
Thể loại Lecture
Năm xuất bản 2023
Thành phố City
Định dạng
Số trang 49
Dung lượng 114,05 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Distributed Database Management Systems: Lecture 29. The main topics covered in this chapter include: locking based CC; timestamp ordering based CC; TM sends ops and other information to LM; LM checks the status of data item;...

Trang 1

Distributed Database Management Systems

Lecture 29

Trang 2

In the previous lecture

in DDBS

Trang 3

In this Lecture

• Locking based CC

• Timestamp ordering based CC.

Trang 4

• TM sends ops and

Trang 5

R2(x), W2(x), lr2(x), wl2(y), R2(y), W2(y),

lr2(y), C2,wl1(y), R1(y), W1(y), lr1(y), C1)

Trang 6

S={wl1(x), R1(x), W1(x), lr1(x),

wl2(x), R2(x), W2(x), lr2(x), wl2(y),

R2(y), W2(y), lr2(y), C2,wl1(y),

R1(y), W1(y), lr1(y), C1)

released

Trang 7

immediately-Two-Phase Locking

Trang 8

• A transaction must not

attain a lock once it

releases a lock

release any lock until

it is sure it won’t need any lock

Trang 9

• It creates growing

phase, shrinking phase and a lock point

end of growing phase

and start of shrinking

phase

Trang 10

Any transaction that follows 2-PL is

serializable

Trang 12

• This 2-PL is difficult to

implement

–LM has to know that a Tr

has attained all locks

–Its not going to need a

released item again

–So we have strict 2-PL

Trang 14

Centralized 2PL

designated to a single site

the Lock Manager

Trang 16

• Central site may

Trang 17

Coordinating TM

Primary Site LM

Data Processor Partic Site

Data Processor

Partic Site

Trang 18

Distributed 2-PL

Trang 19

• That was it about

locking approach

timestamp-based

concurrency control

Trang 22

• Timestamp then could

be a two tuple

consisting a counter

value and the site id

be used in stead

Trang 23

Timestamp Ordering Rule

• Given two conflicting

Trang 24

• TO scheduler checks

each operation against conflicting operations

allowed, older refused-

Trang 25

• A TO scheduler is

guaranteed to generate serial order

know all operations in

advance

Trang 26

• Practically, operations

come one at a time

of operations, a R/W

timestamp is allocated

to data items as well

Trang 27

• Data items assigned

rts(x) or wts(x), largest timestamp that has

read or written a data item

Trang 28

• For a write request, if

an older transaction

has read or written the data item, then

operation is rejected

Trang 29

• For a read request, if

an older transaction

has written the data

item, then operation is rejected

deadlocks

Trang 30

Conservative TO

• Basic TO generates too

many restarts

• Like, if a site is relatively

calm, then its transactions will be restarted again

and again

Trang 31

• Synchronizing

timestamps may be very costly

used if they are at

comparable speeds

Trang 32

• In con-TO, operations

are not executed

immediately, but they are buffered

queue for each TM

Trang 34

Multiversion TO

• Another attempt to

reduce the restarts

• Multiple versions of data items with largest r/w

stamps are maintained.

Trang 35

• Read operation is

performed from

appropriate version

older has read or

written a data item

Trang 36

That was all about

Pessimistic CC

algorithms, now we move to Optimistic approaches

Trang 37

Pessimistic assume

that conflicts are likely

to happen so they are careful and follow…

Trang 39

• Each transaction is divided

into sub-transactions that

execute independently

• Tij = Tr i that executes at site j

• Transactions run

independently at each site

until they reach end of read phases.

Trang 41

• VT1: If all transactions

Tk, where ts(Tk)<ts(Tij) have completed their

started its read,

validation succeeds

Trang 42

• VT2: If there is any Tk,

where ts(Tk)<ts(Tij) which completes its write while

Tij is in its read phase

then validation succeeds

if WS(Tk) ∩ RS(Tij) = Ø

Trang 43

• VT3: If Tk completes its read

phase before Tij completes its read phase, then validation

succeeds if

WS(Tk) ∩ RS(Tij) = Ø and WS(Tk) ∩ WS(Tij) = Ø

Tk

Tij

Trang 44

• Optimistic techniques

allow more

concurrency

the validation tests

longer transactions

Trang 45

• Here we have finalized our discussion on CC

techniques

• Next topic is Deadlock Management

Trang 46

• Locking based CC

generates deadlock

other way round

Trang 47

• A WFG represents the relationship between

transactions waiting for each other to release

data items

T7

Trang 48

• We can have local

Ngày đăng: 05/07/2022, 13:40

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN