petal = act as diskdrive that are sharable to Frangipani(F)[FileSystem]
Frangipani acts like cache
F sends read,write call to Petal to get data
Challenges
1. cache coherence
user1 creates file /A and store it only in it's local cache but user2,3 cannot see -> we want other user can see even the most recent write
2. Atomicity
user 2 wants to create /B -> even user1,2 simultaneously modify something will system come up with sensible result? -> we want both /A and /B exisit not overriding one over
3. Crash Recovery
even when user1's F crash we want other user2,3 see some sensible informatino when we visit user1
cache coherence
busy = F is busy modifiying actual file contents
idle = F is finished modifiying but still holding locks on the file
Rules (coherence protocol)
1. no cached data without a lock that protects that file
2. acquire lock -> read from petal
3. write to petal -> release lock
ws will pay attention to revoke request only if it's lock is idle -> if idle then it will release the lock to lock server
example
1. ws1 read Z from petal
2. ws2 want to read z -> LS send revoke Z to ws1
3. ws1 write to Z -> commit to petal -> lock become busy to idle -> respond to revoke Z
4. ws1 release lock -> ws2 can read Z
atomic , other user won't be able to see in the middle of operations (transaction)
cache coherence use lock to everybody can see the latest data
atomic use lock to everybody can not see while i am doing modification
crash recovery
crash with locks
write ahead logging (WAL) -> before actually writing something to petal it appends log entries (describing full set of operation it's about to do) -> then write
how F implment WAL
1. 1 log for 1 workstations , other transaction system has only one whole single log
2. F store logs in petal , other keep them in their own machine (where actual transaction happened) , even if the workstation crashes logs can be achieved from petal
each loge entry has LSN(log sequence number) -> to detect end of log (LSN stop increasing point)
and version number -> for recovery purpose ,
ws3 will not delete d/f(that ws2 created) because deleting(ws1 d/f) is associate with lower version
what happens if workstation get revoke message from lock server (cache protocol)
1. write logs to petal
2. write modified blocks (actual stuff) to petal (with acquired lock)
3. release lock
'Database > Distributed Systems' 카테고리의 다른 글
Lecture 12: Distributed Transactions (0) | 2022.04.04 |
---|---|
Lecture 10: Cloud Replicated DB, Aurora (0) | 2022.03.06 |
Lecture 8: Zookeeper , More Replication, CRAQ (0) | 2022.03.05 |
Lecture 6: Fault Tolerance: Raft (1) ,(2) (0) | 2022.02.26 |
Lecture 4: Primary-Backup Replication (0) | 2022.02.11 |