Top Description Fields Constructors Methods
org.apache.derby.impl.store.access.heap

pack-priv Class HeapPostCommit

extends Object
implements Serviceable
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.services.daemon.Serviceable
Imports
org.apache.derby.iapi.services.context.ContextManager, org.apache.derby.iapi.services.daemon.Serviceable, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.access.conglomerate.Conglomerate, .TransactionManager, org.apache.derby.iapi.store.access.AccessFactory, .AccessFactoryGlobals, .DynamicCompiledOpenConglomInfo, .RowUtil, .TransactionController, org.apache.derby.iapi.store.raw.ContainerHandle, .ContainerKey, .LockingPolicy, .Page, .PageKey, .RecordHandle, .Transaction, org.apache.derby.shared.common.reference.SQLState

The HeapPostCommit class implements the Serviceable protocol. In it's role as a Serviceable object, it stores the state necessary to find a page in a heap that may have committed delete's to reclaim. It looks up the page described, and reclaims space in the conglomerate. It first trys to clean up any deleted commits on the page. It will then deallocate the page if no rows remain on the page. All work is done while holding the latch on the page, and locks are never "waited" on while holding this latch. This implementation uses record level locking to reclaim the space. For the protocols to work correctly all other heap methods must be prepared for a record or a page to "disappear" if they don't hold a latch and/or a lock. An example of the problem case is a scan which does not hold locks on it's current position (group scan works this way), which is positioned on a row deleted by another xact, it must be prepared to continue the scan after getting an error if the current page/row disapppears.

Field Summary

Modifier and TypeField and Description
private AccessFactory
access_factory

Fields of the class

private PageKey

Constructor Summary

AccessConstructor and Description
pack-priv
HeapPostCommit(AccessFactory access_factory, PageKey page_key)

Constructors for This class:

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

Returns Serviceable.DONE when work has completed, or returns Serviceable.REQUEUE if work needs to be requeued.
performWork
(ContextManager
the context manager started by the post commit daemon
contextMgr
)

Implements org.apache.derby.iapi.services.daemon.Serviceable.performWork.

perform the work described in the postcommit work.

private final void
purgeCommittedDeletes(HeapController
The heap, already opened.
heap_control
,
long
number of page to look for committed deletes.
pageno
)

Reclaim space taken of committed deleted rows or aborted inserted rows.

public boolean

Returns:

false, this work should not be serviced ASAP
serviceASAP
()

Implements org.apache.derby.iapi.services.daemon.Serviceable.serviceASAP.

The urgency of this post commit work.

public boolean
serviceImmediately()

Implements org.apache.derby.iapi.services.daemon.Serviceable.serviceImmediately.

If this work should be done immediately on the user thread then return true.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

access_factoryback to summary
private AccessFactory access_factory

Fields of the class

page_keyback to summary
private PageKey page_key

Constructor Detail

HeapPostCommitback to summary
pack-priv HeapPostCommit(AccessFactory access_factory, PageKey page_key)

Constructors for This class:

Method Detail

performWorkback to summary
public int performWork(ContextManager contextMgr) throws StandardException

Implements org.apache.derby.iapi.services.daemon.Serviceable.performWork.

perform the work described in the postcommit work.

In this implementation the only work that can be executed by this post commit processor is this class itself.

Parameters
contextMgr:ContextManager

the context manager started by the post commit daemon

Returns:int

Returns Serviceable.DONE when work has completed, or returns Serviceable.REQUEUE if work needs to be requeued.

Exceptions
StandardException:
Standard exception policy.
purgeCommittedDeletesback to summary
private final void purgeCommittedDeletes(HeapController heap_control, long pageno) throws StandardException

Reclaim space taken of committed deleted rows or aborted inserted rows.

This routine assumes it has been called by an internal transaction which has performed no work so far, and that it has an exclusive intent table lock. It will attempt obtain exclusive row locks on rows marked deleted, where successful those rows can be reclaimed as they must be "committed deleted" or "aborted inserted" rows.

This routine will latch the page and hold the latch due to interface requirement from Page.purgeAtSlot.

Parameters
heap_control:HeapController

The heap, already opened.

pageno:long

number of page to look for committed deletes.

Exceptions
StandardException:
Standard exception policy.
See Also
Page#purgeAtSlot
serviceASAPback to summary
public boolean serviceASAP()

Implements org.apache.derby.iapi.services.daemon.Serviceable.serviceASAP.

The urgency of this post commit work.

This determines where this Serviceable is put in the post commit queue. Post commit work in the heap can be safely delayed until there is not user work to do.

Returns:boolean

false, this work should not be serviced ASAP

serviceImmediatelyback to summary
public boolean serviceImmediately()

Implements org.apache.derby.iapi.services.daemon.Serviceable.serviceImmediately.

Doc from org.apache.derby.iapi.services.daemon.Serviceable.serviceImmediately.

If this work should be done immediately on the user thread then return true. If it doesn't make any difference if this work is done on a the user thread immediately or if it is performed by another thread asynchronously later, then return false.

Returns:boolean

true if this work shold happen immediately on the user thread