????SQLite3 ????????μ????????????????????????????????
????SQLite3???????????PagerModule(pager.c)???????PagerModue????SQLite?????ACID????????湦???PagerModue????????BTree????????? ?????????  Pager Module????????Page?? ???Page??????DiskBlock?? ??С?????1024Byte??
????1. SQLite3 ??????????
????UNLOCKED
????SHARED
????RESERVED ???????? ??????????д??  ???????????????????????? ???????????????????棬??PENDING???????????????????μ????????PENDING??????????? ???????ù???????
????PENDING
????EXCLUSIVE
????2.  ?????????
????????и????????????? SQLite???????????????? ??"-journal"?????????β?? ????????????????????????????????????????? ????????????????????????? ??????????master journal????????master journal???????? ?????????????????????????????????????????????masterjournal???????
??????????????????????"hot journal"??? SQLite????л???????? ?????????????????????
????????"hot journal"
????(1) ??????SHAREDLOCK?? ??????? ?????????? ????SQLITE_BUSY
????(2) ????????"hotjournal"?? ??????????????? ?????????????2???
????(3) ??????PENDINGLOCK?? ???EXCLUSIVELOCK?? ??????? ?????????????????????? ??????????? ???????? ????SQLITE_BUSY????????????
????(4) ????????????? ???????????
????(5) ????????????
????(6) ???masterjournal ???
????(7) ???PENDINGLOCK??EXCLUSIVELOCK?? ???????SHAREDLOCK
????3. д????????????
????(1) ??ù?????
????(2) ???RESERVEDLOCK?? ??????? ????SQLITE_BUSY?? ??????????
????(3) ?????????????? д?????? ???д?????????
????????????????????
????(4) ??????PENDINGLOCK
????(5) ??????EXCLUSIVELOCK
????(6) flush/fsync?? ??????д?????
????(7) ????????????
????(8) ???EXCLUSIVELOCK?? PENDING LOCK?? RESERVED LOCK?? ???SHARED LOCK
???????????????????????
????(4) ??????PENDINGLOCK ??EXCLUSIVELOCK?? ???????????????EXCLUSIVELOCK
????(5) ????masterjournal??????????????????????
????(6) flush/fsync?? ??????д?????
????(7) ?????masterjournal ????? ????????е?????????
????(8) ???????????????EXCLUSIVELOCK?? PENDING LOCK
????4. SQL????
???????SQLite autocommit=true
????BEGIN TRANSACTION - COMMIT ???????SQLite????autocommit?1???????SQLite???BEGIN??????? ???????κ????? ?????е??????SELECT?? ???????SHARED LOCK?? ??е?UPDATE/INSERT/DELETE????REVERSED LOCK?? ????????????COMMIT?????????EXCLUSIVE LOCK??
????COMMIT???????????????д??????? COMMIT???SQLITE???autocommit=true ???? autocommit????????д???????