Java Doc for FileContainer.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » raw » data » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.store.raw.data 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.store.raw.data.BaseContainer
      org.apache.derby.impl.store.raw.data.FileContainer

All known Subclasses:   org.apache.derby.impl.store.raw.data.RAFContainer,  org.apache.derby.impl.store.raw.data.InputStreamContainer,
FileContainer
abstract class FileContainer extends BaseContainer implements Cacheable,TypedFormat(Code)
FileContainer is an abstract base class for containers which are based on files. This class extends BaseContainer and implements Cacheable and TypedFormat


Field Summary
final protected static  intALLOC_PAGE_ARG_NUM
    
final protected static  intCHECKSUM_SIZE
    
final protected static  intCONTAINER_INFO_SIZE
    
final public static  longFIRST_ALLOC_PAGE_NUMBER
    
final public static  longFIRST_ALLOC_PAGE_OFFSET
    
final protected static  StringSPACE_TRACE
    
final protected static  intSTORED_PAGE_ARG_NUM
    
protected  AllocationCacheallocCache
    
protected  booleancanUpdate
    
final protected  CacheManagercontainerCache
    
 byte[]containerInfo
    
protected  longcontainerVersion
    
final protected  BaseDataFileFactorydataFactory
    
protected  longestimatedRowCount
    
protected  longfirstAllocPageNumber
    
protected  longfirstAllocPageOffset
    
final protected static  intformatIdInteger
    
protected  shortinitialPages
    
protected  booleanisDirty
    
protected  LogInstantlastLogInstant
    
protected  intminimumRecordSize
    
final protected  CacheManagerpageCache
    
protected  intpageSize
    
protected  booleanpreDirty
    
protected  intspareSpace
    

Constructor Summary
 FileContainer(BaseDataFileFactory factory)
    

Method Summary
abstract protected  voidbackupContainer(BaseContainerHandle handle, String backupLocation)
     backup the container.
Parameters:
  handle - the container handle.
Parameters:
  backupLocation - location of the backup container.
final protected  voidbumpContainerVersion(LogInstant instant)
     increment the version by one and return the new version.
protected  booleancanUpdate()
    
public  voidclearIdentity()
    
protected  voidclearPreallocThreshold()
    
abstract  voidcloseContainer()
    
protected  voidcompressContainer(RawTransaction ntt, BaseContainerHandle allocHandle)
     Compress free space from container.
MT - thread aware - It is assumed that our caller (our super class) has already arranged a logical lock on page allocation to only allow a single thread through here. Compressing free space is done in allocation page units, working it's way from the end of the container to the beginning.
abstract  voidcreateContainer(ContainerKey newIdentity)
     Create a new container.
protected  CacheablecreateIdent(ContainerKey newIdentity, Object createParameter)
    
public  CacheablecreateIdentity(Object key, Object createParameter)
    
protected  voiddeallocatePage(BaseContainerHandle handle, BasePage page)
     Deallocate a page from the container.
protected  voiddecryptPage(byte[] pageData, int pageSize)
     Decrypts a page
MT - MT safe.
protected  intdoPreAllocatePages(long lastPreallocPagenum, int preAllocSize)
    
protected  voiddropContainer(LogInstant instant, boolean isDropped)
     Drop Container.
protected  byte[]encryptPage(byte[] pageData, int pageSize, byte[] encryptionBuffer, boolean newEngine)
     Encrypts a page.
MT - not safe, call within synchronized block and only use the returned byte array withing synchronized block.
protected  BasePagegetAllocPage(long pageNumber)
    
protected  BasePagegetAnyPage(BaseContainerHandle handle, long pageNumber)
    
public  voidgetContainerProperties(Properties prop)
     Request the system properties associated with a container.
protected  longgetContainerVersion()
    
protected  byte[]getEmbryonicPage(DataInput fileData)
     Get an embryonic page from the dataInput stream.
protected  byte[]getEncryptionBuffer()
     Get encryption buffer. MT - not safe, call within synchronized block and only use the returned byte array withing synchronized block.
public  longgetEstimatedPageCount(BaseContainerHandle handle, int flag)
    
public  longgetEstimatedRowCount(int flag)
    
MT - this routine is NOT MT-safe and clients don't need to provide synchronization.
protected  BasePagegetFirstHeadPage(BaseContainerHandle handle, boolean wait)
    
protected  BasePagegetHeadPage(BaseContainerHandle handle, long pageNumber, boolean wait)
     Get only a valid, non-overflow page.
protected  longgetLastPageNumber(BaseContainerHandle handle)
    
protected  BasePagegetLatchedPage(BaseContainerHandle handle, long pageNumber)
     Get a latched page.
protected  intgetMinimumRecordSize()
    
protected  BasePagegetNextHeadPage(BaseContainerHandle handle, long pageNumber, boolean wait)
     Get the next page in the container.
protected  BasePagegetPage(BaseContainerHandle handle, long pageNumber, boolean wait)
     Get a valid (non-deallocated or free) page in the container. Overflow page is OK.
protected  BasePagegetPageForCompress(BaseContainerHandle handle, int flag, long pageno)
     Get candidate page to move a row for compressing the table.

The caller is moving rows from the end of the table toward the beginning, with the goal of freeing up a block of empty pages at the end of the container which can be returned to the OS.

On entry pageno will be latched by the caller.

protected  BasePagegetPageForInsert(BaseContainerHandle handle, int flag)
     Get a potentially suitable page for insert and latch it.
protected  intgetPageSize()
    
final public  longgetReusableRecordIdSequenceNumber()
     Get the reusable RecordId sequence number for the container.
public  SpaceInfogetSpaceInfo(BaseContainerHandle handle)
     Get information about space used by the container.
protected  intgetSpareSpace()
    
public  intgetTypeFormatId()
     Return my format identifier.
final protected  voidincrementReusableRecordIdSequenceNumber()
     Increment the reusable RecordId version sequence number.
protected  BasePageinitPage(BaseContainerHandle allochandle, PageKey pkey, int[] createArgs, long pageOffset, boolean reuse, boolean overflow)
    
public  booleanisDirty()
     We treat this container as dirty if it has the container file open.
protected  BasePagelatchPage(BaseContainerHandle handle, BasePage foundPage, boolean wait)
    
protected  voidletGo(BaseContainerHandle handle)
     The container is kept by the find() in File.openContainer.
protected  ByteArraylogCreateContainerInfo()
     Log all information on the container creation necessary to recreate the container during a load tran.
protected  BasePagenewPage(BaseContainerHandle userHandle, RawTransaction ntt, BaseContainerHandle allocHandle, boolean isOverflow)
     Create a new page in the container.
MT - thread aware - It is assumed that our caller (our super class) has already arranged a logical lock on page allocation to only allow a single thread through here. Adding a new page involves 2 transactions and 2 pages.
abstract  booleanopenContainer(ContainerKey newIdentity)
     Open a container.

Longer descrption of routine.

Open a container.

abstract protected  intpreAllocate(long lastPreallocPagenum, int preAllocSize)
     preAllocate writes out the preallocated pages to disk if necessary.
Make sure the container is large enough and the pages are well formatted.
public  voidpreDirty(boolean preDirtyOn)
    
protected  voidprepareForBulkLoad(BaseContainerHandle handle, int numPage)
    
protected  BasePagereCreatePageForRedoRecovery(BaseContainerHandle handle, int pageFormat, long pageNumber, long pageOffset)
     ReCreate a page for rollforward recovery.
protected  voidreadHeader(DataInput fileData)
     Read the container's header.
abstract protected  voidreadPage(long pageNumber, byte[] pageData)
     Read a page into the supplied array.
protected  voidsetDirty(boolean dirty)
    
public  voidsetEstimatedRowCount(long count, int flag)
    
protected  CacheablesetIdent(ContainerKey newIdentity)
     Open the container.
public  CacheablesetIdentity(Object key)
     Open the container.
protected  voidtrackUnfilledPage(long pagenumber, boolean unfilled)
    
protected  voidupdateEstimatedRowCount(int delta)
     Update estimated row count by page as it leaves the cache.
protected  voidwriteHeader(byte[] pageData)
    
protected  voidwriteHeader(DataOutput fileData, boolean create, byte[] epage)
     Write the container header directly to output stream (fileData).
abstract protected  voidwritePage(long pageNumber, byte[] pageData, boolean syncPage)
     Write a page from the supplied array.

Field Detail
ALLOC_PAGE_ARG_NUM
final protected static int ALLOC_PAGE_ARG_NUM(Code)



CHECKSUM_SIZE
final protected static int CHECKSUM_SIZE(Code)



CONTAINER_INFO_SIZE
final protected static int CONTAINER_INFO_SIZE(Code)
The size of the persistently stored container info ContainerHeader contains the following information: 4 bytes int FormatId 4 bytes int status 4 bytes int pageSize 4 bytes int spareSpace 4 bytes int minimumRecordSize 2 bytes short initialPages 2 bytes short spare1 8 bytes long first Allocation page number 8 bytes long first Allocation page offset 8 bytes long container version 8 bytes long estimated number of rows 8 bytes long reusable recordId sequence number 8 bytes long spare3 8 bytes long checksum container info size is 80 bytes, with 10 bytes of spare space



FIRST_ALLOC_PAGE_NUMBER
final public static long FIRST_ALLOC_PAGE_NUMBER(Code)
where the first alloc page is located - the logical page number and the physical page offset NOTE if it is not 0 this is not going to work for Stream file which doesn't support seek



FIRST_ALLOC_PAGE_OFFSET
final public static long FIRST_ALLOC_PAGE_OFFSET(Code)



SPACE_TRACE
final protected static String SPACE_TRACE(Code)



STORED_PAGE_ARG_NUM
final protected static int STORED_PAGE_ARG_NUM(Code)
the number of arguments we need to pass to alloc page for create



allocCache
protected AllocationCache allocCache(Code)



canUpdate
protected boolean canUpdate(Code)



containerCache
final protected CacheManager containerCache(Code)



containerInfo
byte[] containerInfo(Code)



containerVersion
protected long containerVersion(Code)



dataFactory
final protected BaseDataFileFactory dataFactory(Code)



estimatedRowCount
protected long estimatedRowCount(Code)



firstAllocPageNumber
protected long firstAllocPageNumber(Code)



firstAllocPageOffset
protected long firstAllocPageOffset(Code)



formatIdInteger
final protected static int formatIdInteger(Code)



initialPages
protected short initialPages(Code)



isDirty
protected boolean isDirty(Code)



lastLogInstant
protected LogInstant lastLogInstant(Code)



minimumRecordSize
protected int minimumRecordSize(Code)



pageCache
final protected CacheManager pageCache(Code)



pageSize
protected int pageSize(Code)



preDirty
protected boolean preDirty(Code)



spareSpace
protected int spareSpace(Code)




Constructor Detail
FileContainer
FileContainer(BaseDataFileFactory factory)(Code)




Method Detail
backupContainer
abstract protected void backupContainer(BaseContainerHandle handle, String backupLocation) throws StandardException(Code)
backup the container.
Parameters:
  handle - the container handle.
Parameters:
  backupLocation - location of the backup container.
exception:
  StandardException - Standard Derby error policy



bumpContainerVersion
final protected void bumpContainerVersion(LogInstant instant)(Code)
increment the version by one and return the new version.
MT - caller must synchronized this in the same sync block that modifies the container header.



canUpdate
protected boolean canUpdate()(Code)



clearIdentity
public void clearIdentity()(Code)



clearPreallocThreshold
protected void clearPreallocThreshold()(Code)



closeContainer
abstract void closeContainer()(Code)



compressContainer
protected void compressContainer(RawTransaction ntt, BaseContainerHandle allocHandle) throws StandardException(Code)
Compress free space from container.
MT - thread aware - It is assumed that our caller (our super class) has already arranged a logical lock on page allocation to only allow a single thread through here. Compressing free space is done in allocation page units, working it's way from the end of the container to the beginning. Each loop operates on the last allocation page in the container. Freeing space in the container page involves 2 transactions, an update to an allocation page, N data pages, and possibly the delete of the allocation page. The User Transaction (UT) initiated the compress call. The Nested Top Transaction (NTT) is the transaction started by RawStore inside the compress call. This NTT is committed before compress returns. The NTT is used to access high traffic data structures such as the AllocPage. This is outline of the algorithm used in compressing the container. Until a non free page is found loop, in each loop return to the OS all space at the end of the container occupied by free pages, including the allocation page itself if all of it's pages are free. 1) Find last 2 allocation pages in container (last if there is only one). 2) invalidate the allocation information cached by the container. Without the cache no page can be gotten from the container. Pages already in the page cache are not affected. Thus by latching the allocPage and invalidating the allocation cache, this NTT blocks out all page gets from this container until it commits. 3) the allocPage determines which pages can be released to the OS, mark that in its data structure (the alloc extent). Mark the contiguous block of nallocated/free pages at the end of the file as unallocated. This change is associated with the NTT. 4) The NTT calls the OS to deallocate the space from the file. Note that the system can handle being booted and asked to get an allocated page which is past end of file, it just extends the file automatically. 5) If freeing all space on the alloc page, and there is more than one alloc page, then free the alloc page - this requires an update to the previous alloc page which the loop has kept latched also. 6) if the last alloc page was deleted, restart loop at #1 All NTT latches are released before this routine returns. If we use an NTT, the caller has to commit the NTT to release the allocPage latch. If we don't use an NTT, the allocPage latch is released as this routine returns.
Parameters:
  ntt - - the nested top transaction for the purpose of freeing space.If ntt is null, use the user transaction for allocation.#param allocHandle - the container handle opened by the ntt, use this to latch the alloc page
exception:
  StandardException - Standard Cloudscape error policy



createContainer
abstract void createContainer(ContainerKey newIdentity) throws StandardException(Code)
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.
exception:
  StandardException - Cloudscape Standard error policy




createIdent
protected Cacheable createIdent(ContainerKey newIdentity, Object createParameter) throws StandardException(Code)



createIdentity
public Cacheable createIdentity(Object key, Object createParameter) throws StandardException(Code)



deallocatePage
protected void deallocatePage(BaseContainerHandle handle, BasePage page) throws StandardException(Code)
Deallocate a page from the container.
Parameters:
  handle - the container handle doing the deallocation
Parameters:
  page - the page to be deallocated. It is latched upon entry andwill be unlatched by the caller of this function
exception:
  StandardException - Cloudscape Standard error policy



decryptPage
protected void decryptPage(byte[] pageData, int pageSize) throws StandardException(Code)
Decrypts a page
MT - MT safe.
exception:
  StandardException - Standard Cloudscape error policy



doPreAllocatePages
protected int doPreAllocatePages(long lastPreallocPagenum, int preAllocSize)(Code)
Preallocate the pages - actually doing it, called by subclass only



dropContainer
protected void dropContainer(LogInstant instant, boolean isDropped)(Code)
Drop Container.


See Also:   Transaction.dropContainer




encryptPage
protected byte[] encryptPage(byte[] pageData, int pageSize, byte[] encryptionBuffer, boolean newEngine) throws StandardException(Code)
Encrypts a page.
MT - not safe, call within synchronized block and only use the returned byte array withing synchronized block.
exception:
  StandardException - Standard Cloudscape error policy



getAllocPage
protected BasePage getAllocPage(long pageNumber) throws StandardException(Code)
Get an alloc page - only accessible to the raw store (container and recovery)
exception:
  StandardException - Cloudscape Standard error policy



getAnyPage
protected BasePage getAnyPage(BaseContainerHandle handle, long pageNumber) throws StandardException(Code)
Get any old page - turn off all validation
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 derby.storage.reusableRecordId cloudsacpe.storage.initialPages

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(ConglomerateController cc) { Properties prop = new Properties(); prop.put("derby.storage.pageSize", ""); cc.getContainerProperties(prop); System.out.println( "table's page size = " + prop.getProperty("derby.storage.pageSize"); }
Parameters:
  prop - Property list to fill in.
exception:
  StandardException - Standard exception policy.




getContainerVersion
protected long getContainerVersion()(Code)



getEmbryonicPage
protected byte[] getEmbryonicPage(DataInput fileData) throws IOException(Code)
Get an embryonic page from the dataInput stream. If fileData is not null, then the embyronic page will be read in from the input stream (fileData), which is assumed to be positioned at the beginning of the first allocation page. if fileData is null, then just manufacture an array which is the size of an embryonic page.
exception:
  IOException - error in read the embryonic page from file



getEncryptionBuffer
protected byte[] getEncryptionBuffer()(Code)
Get encryption buffer. MT - not safe, call within synchronized block and only use the returned byte array withing synchronized block. byte array to be used for encryping a page.



getEstimatedPageCount
public long getEstimatedPageCount(BaseContainerHandle handle, int flag) throws StandardException(Code)

See Also:   ContainerHandle.getEstimatedPageCount
exception:
  StandardException - Standard Cloudscape error policy



getEstimatedRowCount
public long getEstimatedRowCount(int flag)(Code)

MT - this routine is NOT MT-safe and clients don't need to provide synchronization.
See Also:   ContainerHandle.getEstimatedRowCount



getFirstHeadPage
protected BasePage getFirstHeadPage(BaseContainerHandle handle, boolean wait) throws StandardException(Code)
Get the first valid page in the container
exception:
  StandardException - Cloudscape Standard error policy



getHeadPage
protected BasePage getHeadPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)
Get only a valid, non-overflow page. If page number is either invalid or overflow, returns null
exception:
  StandardException - Cloudscape Standard error policy



getLastPageNumber
protected long getLastPageNumber(BaseContainerHandle handle) throws StandardException(Code)



getLatchedPage
protected BasePage getLatchedPage(BaseContainerHandle handle, long pageNumber) throws StandardException(Code)
Get a latched page. Incase of backup page Latch is necessary to prevent modification to the page when it is being written to the backup. Backup process relies on latches to get consistent snap shot of the page , user level table/page/row locks are NOT acquired by the online backup mechanism.
Parameters:
  handle - the container handle used to latch the page
Parameters:
  pageNumber - the page number of the page to get the latched page
exception:
  StandardException - Standard Derby error policy



getMinimumRecordSize
protected int getMinimumRecordSize()(Code)



getNextHeadPage
protected BasePage getNextHeadPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)
Get the next page in the container.
exception:
  StandardException - Standard Cloudscape error policy



getPage
protected BasePage getPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)
Get a valid (non-deallocated or free) page in the container. Overflow page is OK. Resulting page is latched.
MT - thread safe
exception:
  StandardException - Standard Cloudscape error policy



getPageForCompress
protected BasePage getPageForCompress(BaseContainerHandle handle, int flag, long pageno) throws StandardException(Code)
Get candidate page to move a row for compressing the table.

The caller is moving rows from the end of the table toward the beginning, with the goal of freeing up a block of empty pages at the end of the container which can be returned to the OS.

On entry pageno will be latched by the caller. Only return pages with numbers below pageno. Attempting to return pageno will result in a latch/latch deadlock on the same thread.
exception:
  StandardException - Standard exception policy.




getPageForInsert
protected BasePage getPageForInsert(BaseContainerHandle handle, int flag) throws StandardException(Code)
Get a potentially suitable page for insert and latch it.
exception:
  StandardException - Standard Cloudscape error policy



getPageSize
protected int getPageSize()(Code)



getReusableRecordIdSequenceNumber
final public long getReusableRecordIdSequenceNumber()(Code)
Get the reusable RecordId sequence number for the container.
See Also:   BaseContainer.getReusableRecordIdSequenceNumber reusable RecordId sequence number for the container.



getSpaceInfo
public SpaceInfo getSpaceInfo(BaseContainerHandle handle) throws StandardException(Code)
Get information about space used by the container.



getSpareSpace
protected int getSpareSpace()(Code)



getTypeFormatId
public int getTypeFormatId()(Code)
Return my format identifier.



incrementReusableRecordIdSequenceNumber
final protected void incrementReusableRecordIdSequenceNumber()(Code)
Increment the reusable RecordId version sequence number.



initPage
protected BasePage initPage(BaseContainerHandle allochandle, PageKey pkey, int[] createArgs, long pageOffset, boolean reuse, boolean overflow) throws StandardException(Code)
Initialize a page a latched page that has been initialized.
Parameters:
  allochandle - the contianer handle to initialize the page with - the ntt
Parameters:
  pkey - the page number of the page to be initialized
Parameters:
  createArgs - the int array for page creation
Parameters:
  reuse - is true if we are reusing a page that has already been initialized once
exception:
  StandardException - Cloudscape Standard error policy



isDirty
public boolean isDirty()(Code)
We treat this container as dirty if it has the container file open.
See Also:   Cacheable.isDirty



latchPage
protected BasePage latchPage(BaseContainerHandle handle, BasePage foundPage, boolean wait) throws StandardException(Code)



letGo
protected void letGo(BaseContainerHandle handle)(Code)
The container is kept by the find() in File.openContainer.



logCreateContainerInfo
protected ByteArray logCreateContainerInfo() throws StandardException(Code)
Log all information on the container creation necessary to recreate the container during a load tran.
exception:
  StandardException - Cloudscape Standard error policy



newPage
protected BasePage newPage(BaseContainerHandle userHandle, RawTransaction ntt, BaseContainerHandle allocHandle, boolean isOverflow) throws StandardException(Code)
Create a new page in the container.
MT - thread aware - It is assumed that our caller (our super class) has already arranged a logical lock on page allocation to only allow a single thread through here. Adding a new page involves 2 transactions and 2 pages. The User Transaction (UT) initiated the addPage call and expects a latched page (owns by the UT) to be returned. The Nested Top Transaction (NTT) is the transaction started by RawStore inside an addPage call. This NTT is committed before the page is returned. The NTT is used to accessed high traffic data structure such as the AllocPage. This is outline of the algorithm used in adding a page: 1) find or make an allocPage which can handle the addding of a new page. Latch the allocPage with the NTT. 2) invalidate the allocation information cached by the container. Without the cache no page can be gotten from the container. Pages already in the page cache is not affected. Thus by latching the allocPage and invalidating the allocation cache, this NTT blocks out all page gets from this container until it commits. 3) the allocPage determines which page can be allocated, mark that in its data structure (the alloc extent) and returns the page number of the new page. This change is associated with the NTT. 4) the NTT gets or creates the new page in the page cache (bypassing the lookup of the allocPage since that is already latched by the NTT and will deadlock). 5) the NTT initializes the page (mark it is being a VALID page). 6) the page latch is transfered to the UT from the NTT. 7) the new page is returned, latched by UT If we use an NTT, the caller has to commit the NTT to release the allocPage latch. If we don't use an NTT, the allocPage latch is released as this routine returns.
Parameters:
  userHandle - - the container handle opened by the user transaction, use this to latch the new user page
Parameters:
  ntt - - the nested top transaction for the purpose of allocating the new pageIf ntt is null, use the user transaction for allocation.#param allocHandle - the container handle opened by the ntt, use this to latch the alloc page
exception:
  StandardException - Standard Cloudscape error policy



openContainer
abstract boolean openContainer(ContainerKey newIdentity) throws StandardException(Code)
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.
MT - single thread required - Enforced by cache manager.
exception:
  StandardException - Standard exception policy.




preAllocate
abstract protected int preAllocate(long lastPreallocPagenum, int preAllocSize)(Code)
preAllocate writes out the preallocated pages to disk if necessary.
Make sure the container is large enough and the pages are well formatted. The only reason to do this is to save some I/O during page initialization. Once the initPage log record is written, it is expected that the page really do exist and is well formed or recovery will fail. However, we can gain some performance by writing a bunch of pages at a time rather than one at a time.
If it doesn't make sense for the the implementation to have pre-allocation, just return 0.
If the container is not being logged, don't actually do anything, just return 0. number of successfully preallocated page, or 0 ifno page has been preallocated
Parameters:
  lastPreallocPagenum - the last preallocated page number as knownby the allocation page
Parameters:
  preAllocSize - try to preallocate this page number of pages.Since only the container knows how many pages are actually ondisk, it may determine that certain number of pages that theallocation page thinks need to be preallocated is alreadyallocated, in those case, act as if the preallocation issuccessful.



preDirty
public void preDirty(boolean preDirtyOn)(Code)



prepareForBulkLoad
protected void prepareForBulkLoad(BaseContainerHandle handle, int numPage)(Code)



reCreatePageForRedoRecovery
protected BasePage reCreatePageForRedoRecovery(BaseContainerHandle handle, 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.




readHeader
protected void readHeader(DataInput fileData) throws IOException, StandardException(Code)
Read the container's header. Assumes the input stream (fileData) is positioned at the beginning of the file. Subclass that implements openContainer is expected to manufacture a DataInput stream which is used here to read the header.
MT - single thread required - Enforced by caller.
exception:
  StandardException - Cloudscape Standard error policy
exception:
  IOException - error in reading the header from file



readPage
abstract protected void readPage(long pageNumber, byte[] pageData) throws IOException, StandardException(Code)
Read a page into the supplied array.
MT - thread safe
exception:
  IOException - error reading page
exception:
  StandardException - standard cloudscape error message



setDirty
protected void setDirty(boolean dirty)(Code)



setEstimatedRowCount
public void setEstimatedRowCount(long count, int flag)(Code)

See Also:   ContainerHandle.setEstimatedRowCount



setIdent
protected Cacheable setIdent(ContainerKey newIdentity) throws StandardException(Code)
Open the container.

Open the container with key "newIdentity".

should be same name as setIdentity but seems to cause method resolution ambiguities
exception:
  StandardException - Some problem in opening a container.
See Also:   Cacheable.setIdentity




setIdentity
public Cacheable setIdentity(Object key) throws StandardException(Code)
Open the container. a valid object if the container was successfully opened, null ifit does not exist.
exception:
  StandardException - Some problem in opening a container.
See Also:   Cacheable.setIdentity



trackUnfilledPage
protected void trackUnfilledPage(long pagenumber, boolean unfilled)(Code)



updateEstimatedRowCount
protected void updateEstimatedRowCount(int delta)(Code)
Update estimated row count by page as it leaves the cache. The estimated row count is updated without logging!



writeHeader
protected void writeHeader(byte[] pageData) throws StandardException, IOException(Code)
Write the container header to a page array (the first allocation page)
exception:
  StandardException - Cloudscape Standard error policy
exception:
  IOException - error in writing the header to file



writeHeader
protected void writeHeader(DataOutput fileData, boolean create, byte[] epage) throws IOException, StandardException(Code)
Write the container header directly to output stream (fileData). Assumes the output stream is positioned at the beginning of the file. Subclasses that can writes the container header is expected to manufacture a DataOutput stream which is used here.
MT - single thread required - Enforced by caller
exception:
  StandardException - Cloudscape Standard error policy
exception:
  IOException - error in writing the header to file



writePage
abstract protected void writePage(long pageNumber, byte[] pageData, boolean syncPage) throws IOException, StandardException(Code)
Write a page from the supplied array.
MT - thread safe
exception:
  IOException - error writing page
exception:
  StandardException - Standard Cloudscape error policy



Fields inherited from org.apache.derby.impl.store.raw.data.BaseContainer
protected ContainerKey identity(Code)(Java Doc)
protected boolean isCommittedDrop(Code)(Java Doc)
protected boolean isDropped(Code)(Java Doc)
protected boolean isReusableRecordId(Code)(Java Doc)

Methods inherited from org.apache.derby.impl.store.raw.data.BaseContainer
public Page addPage(BaseContainerHandle handle, boolean isOverflow) throws StandardException(Code)(Java Doc)
abstract protected void backupContainer(BaseContainerHandle handle, String backupContainerPath) throws StandardException(Code)(Java Doc)
abstract protected boolean canUpdate()(Code)(Java Doc)
public void clearIdentity()(Code)(Java Doc)
abstract protected void clearPreallocThreshold()(Code)(Java Doc)
public void compressContainer(BaseContainerHandle handle) throws StandardException(Code)(Java Doc)
abstract protected void compressContainer(RawTransaction t, BaseContainerHandle allocHandle) throws StandardException(Code)(Java Doc)
abstract protected void deallocatePage(BaseContainerHandle userhandle, BasePage page) throws StandardException(Code)(Java Doc)
abstract protected void dropContainer(LogInstant instant, boolean drop)(Code)(Java Doc)
abstract protected void encryptContainer(BaseContainerHandle handle, String newFilePath) throws StandardException(Code)(Java Doc)
protected void fillInIdentity(ContainerKey key)(Code)(Java Doc)
abstract protected void flushAll() throws StandardException(Code)(Java Doc)
protected Page getAllocPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)(Java Doc)
abstract protected BasePage getAllocPage(long pageNumber) throws StandardException(Code)(Java Doc)
protected Page getAnyPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)(Java Doc)
abstract protected BasePage getAnyPage(BaseContainerHandle handle, long pageNumber) throws StandardException(Code)(Java Doc)
protected boolean getCommittedDropState()(Code)(Java Doc)
public long getContainerId()(Code)(Java Doc)
abstract public void getContainerProperties(Properties prop) throws StandardException(Code)(Java Doc)
public int getContainerStatus()(Code)(Java Doc)
abstract protected long getContainerVersion() throws StandardException(Code)(Java Doc)
protected boolean getDeallocLock(BaseContainerHandle handle, RecordHandle deallocLock, boolean wait, boolean zeroDuration) throws StandardException(Code)(Java Doc)
protected boolean getDroppedState()(Code)(Java Doc)
abstract public long getEstimatedPageCount(BaseContainerHandle handle, int flag) throws StandardException(Code)(Java Doc)
abstract public long getEstimatedRowCount(int flag) throws StandardException(Code)(Java Doc)
abstract protected BasePage getFirstHeadPage(BaseContainerHandle handle, boolean wait) throws StandardException(Code)(Java Doc)
protected Page getFirstPage(BaseContainerHandle handle) throws StandardException(Code)(Java Doc)
abstract protected BasePage getHeadPage(BaseContainerHandle handle, long pagenumber, boolean wait) throws StandardException(Code)(Java Doc)
public Object getIdentity()(Code)(Java Doc)
abstract protected BasePage getNextHeadPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)(Java Doc)
protected Page getNextPage(BaseContainerHandle handle, long pageNumber) throws StandardException(Code)(Java Doc)
abstract protected BasePage getPage(BaseContainerHandle handle, long pageNumber, boolean wait) throws StandardException(Code)(Java Doc)
abstract protected BasePage getPageForCompress(BaseContainerHandle handle, int flag, long pageno) throws StandardException(Code)(Java Doc)
abstract protected BasePage getPageForInsert(BaseContainerHandle handle, int flag) throws StandardException(Code)(Java Doc)
abstract public long getReusableRecordIdSequenceNumber()(Code)(Java Doc)
public long getSegmentId()(Code)(Java Doc)
abstract protected SpaceInfo getSpaceInfo(BaseContainerHandle handle) throws StandardException(Code)(Java Doc)
abstract protected void incrementReusableRecordIdSequenceNumber()(Code)(Java Doc)
protected boolean isReusableRecordId()(Code)(Java Doc)
protected BasePage latchPage(BaseContainerHandle handle, BasePage foundPage, boolean wait) throws StandardException(Code)(Java Doc)
protected void letGo(BaseContainerHandle handle)(Code)(Java Doc)
public boolean lockAttributes(int flag, Hashtable attributes)(Code)(Java Doc)
public void lockEvent(Latch lockInfo)(Code)(Java Doc)
public boolean lockerAlwaysCompatible()(Code)(Java Doc)
abstract protected ByteArray logCreateContainerInfo() throws StandardException(Code)(Java Doc)
abstract protected BasePage newPage(BaseContainerHandle userhandle, RawTransaction t, BaseContainerHandle allocHandle, boolean isOverflow) throws StandardException(Code)(Java Doc)
abstract protected void preDirty(boolean preDirtyOn)(Code)(Java Doc)
abstract protected void prepareForBulkLoad(BaseContainerHandle handle, int numPage)(Code)(Java Doc)
abstract protected BasePage reCreatePageForRedoRecovery(BaseContainerHandle handle, int pageFormat, long pageNumber, long pageOffset) throws StandardException(Code)(Java Doc)
abstract protected void removeContainer(LogInstant instant, boolean leaveStub) throws StandardException(Code)(Java Doc)
protected void removePage(BaseContainerHandle handle, BasePage page) throws StandardException(Code)(Java Doc)
public boolean requestCompatible(Object requestedQualifier, Object grantedQualifier)(Code)(Java Doc)
protected void setCommittedDropState(boolean isCommittedDrop)(Code)(Java Doc)
protected void setDroppedState(boolean isDropped)(Code)(Java Doc)
abstract public void setEstimatedRowCount(long count, int flag) throws StandardException(Code)(Java Doc)
protected void setReusableRecordIdState(boolean isReusableRecordId)(Code)(Java Doc)
protected void truncate(BaseContainerHandle handle) throws StandardException(Code)(Java Doc)
abstract protected void truncatePages(long lastValidPagenum) throws StandardException(Code)(Java Doc)
public void unlockEvent(Latch lockInfo)(Code)(Java Doc)
protected boolean use(BaseContainerHandle handle, boolean forUpdate, boolean droppedOK) throws StandardException(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

w___w___w__.___j___a___v__a_2s_.c__o___m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.