天天看點

事務過程中ITL的變化

1. 事務開始

 Itl           Xid                  Uba         Flag  Lck        Scn/Fsc

0x01   0x0008.014.0000024e  0x0080028e.00d9.2e  C---    0  scn 0x0000.00164660

0x02   0x0007.001.000001bb  0x0080049a.00cf.2c  ----    1  fsc 0x0000.00000000 

lck辨別為1,表示該事務鎖住了1條記錄, fsc變成0x0000.00000000 相應的記錄lb指向ITLOx02

block_row_dump:

tab 0, row 0, @0x1f8d

tl: 10 fb: --H-FL-- lb: 0x2  cc: 1

col  0: [ 6]  67 75 6f 6a 6a 65

end_of_block_dump

2. 送出事務:

  Itl           Xid                  Uba         Flag  Lck        Scn/Fsc

0x02   0x0007.001.000001bb  0x0080049a.00cf.2c  --U-    1  fsc 0x0000.0016a59d

lck辨別仍為1,相應記錄的lb仍然沒有改變.但是flag變為了--U--

flag的标記解釋如下:

---- = transaction is active, or committed pending cleanout 

C--- = transaction has been committed and locks cleaned out 

-B-- = this undo record contains the undo for this ITL entry 

--U- = transaction committed (maybe long ago); SCN is an upper bound

3. 當該資料塊上另外一條記錄執行DML操作,并送出,這時ITL表會變成:

0x01   0x0008.00b.0000024f  0x00800290.00d9.29  --U-    1  fsc 0x0000.0016a6eb

0x02   0x0006.021.00000247  0x0080010e.00d6.13  --U-    1  fsc 0x0000.0016a887

4. 當該資料塊上另外一條記錄執行DML操作,可以看到所有的ITL的flag的都被重置:

0x01   0x0008.00b.0000024f  0x00800290.00d9.29  ----    1  fsc 0x0000.00000000

0x02   0x0007.001.000001bb  0x0080049a.00cf.2c  C---    0  scn 0x0000.0016a59d

tab 0, row 0, @0x1f82

tl: 11 fb: --H-FL-- lb: 0x1  cc: 1

col  0: [ 7]  67 75 6f 5f 6a 6a 65

可以看到0x02的lck被清除,fsc變為scn.

結論與問題:事務送出後ITL相應的記錄并不清除,當有其他DML操作找不到可用的Slot時,

才會清除.

本文轉自 anranran 51CTO部落格,原文連結:http://blog.51cto.com/guojuanjun/347319