📄 bdb_usenix.ps
字号:
%%EndPageSetup/F0 12/Times-Bold@0 SF 3(3.10.3. Checkpoints)79.2 84 R/F1 10/Times-Roman@0 SF(Berk)79.2 100.2 Q(ele)-.1 E 6.085(yD)-.15 G 6.085(Bi)-6.085 G 3.585(ncludes a checkpointing service that)-6.085 F .263(interacts with the reco)79.2 112.2 R -.15(ve)-.15 G .263(ry system.).15F .263(During normal pro-)5.263 F 2.415(cessing, both the log and the database are changing)79.2 124.2 R(continually)79.2 136.2 Q 5.925(.A)-.65 G 3.425(ta)-5.925 G 1.224 -.15(ny g)-3.425 H -2.15 -.25(iv e).15 H 3.424(ni).25 G .924(nstant, the on-disk v)-3.424 F(ersions)-.15 E .414(of the tw)79.2 148.2R 2.914(oa)-.1 G .414(re not guaranteed to be consistent.)-2.914 F .414(The log)5.414 F 3.838(probably contains changes that are not yet in the)79.2 160.2 R(database.)79.2 172.2 Q .085(When an application mak)79.2 188.4 R .086(es a)-.1 F/F2 10/Times-Italic@0 SF -.15(ch)2.586 G(ec).15 E(kpoint)-.2E F1 2.586(,a)C .086(ll committed)-2.586 F .443(changes in the log up to that point are guaranteed to be)79.2 200.4 R.631(present on the data disk, too.)79.2 212.4 R .632(Checkpointing is moder)5.631 F(-)-.2 E .046(ately e)79.2 224.4 R(xpensi)-.15 E .346 -.15(ve d)-.25 H .046(uring normal processing, b).15F .045(ut limits the)-.2 F(time spent reco)79.2 236.4 Q -.15(ve)-.15 G(ring from crashes.).15 E 3.117(After an application or operating system crash, the)79.2 252.6 R(reco)79.2 264.6 Q -.15(ve)-.15 G 7.419(ry system only needs to go back tw).15F(o)-.1 E(checkpoints)79.2 278.6 Q/F3 7/Times-Roman@0 SF(1)-4 I F1 1.376(to start rolling the log forw)3.876 4 N 3.875(ard. W)-.1 F(ithout)-.4 E3.264(checkpoints, there is no w)79.2 290.6 R 3.265(ay to be sure ho)-.1F 5.765(wl)-.25 G(ong)-5.765 E .395(restarting after a crash will tak)79.2 302.6 R 2.895(e. W)-.1 F .395(ith checkpoints, the)-.4 F .088(restart interv)79.2 314.6 R .089(al can be \214x)-.25 F .089(ed by the programmer)-.15 F 5.089(.R)-.55 G(eco)-5.089 E(v-)-.15 E .668(ery processing can be guaranteed to complete in a sec-)79.2 326.6 R(ond or tw)79.2 338.6 Q(o.)-.1 E(Softw)79.2 354.8 Q 2.457(are crashes are much more common than disk)-.1 F -.1(fa)79.2 366.8 S3.385(ilures. Man).1 F 3.385(yd)-.15 G -2.15 -.25(ev e)-3.385 H .884(lopers w).25 F .884(ant to guarantee that soft-)-.1 F -.1(wa)79.2 378.8S .158(re b).1 F .158(ugs do not destro)-.2 F 2.658(yd)-.1 G .158(ata, b)-2.658 F .158(ut are willing to restore)-.2 F .631(from tape, and to tolerate a day or tw)79.2 390.8 R 3.131(oo)-.1 G3.131(fl)-3.131 G .63(ost w)-3.131 F .63(ork, in)-.1 F .89(the unlikle)79.2 402.8 R 3.39(ye)-.15 G -.15(ve)-3.64 G .89(nt of a disk crash.).15F -.4(Wi)5.89 G .89(th Berk).4 F(ele)-.1 E 3.39(yD)-.15 G(B,)-3.39 E1.093(programmers may truncate the log at checkpoints.)79.2 414.8 R(As)6.092 E .09(long as the tw)79.2 426.8 R 2.59(om)-.1 G .09(ost recent checkpoints are present, the)-2.59 F(reco)79.2 438.8 Q -.15(ve)-.15 G .106(ry system can guarantee that no committed trans-).15 F.611(actions are lost after a softw)79.2 450.8 R .611(are crash.)-.1 F.611(In this case, the)5.611 F(reco)79.2 462.8 Q -.15(ve)-.15 G 1.439(ry system does not require that the log and the).15 F 1.328(data be on separate de)79.2 474.8 R 1.329(vices, although separating them)-.25 F(can still impro)79.2 486.8 Q .3-.15(ve p)-.15 H(erformance by spreading out writes.).15 E F0 3(3.10.4. T)79.2 516.8 R -.12(wo)-.888 G(-phase locking).12 E F1(Berk)79.2 533 Q(ele)-.1 E 4.416(yD)-.15 G 4.416(Bp)-4.416 G(ro)-4.416 E 1.916(vides a service kno)-.15 F 1.915(wn as tw)-.25 F(o-phase)-.1 E 3.017(locking. In)79.2 545 R .517(order to reduce the lik)3.017 F .518(elihood of deadlocks)-.1 F 2.547(and to guarantee A)79.2 557 R 2.546(CID properties, database systems)-.4 F .063(manage locks in tw)79.2 569R 2.564(op)-.1 G 2.564(hases. First,)-2.564 F .064(during the operation)2.564 F 1.574(of a transaction, the)79.2 581 R 4.074(ya)-.15 G 1.574(cquire locks, b)-4.074 F 1.573(ut ne)-.2 F -.15(ve)-.25 G 4.073(rr).15G(elease)-4.073 E 6.147(them. Second,)79.2 593 R 3.648(at the end of the transaction, the)6.147 F(y)-.15 E .235(release locks, b)79.2 605 R .235(ut ne)-.2 F -.15(ve)-.25 G 2.735(ra).15 G .235(cquire them.)-2.735 F .235(In practice, most)5.235 F 4.69(database systems, including Berk)79.2 617 R(ele)-.1 E 7.19(yD)-.15 G4.69(B, acquire)-7.19 F 2.314(locks on demand o)79.2 629 R -.15(ve)-.15G 4.814(rt).15 G 2.314(he course of the transaction,)-4.814 F(then \215ush the log, then release all locks.)79.2 641 Q .32 LW 83.2650.6 79.2 650.6 DL 87.2 650.6 83.2 650.6 DL 91.2 650.6 87.2 650.6 DL95.2 650.6 91.2 650.6 DL 99.2 650.6 95.2 650.6 DL 103.2 650.6 99.2 650.6DL 107.2 650.6 103.2 650.6 DL 111.2 650.6 107.2 650.6 DL 115.2 650.6111.2 650.6 DL 119.2 650.6 115.2 650.6 DL 123.2 650.6 119.2 650.6 DL127.2 650.6 123.2 650.6 DL 131.2 650.6 127.2 650.6 DL 135.2 650.6 131.2650.6 DL 139.2 650.6 135.2 650.6 DL 143.2 650.6 139.2 650.6 DL 147.2650.6 143.2 650.6 DL 151.2 650.6 147.2 650.6 DL 155.2 650.6 151.2 650.6DL 159.2 650.6 155.2 650.6 DL 163.2 650.6 159.2 650.6 DL 167.2 650.6163.2 650.6 DL 171.2 650.6 167.2 650.6 DL 175.2 650.6 171.2 650.6 DL179.2 650.6 175.2 650.6 DL 183.2 650.6 179.2 650.6 DL 187.2 650.6 183.2650.6 DL 191.2 650.6 187.2 650.6 DL 195.2 650.6 191.2 650.6 DL 199.2650.6 195.2 650.6 DL 203.2 650.6 199.2 650.6 DL 207.2 650.6 203.2 650.6DL 211.2 650.6 207.2 650.6 DL 215.2 650.6 211.2 650.6 DL 219.2 650.6215.2 650.6 DL 223.2 650.6 219.2 650.6 DL/F4 5/Times-Roman@0 SF(1)100.8661 Q/F5 8/Times-Roman@0 SF .338(One checkpoint is not f)2.338 3.2 N.338(ar enough.)-.08 F .338(The reco)4.338 F -.12(ve)-.12 G .338(ry system can-).12 F .211(not be sure that the most recent checkpoint completed \212 it may ha)79.2 673.8 R -.12(ve)-.16 G .734(been interrupted by the crash that forced the reco)79.2 683.4 R -.12(ve)-.12 G .734(ry system to run).12 F(in the \214rst place.)79.2 693 QF1(Berk)323.2 84 Q(ele)-.1 E 3.306(yD)-.15 G 3.306(Bc)-3.306 G .806(an lock entire database \214les, which cor)-3.306 F(-)-.2 E .845(respond to tables, or indi)323.2 96 R .844(vidual pages in them.)-.25 F.844(It does)5.844 F 2.141(no record-le)323.2 108 R -.15(ve)-.25 G 4.641(ll).15 G 4.641(ocking. By)-4.641 F 2.142(shrinking the page size,)4.641F(ho)323.2 120 Q(we)-.25 E -.15(ve)-.25 G 4.427 -.4(r, d).15 H -2.15-.25(ev e).4 H 3.627(lopers can guarantee that e).25 F -.15(ve)-.25 G3.626(ry page).15 F 2.101(holds only a small number of records.)323.2132 R 2.102(This reduces)7.102 F(contention.)323.2 144 Q .388(If locking is enabled, then read and write operations on)323.2 160.2 R5.317(ad)323.2 172.2 S 2.817(atabase acquire tw)-5.317 F 2.817(o-phase locks, which are held)-.1 F 3.635(until the transaction completes.)323.2 184.2 R 3.635(Which objects are)8.635 F(lock)323.2 196.2 Q .738(ed and the order of lock acquisition depend on the)-.1 F -.1(wo)323.2208.2 S .503(rkload for each transaction.).1 F .502(It is possible for tw)5.502 F 3.002(oo)-.1 G(r)-3.002 E 1.315(more transactions to deadlock, so that each is w)323.2 220.2 R(aiting)-.1 E(for a lock that is held by another)323.2 232.2 Q(.)-.55 E(Berk)323.2 248.4 Q(ele)-.1 E 3.307(yD)-.15 G 3.307(Bd)-3.307 G .807(etects deadlocks and automatically rolls)-3.307 F 1.825(back one of the transactions.)323.2 260.4 R 1.825(This releases the locks)6.825 F 1.926(that it held and allo)323.2 272.4R 1.925(ws the other transactions to con-)-.25 F 3.346(tinue. The)323.2284.4 R .847(caller is noti\214ed that its transaction did not)3.346 F1.747(complete, and may restart it.)323.2 296.4 R(De)6.747 E -.15(ve)-.25 G 1.747(lopers can specify).15 F .646(the deadlock detection interv)323.2 308.4 R .647(al and the polic)-.25F 3.147(yt)-.15 G 3.147(ou)-3.147 G .647(se in)-3.147 F(choosing a transaction to roll back.)323.2 320.4 Q 6.686(The tw)323.2336.6 R 6.686(o-phase locking interf)-.1 F 6.686(aces are separately)-.1F .927(callable by applications that link Berk)323.2 348.6 R(ele)-.1 E3.427(yD)-.15 G .928(B, though)-3.427 F(fe)323.2 360.6 Q 5.64(wu)-.25 G3.14(sers ha)-5.64 F 3.44 -.15(ve n)-.2 H 3.14(eeded to use that f).15 F3.14(acility directly)-.1 F(.)-.65 E 2.211(Using these interf)323.2372.6 R 2.211(aces, Berk)-.1 F(ele)-.1 E 4.711(yD)-.15 G 4.712(Bp)-4.711G(ro)-4.712 E 2.212(vides a f)-.15 F(ast,)-.1 E 2.4(platform-portable locking system for general-purpose)323.2 384.6 R2.917(use. It)323.2 396.6 R .418(also lets users include non-database objects in a)2.917 F 3.497(database transaction, by controlling access to them)323.2 408.6 R -.15(ex)323.2 420.6 S(actly as if the).15 E 2.5(yw)-.15 G(ere inside the database.)-2.5 E .583(The Berk)323.2 436.8 R(ele)-.1 E3.083(yD)-.15 G 3.084(Bt)-3.083 G -.1(wo)-3.084 G .584(-phase locking f).1 F .584(acility is b)-.1 F .584(uilt on)-.2 F .609(the f)323.2 448.8 R.609(astest correct locking primiti)-.1 F -.15(ve)-.25 G 3.108(st).15 G.608(hat are supported)-3.108 F 1.967(by the underlying architecture.)323.2 460.8 R 1.967(In the current imple-)6.967 F .593(mentation, this means that the locking system is dif)323.2 472.8 R(fer)-.25 E(-)-.2 E 1.709(ent on the v)323.2 484.8 R 1.709(arious UNIX platforms, and is still more)-.25 F(dif)323.2 496.8 Q .695(ferent on W)-.25 F(indo)-.4 E .695(ws NT)-.25 F 5.695(.I)-.74 G 3.195(no)-5.695 G .695(ur e)-3.195 F .695(xperience, the most)-.15 F(dif)323.2 508.8 Q 2.634(\214cult aspect of performance tuning is \214nding the)-.25 F -.1(fa)323.2 520.8 S .883(stest locking primiti).1 F -.15(ve)-.25 G 3.383(st).15 G .883(hat w)-3.383 F .882(ork correctly on a par)-.1 F(-)-.2 E 1.26(ticular architecture and then inte)323.2 532.8 R 1.26(grating the ne)-.15 F 3.76(wi)-.25 G(nter)-3.76 E(-)-.2 E -.1(fa)323.2 544.8 S(ce with the se).1 E -.15(ve)-.25 G(ral that we already support.).15 E.536(The w)323.2 561 R .536(orld w)-.1 F .536(ould be a better place if the operating sys-)-.1 F 2.096(tems community w)323.2 573 R 2.096(ould uniformly implement POSIX)-.1 F1.31(locking primiti)323.2 585 R -.15(ve)-.25 G 3.81(sa).15 G 1.31(nd w)-3.81 F 1.31(ould guarantee that acquiring)-.1 F 1.085(an uncontested lock w)323.2 597 R 1.085(as a f)-.1 F 1.085(ast operation.)-.1 F 1.085(Locks must)6.085 F -.1(wo)323.2 609 S 3.641(rk both among threads in a single process and).1 F(among processes.)323.2 621 Q F0 3(3.11. Concurr)323.2 651 R(ency)-.216 E F1 .383(Good performance under concurrent operation is a crit-)323.2 667.2 R.766(ical design point for Berk)323.2 679.2 R(ele)-.1 E 3.266(yD)-.15 G3.265(B. Although)-3.266 F(Berk)3.265 E(ele)-.1 E(y)-.15 E 1.961(DB is itself not multi-threaded, it is thread-safe, and)323.2 691.2 R.547(runs well in threaded applications.)323.2 703.2 R(Philosophically)5.546 E 3.046(,w)-.65 G(e)-3.046 E(vie)323.2 715.2 Q 4.764(wt)-.25 G2.264(he use of threads and the choice of a threads)-4.764 F EP%%Page: 7 7%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF .066(package as a polic)79.2 84 R 2.566(yd)-.15G .065(ecision, and prefer to of)-2.566 F .065(fer mecha-)-.25 F .042(nism \(the ability to run threaded or not\), allo)79.2 96 R .043(wing appli-)-.25 F(cations to choose their o)79.2 108 Q(wn policies.)-.25 E 1.947(The locking, logging, and b)79.2 124.2 R(uf)-.2 E 1.947(fer pool subsystems all)-.25 F .711(use shared memory or other OS-speci\214c sharing f)79.2 136.2 R(acili-)-.1 E 1.713(ties to communicate.)79.2 148.2 R 1.713(Locks, b)6.713 F(uf)-.2 E 1.713(fer pool fetches, and)-.25 F 1.061(log writes beha)79.2160.2 R 1.361 -.15(ve i)-.2 H 3.561(nt).15 G 1.061(he same w)-3.561 F1.061(ay across threads in a)-.1 F .033(single process as the)79.2 172.2R 2.532(yd)-.15 G 2.532(oa)-2.532 G .032(cross dif)-2.532 F .032(ferent processes on a)-.25 F(single machine.)79.2 184.2 Q .896(As a result, concurrent database applications may start)79.2 200.4 R1.651(up a ne)79.2 212.4 R 4.151(wp)-.25 G 1.651(rocess for e)-4.151 F-.15(ve)-.25 G 1.651(ry single user).15 F 4.151(,m)-.4 G 1.651(ay create a)-4.151 F 2.848(single serv)79.2 224.4 R 2.848(er which spa)-.15 F 2.849(wns a ne)-.15 F 5.349(wt)-.25 G 2.849(hread for e)-5.349 F-.15(ve)-.25 G(ry).15 E(client request, or may choose an)79.2 236.4 Q2.5(yp)-.15 G(olic)-2.5 E 2.5(yi)-.15 G 2.5(nb)-2.5 G(etween.)-2.5 E(Berk)79.2 252.6 Q(ele)-.1 E 3.629(yD)-.15 G 3.629(Bh)-3.629 G 1.128(as been carefully designed to minimize)-3.629 F .07(contention and maximize concurrenc)79.2 264.6 R 3.87 -.65(y. T)-.15 H.07(he cache man-).65 F .57(ager allo)79.2 276.6 R .57(ws all threads or processes to bene\214t from I/O)-.25 F 2.917(done by one.)79.2 288.6 R 2.917(Shared resources must sometimes be)7.917 F(lock)79.2 300.6 Q 1.804(ed for e)-.1 F(xclusi)-.15 E 2.104 -.15(ve a)-.25 H 1.804(ccess by one thread of control.).15 F 1.757 -.8(We h)79.2 312.6 T -2.25 -.2(av e).8 H -.1(ke)2.857 G .158(pt critical sections small, and are careful not).1 F 1.199(to hold critical resource locks across system calls that)79.2 324.6 R.538(could deschedule the locking thread or process.)79.2 336.6 R(Sleep-)5.539 E .979(ycat Softw)79.2 348.6 R .979(are has customers with hundreds of concur)-.1 F(-)-.2 E(rent users w)79.2 360.6 Q(orking on a single database in production.)-.1 E/F1 12/Times-Bold@0 SF 3(4. Engineering)79.2 390.6 R(Philosoph)3 E(y)-.18 E F0(Fundamentally)79.2 406.8 Q 3.998(,B)-.65 G(erk)-3.998 E(ele)-.1 E 3.998(yD)-.15 G 3.998(Bi)-3.998 G 3.999(sac)-3.998 G 1.499(ollection of access)-3.999 F .19(methods with important f)79.2 418.8 R.19(acilities, lik)-.1 F 2.69(el)-.1 G .19(ogging, locking,)-2.69 F1.251(and transactional access underlying them.)79.2 430.8 R 1.252(In both the)6.252 F .992(research and the commercial w)79.2 442.8 R.991(orld, the techniques for)-.1 F -.2(bu)79.2 454.8 S 2.727(ilding systems lik).2 F 5.227(eB)-.1 G(erk)-5.227 E(ele)-.1 E 5.227(yD)-.15 G 5.227(Bh)-5.227 G -2.25 -.2(av e)-5.227 H 2.728(been well-)5.427F(kno)79.2 466.8 Q(wn for a long time.)-.25 E .443(The k)79.2 483 R .743-.15(ey a)-.1 H(dv).15 E .442(antage of Berk)-.25 F(ele)-.1 E 2.942(yD)-.15 G 2.942(Bi)-2.942 G 2.942(st)-2.942 G .442(he careful atten-)-2.942F 1.059(tion that has been paid to engineering details through-)79.2 495R 1.039(out its life.)79.2 507 R 2.639 -.8(We h)6.039 H -2.25 -.2(av e).8 H 1.039(carefully designed the system so)3.739 F .452(that the core f)79.2 519 R .452(acilities, lik)-.1 F 2.952(el)-.1 G.452(ocking and I/O, surf)-2.952 F .453(ace the)-.1 F .972(right interf)79.2 531 R .971(aces and are otherwise opaque to the caller)-.1 F(.)-.55E .294(As programmers, we understand the v)79.2 543 R .295(alue of simplicity)-.25 F .206(and ha)79.2 555 R .506 -.15(ve w)-.2 H(ork).05 E .206(ed hard to simplify the interf)-.1 F .205(aces we sur)-.1 F(-)-.2 E -.1(fa)79.2 567 S(ce to users of the database system.).1 E(Berk)79.2 583.2 Q(ele)-.1 E 4.531(yD)-.15 G 4.531(Ba)-4.531 G -.2(vo)-4.731 G 2.031(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -