[FreeLists internal] research on freeelists and freeelist groups

xiaoxiao2021-03-06  47

2005-2-4 Update, correcting some errors and inappropriate statements, adding multiple FREELISTSs to explore space waste.

You can also see about this article

ITPUB

Discussion.

1. If the table space does not specify segment_space_management auto, Freelists and FreeElist Groups will still be used to manage Free block.

2. The default Freelists and Freeelist Groups are 1. Dump Segment Header Block can find a freeelists called Mater Free List, each Segment has at least one Master Free List. Such as:

SEG LST :: FLG: Used LHD: 0X

01C

0000B LTL: 0X

01C

0000b

FLG (FLAG) indicates whether the Freelist is used.

LHD (List header) represents the first Block DBA located in this list

LTL (List Tail) represents the last available Block's DBA, which is located in HWM.

There is a pointer in the block header located in the list, such as:

FNX: 0X

1C

0008b

3. If you are creating a segment, you specify multiple freeelists, such as setting free List, there is a total of 3 Free List in Segment Header Block, one of which is Main Free List, and 2 is Process Free List. Such as:

Seg Lst :: flg: unused lhd: 0x00000000 LTL: 0x00000000

Seg Lst :: flg: unused lhd: 0x00000000 LTL: 0x00000000

SEG LST :: FLG: Used LHD: 0X

01C

0008B LTL: 0X

01C

0008b

4. The Transaction Free List will only generate Transaction Free List to record these Block's DBA when the DML statement makes Block fall below the PCTUSED parameter specified value. And a newly allocated Block is always located in Process Free List or Main Free List. Every Transaction will dynamically create their own Transaction Free List until the SEGMENT HEADER BLOCK SIZE is reached. Such as:

Seg Lst :: flg: unused lhd: 0x00000000 LTL: 0x00000000

Seg Lst :: flg: unused lhd: 0x00000000 LTL: 0x00000000

SEG LST :: FLG: Used LHD: 0X

01C

0008D LTL: 0X

01C

0008D

XCT LST :: FLG: Used LHD: 0X

01C

0008C

LTL: 0x

01C

0008a

XID: 0X

0008.01f

.000003D2

It can be seen that when deleting data is re-available, it is the last assigned block when the Block is re-available, and the most allocated block is in FreeElist Tail. The XID record is the Transaction ID of this DML operation.

Question: Why is the last allocated Block is placed in the Freelist Header?

5. When reinsert data or Row Migration, starting from Transaction Free List header, starting using the released Idle Block. If there is no previously freed block in Transaction Free List, you are looking for from Process Free List, because you may define multiple freeList, which free List is found, the algorithm is (p% NFL) 1, where P represents DML Process ID of the operation process, NFL represents Process Free Lists Number. If you can't find or don't find it in the Process Free List (Segment only one freelist), then find it from Main Free List. If you still can't find it, return to another Transaction Free List, and it is judge whether it is commit, if you have already already commit, then this Transaction Free List's Flag flag is unused, and all blocks located in this list. Combined into main free list. 6. There is no free block in all freeelist. At this time, Segment begins to assign new Extent to enhance HWM. The newly allocated block is placed in Main Free List, if there is an Process Free List, then before use, according to the data request, up to 5 blocks to the corresponding process free list, that is, there are multiple In the case of freeelist, the request of a space always reads the Transaction Free List or Process Free List without reading directly from the Main Free List.

From this place we can see that although multiple FreeList can reach multiple concurrent sessions simultaneously update a segment's demand, if there is only one main free list, then transfer Block from Main Free List to Process Free List this link Still playing, at this time, multiple Freelist Group played the effect. So the plurality of Freelist Group not only valid for the RAC environment, but also for a single instance can also alleviate certain resource contentions. But if there are multiple Freelist Group, you will inevitably generate side effects of space waste, and even a segment increased rapidly in some special occasions.

By the way, it has always been a plurality of freeelist will also lead to space waste. In fact, this is a misunderstanding. At least from testing and some authoritative documents, multiple FreeList do not have too much space waste.

Review a process of requesting space, we can draw this conclusion:

1) This session requires a space, first looks on your own TX Freelist, this is looking for Previously Freed Blocks

2) Can't find, find Process FreeElist

3) Can't find it, find main freelist

4) Can't find it, return to find other TX FREELIST, see if there is a commit, if there is, Merge to Main FreeList (this time free block can be used by this transaction), then move Up to 5 blocks to your own process free, starting to use 5) All TX Freelist (all still find a fixed number, this also needs to be verified, because if there are very many transactions, you can find all the efficiency High or I can't find a new EXTENT efficiency, there is no commither transaction, then mobile HWM at this time.

Multiple FreeList is just a plurality of Process FreeElist, and Main Freelist is only only 1, but because main freelist is shared, all Process in this freeist group can get free block from Main Freelist, so even if you set up multiple Freeelist does not have much problem with a waste of space.

7. For freeelist and freeelist group, Tom has a metaphor in "Effective Oracle By Design". Those who imagine a water dispenser and a continuous need to drink water, a water dispenser represents a freeelist, and a person who wants to drink water is a session that is ready to insert data into the segment. If we have only one water dispenser, then all people who want to drink water must be placed, then the previous one will drink the next one to drink, which has arisen. Imagine that we put 10 water dispensers now, it is obvious that people can rush to any of the 10 teams, and there is no doubt efficiency. At this time, the bottleneck appeared again, that is, if the water in a water dispenser is finished, you have to give this water dispenser to add water. If there is only one plus aater (this is a freelist group), then the speed of water may be Can't keep up, adding freeelist group is increasing the plus auger, increasing to 2, each person is responsible for 5 water dispensers (reflected in parameters, is Freelists 5 Freelist Groups 2), OK, efficiency has increased.

We continue to imagine the negative impact on space waste. A person who has been drinking is very drinking. He hosted a water dispenser to stop drinking. He finished, and the water driver will add water, and it is finished, and even the other 9 drinking water machines are full. The full water is useless, because once this person starts drinking water from a water dispenser under the water dispenser under the juice, it will not be changed to another water dispenser to manage the water (a session, once from a refreelist group. FreeList starts to read the empty block, you will not use the Freelist in other reelist groups, even if other Freeelist represents a lot of idle blocks).

8. Setting up multiple freeelist groups, freelist block is generated, which is followed by Segment Header Block, suppose we set freeelist groups 2, then Segment's first block is Segment Header Block, the second, and 3 blocks. Both is freeelist block. First, there is a freelist in the Segment Header Block, called Super Master Free List or Segment Master Free List. And in each of the FreeList Block, there is a master free list, and there is also a specified process free list, and the remaining space of the block is left to Transaction Free List. The algorithm for selecting FreeList Group in a single instance is (p% NFB) 1, where P represents the process ID of the DML operation process, NFB represents Freelist Groups Number. The algorithm in the RAC environment is more complicated, which is not discussed here. Some of the output of Dump Freelist Block is as follows:

FRMT: 0x02 Chkval: 0x0000 Type: 0x16 = Data Segment Free List Block with Free Block COUNT BLOCK WITH FREE

Blocks in Free List = 5 CCNT = 0

Seg Lst :: flg: unused lhd: 0x00000000 LTL: 0x00000000

Seg Lst :: flg: unused lhd: 0x00000000 LTL: 0x00000000

Seg Lst :: flg: unused lhd: 0x00000000 LTL: 0x00000000

SEG LST :: FLG: Used LHD: 0X

01C

00116 LTL: 0X

01C

0011A

Seg Lst :: flg: unused lhd: 0x00000000 LTL: 0x00000000

Summarize: If we define the Storage (Freelists 4 Freelist Groups 2), there is a super master free list in Segment Header Block, there are 2 Freelist blocks, 1 Master Free List and 4 in each FreeList Block. Process Free List, dynamically generate a Transaction Free List when the SML operation generates the BLOCK re-flag that is not Free. All FLAG, List header Block DBA, and List Tail Block DBA are logged in all Free List Record, and the entire FreeList is a structure that is similar to the next FREE BLOCK address in the block header existing in each of the list. Finished.

Most of this article comes from: Ixora and Metalink related links: Data Blocks and freelists

转载请注明原文地址:https://www.9cbs.com/read-60543.html

New Post(0)