java.io.Externalizable
, java.io.Serializable
public class AllocExtent
extends java.lang.Object
implements java.io.Externalizable
AllocPage
,
Serialized FormFormat ID | none, format implied by AllocPage's format |
Purpose | |
manage page status of page in extent | |
Upgrade | |
Disk Layout | extentOffset(long) the begin physical byte offset of the first page of this extent extentStart(long) the first logical page mananged by this extent. extentEnd(long) the last page this extent can ever hope to manage extentLength(int) the number of pages allocated in this extent extentStatus(int) status bits for the whole extent. HAS_DEALLOCATED - most likely, this extent has a deallocated page somewhere If !HAD_DEALLOCATED, the extent has no deallocated page HAS_FREE - most likely, this extent has a free page somewhere If !HAS_FREE, there is no free page in the extent ALL_FREE - most likely, this extent only has free pages, good candidate for shrinking the file. If !ALL_FREE, the extent is not all free HAS_UNFILLED_PAGES - most likely, this extent has unfilled pages. if !HAS_UNFILLED_PAGES, all pages are filled KEEP_UNFILLED_PAGES - this extent keeps track of unfilled pages (post v1.3). If not set, this extent has no notion of unfilled page and has no unFilledPage bitmap. NO_DEALLOC_PAGE_MAP - this extents do not have a dealloc and a free page bit maps. Prior to 2.0, there are 2 bit maps, a deallocate page bit map and a free page bit map. Cloudscape 2.0 and later merged the dealloc page bit map into the free page bit map. RETIRED - this extent contains only 'retired' pages, never use any page from this extent. The pages don't actually exist, i.e., it maps to nothing (physicalOffset is garbage). The purpose of this extent is to blot out a range of logical page numbers that no longer exists for this container. Use this to reuse a physical page when a logical page has exhausted all recordId or for logical pages that has been shrunk out. preAllocLength(int) the number of pages that have been preallocated reserved1(int) reserved2(long) reserved for future use reserved3(long) reserved for future use FreePages(bit) bitmap of free pages Bit[i] is ON iff page i is free for immediate (re)use. [ on disk version before 2.0 deAllocPages(bit) bitmap of deallocated pages Bit[i] is ON iff page i has been deallocated. ] unFilledPages(bit) bitmap of pages that has free space Bit[i] is ON if page i is likely to be |
Modifier and Type | Field | Description |
---|---|---|
private static int |
ALL_FREE |
|
protected static int |
ALLOCATED_PAGE |
public Per Page status
|
protected static int |
DEALLOCATED_PAGE |
|
private long |
extentEnd |
|
private int |
extentLength |
|
private long |
extentOffset |
|
private long |
extentStart |
|
(package private) int |
extentStatus |
|
protected static int |
FREE_PAGE |
|
(package private) FormatableBitSet |
freePages |
|
private static int |
HAS_DEALLOCATED |
|
private static int |
HAS_FREE |
|
private static int |
HAS_UNFILLED_PAGES |
|
private static int |
KEEP_UNFILLED_PAGES |
|
private static int |
NO_DEALLOC_PAGE_MAP |
|
private int |
preAllocLength |
|
private int |
reserved1 |
|
private long |
reserved2 |
|
private long |
reserved3 |
|
private static int |
RETIRED |
|
(package private) FormatableBitSet |
unFilledPages |
Modifier | Constructor | Description |
---|---|---|
|
AllocExtent() |
|
protected |
AllocExtent(long offset,
long start,
int length,
int pagesize,
int maxlength) |
|
protected |
AllocExtent(AllocExtent original) |
Modifier and Type | Method | Description |
---|---|---|
protected void |
allocPage(long pagenum) |
Allocate this page - this is called underneath the log record
|
protected boolean |
canAddFreePage(long lastAllocatedPage) |
|
private void |
checkInRange(long pagenum) |
|
protected int |
compress(BaseContainerHandle owner,
RawTransaction ntt,
AllocPage alloc_page) |
Compress free pages at end of this extent.
|
protected void |
compressPages(int new_highest_page,
int num_pages_truncated) |
|
protected void |
deallocPage(long pagenum) |
Deallocate logical page pagenum - this is called underneath the log record.
|
protected int |
getAllocatedPageCount() |
Get the number of used page in this extent
|
protected long |
getExtentEnd() |
|
protected long |
getFirstPagenum() |
Get the first logical page number managed by this extent.
|
protected long |
getFreePageNumber(long pnum) |
Get a page number that is free
|
protected long |
getLastPagenum() |
Get the last logical page number managed by this extent.
|
protected long |
getLastPreallocPagenum() |
get the last preallocated pagenumber managed by this alloc page
|
protected long |
getLastValidPageNumber() |
|
protected long |
getNextValidPageNumber(long prevPageNumber) |
|
protected long |
getPagenum(int bit_pos) |
translate bit position in map to page number.
|
protected long |
getPageOffset(long pagenum,
int pagesize,
boolean deallocOK) |
Get the physical offset of pagenum.
|
protected int |
getPageStatus(long pagenum) |
Return the status of a particular page
|
protected int |
getTotalPageCount() |
Get the total number of pages in this extent
|
protected int |
getUnfilledPageCount() |
Get the number of unfilled pages in this extent
|
protected long |
getUnfilledPageNumber(long pagenum) |
Get a page number that is unfilled, pagenum is the last page that was
rejected.
|
protected boolean |
isRetired() |
Return the status of this extent
|
protected static int |
MAX_RANGE(int availspace) |
Statically calculates how many pages this extent can manage given the
availspace number of bytes to store this extent in
if read/writeExternal changes, this must change too
|
private boolean |
mayHaveFreePage() |
|
void |
readExternal(java.io.ObjectInput in) |
|
private void |
setExtentFreePageStatus(boolean hasFree) |
|
protected void |
setLastPreallocPagenum(long preAllocPagenum) |
preallocated N pages, passed in the last preallocated page number.
|
protected java.lang.String |
toDebugString() |
|
protected boolean |
trackUnfilledPage(long pagenumber,
boolean unfilled) |
|
protected void |
undoCompressPages(int new_highest_page,
int num_pages_truncated) |
Undo the compress space operation.
|
protected void |
updateUnfilledPageInfo(AllocExtent inputExtent) |
|
void |
writeExternal(java.io.ObjectOutput out) |
private long extentOffset
private long extentStart
private long extentEnd
private int extentLength
int extentStatus
private int preAllocLength
private int reserved1
private long reserved2
private long reserved3
private static final int HAS_DEALLOCATED
private static final int HAS_FREE
private static final int ALL_FREE
private static final int HAS_UNFILLED_PAGES
private static final int KEEP_UNFILLED_PAGES
private static final int NO_DEALLOC_PAGE_MAP
private static final int RETIRED
protected static final int ALLOCATED_PAGE
protected static final int DEALLOCATED_PAGE
protected static final int FREE_PAGE
FormatableBitSet freePages
FormatableBitSet unFilledPages
protected AllocExtent(long offset, long start, int length, int pagesize, int maxlength)
protected AllocExtent(AllocExtent original)
public AllocExtent()
protected static int MAX_RANGE(int availspace)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
protected void allocPage(long pagenum) throws StandardException
StandardException
- Standard Derby error policyprotected void deallocPage(long pagenum) throws StandardException
StandardException
- Standard Derby error policyprotected int compress(BaseContainerHandle owner, RawTransaction ntt, AllocPage alloc_page) throws StandardException
Search backward from end of extent and prepare data structures to return pages at end of extent to the OS. Returns the lowest page that can be returned to the OS.
StandardException
protected void compressPages(int new_highest_page, int num_pages_truncated)
protected void undoCompressPages(int new_highest_page, int num_pages_truncated)
Undo of this operation doesn't really "undo" the operation, it just makes sure the data structures are ok after the undo. We are guaranteed at the point of the transaction doing the Undo of the compress space operation fixes up the bit maps to only point at pages within the new_highest_page range.
Prior to logging the compress space operation all pages greater than There are only 2 possibilities at this point: 1) the truncate of pages greater than new_highest_page happened before the abort took place. W 2)
protected long getExtentEnd()
protected long getFreePageNumber(long pnum)
protected long getPageOffset(long pagenum, int pagesize, boolean deallocOK) throws StandardException
StandardException
- Standard Derby error policyprotected boolean isRetired()
private boolean mayHaveFreePage()
private void setExtentFreePageStatus(boolean hasFree)
protected boolean canAddFreePage(long lastAllocatedPage)
protected int getPageStatus(long pagenum)
protected long getFirstPagenum()
protected long getLastPagenum()
protected long getPagenum(int bit_pos)
protected long getLastPreallocPagenum()
protected void setLastPreallocPagenum(long preAllocPagenum)
protected long getNextValidPageNumber(long prevPageNumber)
protected long getLastValidPageNumber()
private void checkInRange(long pagenum)
protected void updateUnfilledPageInfo(AllocExtent inputExtent)
protected boolean trackUnfilledPage(long pagenumber, boolean unfilled)
protected long getUnfilledPageNumber(long pagenum)
protected int getAllocatedPageCount()
protected int getUnfilledPageCount()
protected int getTotalPageCount()
protected java.lang.String toDebugString()
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.