| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private boolean | |
| private StorageFile | |
| private ContainerKey | |
| private LogInstant | |
| private boolean | |
| private boolean | |
| private static final int | |
| protected StorageRandomAccessFile | |
| private String | |
| private static final int | |
| private static final int | |
| private boolean | |
| private boolean | |
| protected boolean | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected void | backupContainer(BaseContainerHandle
the container handle. handle, String location of the backup container. backupLocation)Implements abstract org. Backup the container. |
| public void | clean(boolean
Is clean called because container is being removed? forRemove)Implements org. Clean the container. |
| private void | |
| pack-priv void | closeContainer()
Implements abstract org.
|
| private void | copyFile(final StorageFile
the file to copy from from, final File the file to copy to to)Copy the contents of a |
| pack-priv synchronized void | createContainer(ContainerKey newIdentity)
Implements abstract org. Create a new container. |
| protected void | encryptOrDecryptContainer(BaseContainerHandle
the container handle handle, String file to store the new version of the container in newFilePath, boolean tells whether to encrypt or not doEncrypt)Implements abstract org. Creates encrypted or decrypted version of the container. |
| protected void | flushAll()
Implements abstract org. flush the cache to ensure all of my pages are written to disk |
| pack-priv synchronized StorageFile | |
| private RandomAccessFile | Returns: a RandomAccessFilethe file to access file)Get a RandomAccessFile for accessing a file in read-write mode. |
| pack-priv synchronized StorageRandomAccessFile | |
| public synchronized boolean | isDirty()
Overrides org. Implements org. We treat this container as dirty if it has the container file open. |
| pack-priv synchronized boolean | openContainer(ContainerKey newIdentity)
Implements abstract org. Open a container. |
| private boolean | |
| protected int | preAllocate(long
the last preallocated page number as known
by the allocation page lastPreallocPagenum, int try to preallocate this page number of pages.
Since only the container knows how many pages are actually on
disk, it may determine that certain number of pages that the
allocation page thinks need to be preallocated is already
allocated, in those case, act as if the preallocation is
successful. preAllocSize)Implements abstract org. Preallocate some pages if need be |
| protected StorageFile | |
| private boolean | |
| protected void | readPage(long pageNumber, byte[] pageData)
Implements abstract org. Read a page into the supplied array. |
| protected void | removeContainer(LogInstant instant, boolean
if true, leave a stub. If false, remove everything leaveStub)Implements abstract org. Remove the container |
| private void | |
| pack-priv synchronized boolean | |
| protected synchronized void | reopenContainer(ContainerKey currentIdentity)
Only used by RAFContainer4 (NIO) to reopen RAF when its channel gets closed due to interrupts. |
| public Object | |
| private synchronized void | |
| protected void | truncatePages(long
The page number of the last valid page of the
file. All pages after this one are truncated. lastValidPagenum)Implements abstract org. Truncate pages of a container. |
| protected byte[] | Returns: byte array of the the page data as it should be on the disk.the page number of the page pageNumber, byte[] byte array that has the actual page data. pageData, byte[] buffer that is used to store encrypted version of
the page, or encryptionBuf, boolean null if encryption is to be skippedwhether to use the new encryption engine for
encryption (only considered if encryptWithNewEngine)encryptionBuf != null)Updates the page array with container header if the page is a first allocation page and encrypts the page data if the database is encrypted. |
| protected void | writePage(long pageNumber, byte[] pageData, boolean syncPage)
Implements abstract org. Write a page from the supplied array. |
| private void | writeRAFHeader(Object identity, StorageRandomAccessFile file, boolean
if true, the container is being created
if false, the container already exist create, boolean if true, sync the file syncFile)Write the header of a random access file and sync it |
| actionCode | back to summary |
|---|---|
| private int actionCode | |
| actionErrorOK | back to summary |
|---|---|
| private boolean actionErrorOK | |
| actionFile | back to summary |
|---|---|
| private StorageFile actionFile | |
| actionIdentity | back to summary |
|---|---|
| private ContainerKey actionIdentity | |
| actionInstant | back to summary |
|---|---|
| private LogInstant actionInstant | |
| actionStub | back to summary |
|---|---|
| private boolean actionStub | |
| actionTryAlternatePath | back to summary |
|---|---|
| private boolean actionTryAlternatePath | |
| CREATE_CONTAINER_ACTION | back to summary |
|---|---|
| private static final int CREATE_CONTAINER_ACTION | |
| fileData | back to summary |
|---|---|
| protected StorageRandomAccessFile fileData | |
| fileName | back to summary |
|---|---|
| private String fileName | |
| GET_FILE_NAME_ACTION | back to summary |
|---|---|
| private static final int GET_FILE_NAME_ACTION | |
| GET_RANDOM_ACCESS_FILE_ACTION | back to summary |
|---|---|
| private static final int GET_RANDOM_ACCESS_FILE_ACTION | |
| inBackup | back to summary |
|---|---|
| private boolean inBackup | |
| inRemove | back to summary |
|---|---|
| private boolean inRemove | |
| needsSync | back to summary |
|---|---|
| protected boolean needsSync | |
| OPEN_CONTAINER_ACTION | back to summary |
|---|---|
| private static final int OPEN_CONTAINER_ACTION | |
| REMOVE_FILE_ACTION | back to summary |
|---|---|
| private static final int REMOVE_FILE_ACTION | |
| REOPEN_CONTAINER_ACTION | back to summary |
|---|---|
| private static final int REOPEN_CONTAINER_ACTION | |
| STUBBIFY_ACTION | back to summary |
|---|---|
| private static final int STUBBIFY_ACTION | |
| RAFContainer | back to summary |
|---|---|
| pack-priv RAFContainer(BaseDataFileFactory factory) | |
| backupContainer | back to summary |
|---|---|
| protected void backupContainer(BaseContainerHandle handle, String backupLocation) throws StandardException Implements abstract org. Backup the container. The container is written to the backup by reading the pages through the page cache, and then writing into the backup container. If the container is dropped(commitetd drop), only container stub is copied to the backup using simple file copy. MT - At any given time only one backup thread is allowed, but when backup in progress DML/DDL operations can run in parallel. Pages are latched while writing them to the backup to avoid copying partial changes to the pages. Online backup does not acquire any user level locks , so users can drop tables when backup is in progress. So it is possible that Container Removal request can come in when container backup is in progress. This case is handled by using the synchronization on this object monitor and using inRemove and inBackup flags. Conatiner removal checks if backup is in progress and wait for the backup to yield to continue the removal. Basic idea is to give preference to remove by stopping the backup of the container temporarily, when the remove container is requested by another thread. Generally, it takes more time to backup a regular container than the stub becuase stub is just one page. After each page copy, a check is made to find if a remove is requested and if it is then backup of the container is aborted and the backup thread puts itself into the wait state until remove request thread notifies that the remove is complete. When remove request compeletes stub is copied into the backup. Compress is blocked when backup is in progesss, so truncation of the container can not happen when backup is in progess. No need to synchronize backup of the container with truncation.
| |
| clean | back to summary |
|---|---|
| public void clean(boolean forRemove) throws StandardException Implements org. Clean the container. Write out the container header and sync all dirty pages of this container to disk before returning. checkpoint calls this interface through callbacks by telling the cache manager to clean all containers in the open container cache. This sync of the file happens as part of writing and then syncing the container header in writeRAFHeader().
| |
| clearDirty | back to summary |
|---|---|
| private void clearDirty() | |
| closeContainer | back to summary |
|---|---|
| pack-priv void closeContainer() Implements abstract org. | |
| copyFile | back to summary |
|---|---|
| private void copyFile(final StorageFile from, final File to) throws StandardException Copy the contents of a
| |
| createContainer | back to summary |
|---|---|
| pack-priv synchronized void createContainer(ContainerKey newIdentity) throws StandardException Implements abstract org. Doc from org. Create a new container. Create a new container, all references to identity must be through the passed in identity, this object will no identity until after this method returns.
| |
| encryptOrDecryptContainer | back to summary |
|---|---|
| protected void encryptOrDecryptContainer(BaseContainerHandle handle, String newFilePath, boolean doEncrypt) throws StandardException Implements abstract org. Creates encrypted or decrypted version of the container. Reads all the pages of the container from the original container through the page cache, then either encrypts page data with the new encryption mechanism or leaves the page data un-encrypted, and finally writes the data to the specified new container file. The encryption and decryption engines used to carry out the cryptographic operation(s) are configured through the raw store, and accessed via the data factory. Note that the pages have already been decrypted before being put into the page cache.
| |
| flushAll | back to summary |
|---|---|
| protected void flushAll() throws StandardException Implements abstract org. flush the cache to ensure all of my pages are written to disk
| |
| getFileName | back to summary |
|---|---|
| pack-priv synchronized StorageFile getFileName(ContainerKey identity, boolean stub, boolean errorOK, boolean tryAlternatePath) throws StandardException | |
| getRandomAccessFile | back to summary |
|---|---|
| private RandomAccessFile getRandomAccessFile(final File file) throws IOException Get a RandomAccessFile for accessing a file in read-write mode.
| |
| getRandomAccessFile | back to summary |
|---|---|
| pack-priv synchronized StorageRandomAccessFile getRandomAccessFile(StorageFile file) throws StandardException | |
| isDirty | back to summary |
|---|---|
| public synchronized boolean isDirty() Overrides org. Implements org. Doc from org. We treat this container as dirty if it has the container file open.
| |
| openContainer | back to summary |
|---|---|
| pack-priv synchronized boolean openContainer(ContainerKey newIdentity) throws StandardException Implements abstract org. Doc from org. Open a container. Longer descrption of routine.
Open a container. Open the file that maps to this container, if the
file does not exist then we assume the container was never created.
If the file exists but we have trouble opening it then we throw some
exception.
| |
| padFile | back to summary |
|---|---|
| private boolean padFile(StorageRandomAccessFile file, long pageOffset) throws IOException, StandardException Pad the file upto the passed in page offset. Returns true if the file needed padding. | |
| preAllocate | back to summary |
|---|---|
| protected int preAllocate(long lastPreallocPagenum, int preAllocSize) Implements abstract org. Preallocate some pages if need be
| |
| privGetFileName | back to summary |
|---|---|
| protected StorageFile privGetFileName(ContainerKey identity, boolean stub, boolean errorOK, boolean tryAlternatePath) throws StandardException | |
| privRemoveFile | back to summary |
|---|---|
| private boolean privRemoveFile(StorageFile file) throws StandardException | |
| readPage | back to summary |
|---|---|
| protected void readPage(long pageNumber, byte[] pageData) throws IOException, StandardException Implements abstract org. Read a page into the supplied array.
| |
| removeContainer | back to summary |
|---|---|
| protected void removeContainer(LogInstant instant, boolean leaveStub) throws StandardException Implements abstract org. Remove the container
| |
| removeFile | back to summary |
|---|---|
| private void removeFile(final File file) throws StandardException Remove a file.
| |
| removeFile | back to summary |
|---|---|
| pack-priv synchronized boolean removeFile(StorageFile file) throws StandardException | |
| reopenContainer | back to summary |
|---|---|
| protected synchronized void reopenContainer(ContainerKey currentIdentity) throws StandardException Only used by RAFContainer4 (NIO) to reopen RAF when its channel gets closed due to interrupts.
| |
| run | back to summary |
|---|---|
| public Object run() throws StandardException | |
| stubbify | back to summary |
|---|---|
| private synchronized void stubbify(LogInstant instant) throws StandardException | |
| truncatePages | back to summary |
|---|---|
| protected void truncatePages(long lastValidPagenum) throws StandardException Implements abstract org. Truncate pages of a container. Truncate all pages from lastValidPagenum+1 through the end of the file.
| |
| updatePageArray | back to summary |
|---|---|
| protected byte[] updatePageArray(long pageNumber, byte[] pageData, byte[] encryptionBuf, boolean encryptWithNewEngine) throws StandardException, IOException Updates the page array with container header if the page is a first allocation page and encrypts the page data if the database is encrypted.
| |
| writePage | back to summary |
|---|---|
| protected void writePage(long pageNumber, byte[] pageData, boolean syncPage) throws IOException, StandardException Implements abstract org. Write a page from the supplied array.
| |
| writeRAFHeader | back to summary |
|---|---|
| private void writeRAFHeader(Object identity, StorageRandomAccessFile file, boolean create, boolean syncFile) throws IOException, StandardException Write the header of a random access file and sync it
| |