|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.store.access.btree.BTreePostCommit
class BTreePostCommit
The BTreePostCommit class implements the Serviceable protocol. In it's role as a Serviceable object, it stores the state necessary to find a page in a btree that may have committed delete's to reclaim. In it's role as a PostCommitProcessor it looks up the page described, and reclaims space in the btree. It first trys to clean up any deleted commits on the page. It then will shrink the tree if it is going to delete all rows from the page (RESOLVE - not done yet).
Field Summary | |
---|---|
private AccessFactory |
access_factory
|
protected BTree |
btree
|
private long |
page_number
|
Fields inherited from interface org.apache.derby.iapi.services.daemon.Serviceable |
---|
DONE, REQUEUE |
Constructor Summary | |
---|---|
BTreePostCommit(AccessFactory access_factory,
BTree btree,
long input_page_number)
|
Method Summary | |
---|---|
private void |
doShrink(OpenBTree open_btree,
DataValueDescriptor[] shrink_row)
|
private DataValueDescriptor[] |
getShrinkKey(OpenBTree open_btree,
ControlRow control_row,
int slot_no)
|
private OpenBTree |
openIndex(TransactionManager internal_xact,
int lock_level,
int lock_mode)
Open index for either table level or row level update. |
int |
performWork(ContextManager contextMgr)
perform the work described in the postcommit work. |
private DataValueDescriptor[] |
purgeCommittedDeletes(OpenBTree open_btree,
long pageno)
Reclaim space taken up by committed deleted rows. |
private void |
purgeRowLevelCommittedDeletes(OpenBTree open_btree)
Attempt to reclaim committed deleted rows from the page with row locking. |
boolean |
serviceASAP()
The urgency of this post commit work. |
boolean |
serviceImmediately()
If this work should be done immediately on the user thread then return true. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private AccessFactory access_factory
private long page_number
protected BTree btree
Constructor Detail |
---|
BTreePostCommit(AccessFactory access_factory, BTree btree, long input_page_number)
Method Detail |
---|
public boolean serviceASAP()
This determines where this Serviceable is put in the post commit queue. Post commit work in the btree can be safely delayed until there is not user work to do.
serviceASAP
in interface Serviceable
public boolean serviceImmediately()
Serviceable
serviceImmediately
in interface Serviceable
private final void doShrink(OpenBTree open_btree, DataValueDescriptor[] shrink_row) throws StandardException
StandardException
private final OpenBTree openIndex(TransactionManager internal_xact, int lock_level, int lock_mode) throws StandardException
lock_level
- For table level use TransactionManager.MODE_TABLE,
for row level use TransactionManager.MODE_RECORDlock_mode
- For table level use LockingPolicy.MODE_CONTAINER,
for row level use LockingPolicy.MODE_RECORD
StandardException
- Standard exception policy.public int performWork(ContextManager contextMgr) throws StandardException
In this implementation the only work that can be executed by this post commit processor is this class itself.
performWork
in interface Serviceable
contextMgr
- the context manager started by the
post commit daemon
StandardException
- Standard exception policy.private final DataValueDescriptor[] getShrinkKey(OpenBTree open_btree, ControlRow control_row, int slot_no) throws StandardException
StandardException
private final DataValueDescriptor[] purgeCommittedDeletes(OpenBTree open_btree, long pageno) throws StandardException
This routine assumes it has been called by an internal transaction which has performed no work so far, and that it has an exclusive table lock. These assumptions mean that any deleted rows encountered must be from committed transactions (otherwise we could not have gotten the exclusive table lock).
RESOLVE (mikem) - under row locking this routine must do more work to determine a deleted row is a committed deleted row.
open_btree
- The btree already opened.pageno
- The page number of the page to look for committed deletes.
StandardException
- Standard exception policy.private final void purgeRowLevelCommittedDeletes(OpenBTree open_btree) throws StandardException
Get exclusive latch on page, and then loop backward through page searching for deleted rows which are committed. This routine is called only from post commit processing so it will never see rows deleted by the current transaction. For each deleted row on the page it attempts to get an exclusive lock on the deleted row, NOWAIT. If it succeeds, and since this transaction did not delete the row then the row must have been deleted by a transaction which has committed, so it is safe to purge the row. It then purges the row from the page.
open_btree
- The already open btree, which has been locked with IX
table lock, to use to get latch on page.
StandardException
- Standard exception policy.
|
Built on Thu 2012-03-29 21:53:33+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |