| java.lang.Object java.util.Observable org.apache.derby.impl.store.raw.data.BaseContainerHandle
BaseContainerHandle | public class BaseContainerHandle extends Observable implements RawContainerHandle,Observer(Code) | | A handle to an open container, implememts RawContainerHandle.
This class is an Observer to observe RawTransactions
and is also a Observable to
handle the list of pages accessed thorough this handle.
This class implements Lockable (defined to be ContainerHandle) and is
the object used to logically lock the container.
MT - Mutable - Immutable identity - Thread Aware
|
Constructor Summary | |
public | BaseContainerHandle(UUID rawStoreId, RawTransaction xact, ContainerKey identity, LockingPolicy locking, int mode) Create an object that is only used for locking the container. | public | BaseContainerHandle(UUID rawStoreId, RawTransaction xact, PageActions actionsSet, AllocationActions allocActionsSet, LockingPolicy locking, BaseContainer container, int mode) Create a container handle that is used to actually access the container. |
Method Summary | |
public Page | addPage() Add a page to the container
The page returned will be observing me. | public Page | addPage(int flag) Add a page to the container, if flag == ContainerHandle.ADD_PAGE_BULK,
tell the container about it. | public void | backupContainer(String backupContainerPath) Backup the container to the specified path. | protected void | checkOpen() | public void | close() | public void | compactRecord(RecordHandle record) | public void | compressContainer() Release free space to the OS.
As is possible release any free space to the operating system. | public void | dropContainer(LogInstant instant, boolean drop) | public void | encryptContainer(String newFilePath) Create encrypted version of the container with the
user specified encryption properties. | public void | flushContainer() | public PageActions | getActionSet() | public Page | getAllocPage(long pageNumber) | public AllocationActions | getAllocationActionSet() | public Page | getAnyPage(long pageNumber) Get this page with no check - any page type or status is fine. | public void | getContainerProperties(Properties prop) Request the system properties associated with a container. | public int | getContainerStatus() Get the container status. | public long | getContainerVersion() | public long | getEstimatedPageCount(int flag) | public long | getEstimatedRowCount(int flag) | public Page | getFirstPage() | public ContainerKey | getId() | final public LockingPolicy | getLockingPolicy() Return my locking policy, may be different from the Transaction's
default locking policy. | public int | getMode() Get the mode I was opened with. | public Page | getNextPage(long pageNumber) | public Page | getPage(long pageNumber) | public Page | getPageForCompress(int flag, long pageno) | public Page | getPageForInsert(int flag) | public Page | getPageNoWait(long pageNumber) | public long | getReusableRecordIdSequenceNumber() Get the reusable recordId sequence number. | public SpaceInfo | getSpaceInfo() Get information about space used by the container. | final public RawTransaction | getTransaction() Return the RawTransaction I was opened in. | public Object | getUniqueId() | public Page | getUserPageNoWait(long pageNumber) | public Page | getUserPageWait(long pageNumber) | protected void | informObservers() | final public boolean | isReadOnly() | public boolean | isTemporaryContainer() | public ByteArray | logCreateContainerInfo() Log all information necessary to recreate the container during a load
tran. | public RecordHandle | makeRecordHandle(long pageNumber, int recordId) Return a record handle that is initialized to the given page number and
record id. | public void | preAllocate(int numPage) Preallocate numPage if possible. | public void | preDirty(boolean preDirtyOn) The container is about to be modified. | public Page | reCreatePageForRedoRecovery(int pageFormat, long pageNumber, long pageOffset) ReCreate a page for rollforward recovery. | public void | removeContainer(LogInstant instant) | public void | removePage(Page page) Remove a page from the container. | public void | setEstimatedRowCount(long count, int flag) | final public void | setLockingPolicy(LockingPolicy newLockingPolicy) | public String | toString() | public void | update(Observable obj, Object arg) Called when the transaction is about to complete. | final public boolean | updateOK() | public boolean | useContainer(boolean droppedOK, boolean waitForLock) Attach me to a container. |
active | protected boolean active(Code) | | Is this ContainerHandle active.
MT - Mutable : scoped
|
container | protected BaseContainer container(Code) | | The actual container we are accessing. Only valid when active is true.
MT - Mutable : scoped
|
xact | protected RawTransaction xact(Code) | | our transaction. Only valid when active is true.
MT - Mutable : scoped
|
backupContainer | public void backupContainer(String backupContainerPath) throws StandardException(Code) | | Backup the container to the specified path.
Parameters: backupContainerPath - location of the backup container. exception: StandardException - Standard Derby error policy |
compressContainer | public void compressContainer() throws StandardException(Code) | | Release free space to the OS.
As is possible release any free space to the operating system. This
will usually mean releasing any free pages located at the end of the
file using the java truncate() interface.
exception: StandardException - Standard Cloudscape error policy |
encryptContainer | public void encryptContainer(String newFilePath) throws StandardException(Code) | | Create encrypted version of the container with the
user specified encryption properties.
Parameters: newFilePath - file to store the new encrypted version of the container exception: StandardException - Standard Derby error policy |
getAnyPage | public Page getAnyPage(long pageNumber) throws StandardException(Code) | | Get this page with no check - any page type or status is fine.
Caller must be prepared to handle freed, deallocated,or alloc page
Called by recovery ONLY.
exception: StandardException - Cloudscape Standard error policy |
getContainerProperties | public void getContainerProperties(Properties prop) throws StandardException(Code) | | Request the system properties associated with a container.
Request the value of properties that are associated with a container.
The following properties can be requested:
derby.storage.pageSize
derby.storage.pageReservedSpace
derby.storage.minimumRecordSize
To get the value of a particular property add it to the property list,
and on return the value of the property will be set to it's current
value. For example:
get_prop(BaseContainerHandle ch)
{
Properties prop = new Properties();
prop.put("derby.storage.pageSize", "");
ch.getContainerProperties(prop);
System.out.println(
"conatainer's page size = " +
prop.getProperty("derby.storage.pageSize");
}
Parameters: prop - Property list to fill in. exception: StandardException - Standard exception policy. |
getLockingPolicy | final public LockingPolicy getLockingPolicy()(Code) | | Return my locking policy, may be different from the Transaction's
default locking policy.
|
getMode | public int getMode()(Code) | | Get the mode I was opened with.
|
getTransaction | final public RawTransaction getTransaction()(Code) | | Return the RawTransaction I was opened in.
|
informObservers | protected void informObservers()(Code) | | |
makeRecordHandle | public RecordHandle makeRecordHandle(long pageNumber, int recordId) throws StandardException(Code) | | Return a record handle that is initialized to the given page number and
record id.
exception: StandardException - Standard cloudscape exception policy. Parameters: pageNumber - the page number of the RecordHandle. Parameters: recordId - the record id of the RecordHandle. See Also: RecordHandle |
preAllocate | public void preAllocate(int numPage)(Code) | | Preallocate numPage if possible.
|
preDirty | public void preDirty(boolean preDirtyOn) throws StandardException(Code) | | The container is about to be modified.
Loggable actions use this to make sure the container gets cleaned if a
checkpoint is taken after any log record is sent to the log stream but
before the container is actually dirtied.
exception: StandardException - Standard Cloudscape error policy |
reCreatePageForRedoRecovery | public Page reCreatePageForRedoRecovery(int pageFormat, long pageNumber, long pageOffset) throws StandardException(Code) | | ReCreate a page for rollforward recovery.
During redo recovery it is possible for the system to try to redo
the creation of a page (ie. going from non-existence to version 0).
It first trys to read the page from disk, but a few different types
of errors can occur:
o the page does not exist at all on disk, this can happen during
rollforward recovery applied to a backup where the file was
copied and the page was added to the file during the time frame
of the backup but after the physical file was copied.
o space in the file exists, but it was never initalized. This
can happen if you happen to crash at just the right moment during
the allocation process. Also
on some OS's it is possible to read from a part of the file that
was not ever written - resulting in garbage from the store's
point of view (often the result is all 0's).
All these errors are easy to recover from as the system can easily
create a version 0 from scratch and write it to disk.
Because the system does not sync allocation of data pages, it is also
possible at this point that whlie writing the version 0 to disk to
create it we may encounter an out of disk space error (caught in this
routine as a StandardException from the create() call. We can't
recovery from this without help from outside, so the caught exception
is nested and a new exception thrown which the recovery system will
output to the user asking them to check their disk for space/errors.
exception: StandardException - Standard exception policy. |
updateOK | final public boolean updateOK()(Code) | | Was I opened for updates?
MT - thread safe
|
useContainer | public boolean useContainer(boolean droppedOK, boolean waitForLock) throws StandardException(Code) | | Attach me to a container. If this method returns false then
I cannot be used anymore, and any reference to me must be discarded.
Parameters: droppedOK - if true, use this container even if it is dropped,otherwise, return false if container is dropped. Parameters: waitForLock - if true, wait on lock, otherwise, get lock no wait. exception: StandardException - Standard Cloudscape error policy |
|
|