Class HeapController
- java.lang.Object
-
- org.apache.derby.impl.store.access.conglomerate.GenericConglomerateController
-
- org.apache.derby.impl.store.access.heap.HeapController
-
- All Implemented Interfaces:
- ConglomerateController, ConglomPropertyQueryable
public class HeapController extends GenericConglomerateController implements ConglomerateController
-
-
Field Summary
-
Fields inherited from interface org.apache.derby.iapi.store.access.ConglomerateController
LOCK_INS, LOCK_INS_PREVKEY, LOCK_READ, LOCK_UPD, LOCK_UPDATE_LOCKS, ROWISDUPLICATE
-
-
Constructor Summary
Constructors Constructor and Description HeapController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcheckConsistency()Public Methods implementing ConglomerateController which just delegate to OpenConglomerate:voiddebugConglomerate()longgetEstimatedRowCount()Get the total estimated number of rows in the container.java.util.PropertiesgetInternalTablePropertySet(java.util.Properties prop)OpenConglomerategetOpenConglom()OpenConglomerategetOpenConglomerate()Public Methods of XXXX class:SpaceInfogetSpaceInfo()voidgetTableProperties(java.util.Properties prop)voidinit(OpenConglomerate open_conglom)Public Methods of This class:intinsert(DataValueDescriptor[] row)Public Methods of This class:voidinsertAndFetchLocation(DataValueDescriptor[] row, RowLocation templateRowLocation)insert row and fetch it's row location in one operation.booleanisKeyed()booleanisTableLocked()is the open btree table locked?booleanlockRow(long page_num, int record_id, int lock_operation, boolean wait, int lock_duration)Lock the given record id/page num pair.booleanlockRow(RowLocation loc, int lock_operation, boolean wait, int lock_duration)Lock the given row location.RowLocationnewRowLocationTemplate()Return a row location object of the correct type to be used in calls to insertAndFetchLocation.voidsetEstimatedRowCount(long count)Set the total estimated number of rows in the container.voidunlockRowAfterRead(RowLocation loc, boolean forUpdate, boolean row_qualified)UnLock the given row location.-
Methods inherited from class org.apache.derby.impl.store.access.conglomerate.GenericConglomerateController
close, closeForEndTransaction, delete, fetch, fetch, replace
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.derby.iapi.store.access.ConglomerateController
checkConsistency, close, closeForEndTransaction, debugConglomerate, delete, fetch, fetch, getSpaceInfo, isKeyed, replace
-
Methods inherited from interface org.apache.derby.iapi.store.access.ConglomPropertyQueryable
getInternalTablePropertySet, getTableProperties
-
-
-
-
Method Detail
-
insert
public int insert(DataValueDescriptor[] row) throws StandardException
Public Methods of This class:- Specified by:
insertin interfaceConglomerateController- Parameters:
row- The row to insert into the conglomerate. The stored representations of the row's columns are copied into a new row somewhere in the conglomerate.- Returns:
- Returns 0 if insert succeeded. Returns ConglomerateController.ROWISDUPLICATE if conglomerate supports uniqueness checks and has been created to disallow duplicates, and the row inserted had key columns which were duplicate of a row already in the table. Other insert failures will raise StandardException's.
- Throws:
StandardException- Standard exception policy.- See Also:
RowUtil
-
insertAndFetchLocation
public void insertAndFetchLocation(DataValueDescriptor[] row, RowLocation templateRowLocation) throws StandardException
Description copied from interface:ConglomerateControllerinsert row and fetch it's row location in one operation.Insert a row into the conglomerate, and store its location in the provided destination row location. The row location must be of the correct type for this conglomerate (a new row location of the correct type can be obtained from newRowLocationTemplate()).
- Specified by:
insertAndFetchLocationin interfaceConglomerateController- Parameters:
row- The row to insert into the conglomerate. The stored representations of the row's columns are copied into a new row somewhere in the conglomerate.templateRowLocation- The rowlocation to read the inserted row location into.- Throws:
StandardException- Standard exception policy.- See Also:
RowUtil
-
lockRow
public boolean lockRow(RowLocation loc, int lock_operation, boolean wait, int lock_duration) throws StandardException
Lock the given row location.Should only be called by access.
This call can be made on a ConglomerateController that was opened for locking only.
RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.
- Specified by:
lockRowin interfaceConglomerateController- Parameters:
loc- The "RowLocation" which describes the exact row to lock.wait- Should the lock call wait to be granted?lock_operation- For what operation are we requesting the lock, this should be one of the following 4 options: LOCK_READ [read lock], (LOCK_INS | LOCK_UPD) [ lock for insert], (LOCK_INSERT_PREVKEY | LOCK_UPD) [lock for previous key to insert], (LOCK_UPD) [lock for delete or replace] (LOCK_UPD | LOCK_UPDATE_LOCKS) [lock scan for update, will upgrade lock later if actual update is take place]lock_duration- If set to TransactionManager.LOCK_INSTANT_DURATION, then lock will be released immediately after being granted.- Returns:
- true if lock was granted, only can be false if wait was false.
- Throws:
StandardException- Standard exception policy.
-
unlockRowAfterRead
public void unlockRowAfterRead(RowLocation loc, boolean forUpdate, boolean row_qualified) throws StandardException
UnLock the given row location.Should only be called by access.
This call can be made on a ConglomerateController that was opened for locking only.
RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.
- Specified by:
unlockRowAfterReadin interfaceConglomerateController- Parameters:
loc- The "RowLocation" which describes the row to unlock.forUpdate- Row was previously Locked the record for read or update.row_qualified- Row was qualified and returned to the user.- Throws:
StandardException- Standard exception policy.
-
lockRow
public boolean lockRow(long page_num, int record_id, int lock_operation, boolean wait, int lock_duration) throws StandardExceptionLock the given record id/page num pair.Should only be called by access, to lock "special" locks formed from the Recordhandle.* reserved constants for page specific locks.
This call can be made on a ConglomerateController that was opened for locking only.
RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.
- Specified by:
lockRowin interfaceConglomerateController- Parameters:
page_num- Page number of row to lock.record_id- Record id of row on page_num to lock.lock_operation- Desc of what to lock for, ie. update, insert ...wait- Should the lock call wait to be granted?lock_duration- If set to TransactionManager.LOCK_INSTANT_DURATION, then lock will be released immediately after being granted.- Returns:
- true if lock was granted, only can be false if wait was false.
- Throws:
StandardException- Standard exception policy.
-
newRowLocationTemplate
public RowLocation newRowLocationTemplate() throws StandardException
Description copied from interface:ConglomerateControllerReturn a row location object of the correct type to be used in calls to insertAndFetchLocation.- Specified by:
newRowLocationTemplatein interfaceConglomerateController- Throws:
StandardException- Standard exception policy.
-
getOpenConglomerate
public OpenConglomerate getOpenConglomerate()
Public Methods of XXXX class:
-
init
public void init(OpenConglomerate open_conglom) throws StandardException
Public Methods of This class:- Throws:
StandardException
-
getOpenConglom
public OpenConglomerate getOpenConglom()
-
checkConsistency
public void checkConsistency() throws StandardExceptionPublic Methods implementing ConglomerateController which just delegate to OpenConglomerate:- Throws:
StandardException
-
debugConglomerate
public void debugConglomerate() throws StandardException- Throws:
StandardException
-
getTableProperties
public void getTableProperties(java.util.Properties prop) throws StandardException- Throws:
StandardException
-
getInternalTablePropertySet
public java.util.Properties getInternalTablePropertySet(java.util.Properties prop) throws StandardException- Throws:
StandardException
-
getSpaceInfo
public SpaceInfo getSpaceInfo() throws StandardException
- Throws:
StandardException
-
isKeyed
public boolean isKeyed()
-
isTableLocked
public boolean isTableLocked()
is the open btree table locked?
-
getEstimatedRowCount
public long getEstimatedRowCount() throws StandardExceptionGet the total estimated number of rows in the container.The number is a rough estimate and may be grossly off. In general the server will cache the row count and then occasionally write the count unlogged to a backing store. If the system happens to shutdown before the store gets a chance to update the row count it may wander from reality.
This call is currently only supported on Heap conglomerates, it will throw an exception if called on btree conglomerates.
- Returns:
- The total estimated number of rows in the conglomerate.
- Throws:
StandardException- Standard exception policy.
-
setEstimatedRowCount
public void setEstimatedRowCount(long count) throws StandardExceptionSet the total estimated number of rows in the container.Often, after a scan, the client of RawStore has a much better estimate of the number of rows in the container than what store has. For instance if we implement some sort of update statistics command, or just after a create index a complete scan will have been done of the table. In this case this interface allows the client to set the estimated row count for the container, and store will use that number for all future references.
This call is currently only supported on Heap conglomerates, it will throw an exception if called on btree conglomerates.
- Parameters:
count- the estimated number of rows in the container.- Throws:
StandardException- Standard exception policy.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG