use of org.apache.derby.iapi.store.access.ConglomerateController in project derby by apache.
the class StatementNode method lockTableForCompilation.
/* We need to get some kind of table lock (IX here) at the beginning of
* compilation of DMLModStatementNode and DDLStatementNode, to prevent the
* interference of insert/update/delete/DDL compilation and DDL execution,
* see beetle 3976, 4343, and $WS/language/SolutionsToConcurrencyIssues.txt
*/
protected TableDescriptor lockTableForCompilation(TableDescriptor td) throws StandardException {
DataDictionary dd = getDataDictionary();
/* we need to lock only if the data dictionary is in DDL cache mode
*/
if (dd.getCacheMode() == DataDictionary.DDL_MODE) {
ConglomerateController heapCC;
TransactionController tc = getLanguageConnectionContext().getTransactionCompile();
heapCC = tc.openConglomerate(td.getHeapConglomerateId(), false, TransactionController.OPENMODE_FORUPDATE | TransactionController.OPENMODE_FOR_LOCK_ONLY, TransactionController.MODE_RECORD, TransactionController.ISOLATION_SERIALIZABLE);
heapCC.close();
/*
** Need to get TableDescriptor again after getting the lock, in
** case for example, a concurrent add column thread commits
** while we are binding.
*/
String tableName = td.getName();
td = getTableDescriptor(td.getName(), getSchemaDescriptor(td.getSchemaName()));
if (td == null) {
throw StandardException.newException(SQLState.LANG_TABLE_NOT_FOUND, tableName);
}
}
return td;
}
use of org.apache.derby.iapi.store.access.ConglomerateController in project derby by apache.
the class ResultColumnList method newRowLocationTemplate.
/**
* Create a row location template of the right type for the source
* conglomerate.
*/
private RowLocation newRowLocationTemplate() throws StandardException {
LanguageConnectionContext lcc = getLanguageConnectionContext();
DataDictionary dd = lcc.getDataDictionary();
int isolationLevel = (dd.getCacheMode() == DataDictionary.DDL_MODE) ? TransactionController.ISOLATION_READ_COMMITTED : TransactionController.ISOLATION_NOLOCK;
ConglomerateController cc = lcc.getTransactionCompile().openConglomerate(conglomerateId, false, 0, TransactionController.MODE_RECORD, isolationLevel);
try {
return cc.newRowLocationTemplate();
} finally {
cc.close();
}
}
use of org.apache.derby.iapi.store.access.ConglomerateController in project derby by apache.
the class ConglomInfo method getSpaceInfo.
private void getSpaceInfo(int index) throws StandardException {
ConglomerateController cc = tc.openConglomerate(conglomTable[index].getConglomId(), false, // not for update
0, TransactionController.MODE_RECORD, TransactionController.ISOLATION_READ_COMMITTED);
spaceInfo = cc.getSpaceInfo();
cc.close();
cc = null;
}
use of org.apache.derby.iapi.store.access.ConglomerateController in project derby by apache.
the class TabInfoImpl method getRow.
/**
* Given a key row, return the first matching heap row.
* <p>
* LOCKING: shared row locking.
*
* @param tc transaction controller
* @param key key to read by.
* @param indexNumber Key is appropriate for this index.
* @exception StandardException Thrown on failure
*/
ExecRow getRow(TransactionController tc, ExecIndexRow key, int indexNumber) throws StandardException {
ConglomerateController heapCC;
/* Open the heap conglomerate */
heapCC = tc.openConglomerate(getHeapConglomerate(), false, // for read only
0, TransactionController.MODE_RECORD, TransactionController.ISOLATION_REPEATABLE_READ);
try {
return getRow(tc, heapCC, key, indexNumber);
} finally {
heapCC.close();
}
}
use of org.apache.derby.iapi.store.access.ConglomerateController in project derby by apache.
the class TabInfoImpl method getRowLocation.
/**
* Given an index row and index number return the RowLocation
* in the heap of the first matching row.
* Used by the autoincrement code to get the RowLocation in
* syscolumns given a <tablename, columname> pair.
*
* @see DataDictionaryImpl#computeRowLocation(TransactionController, TableDescriptor, String)
*
* @param tc Transaction Controller to use.
* @param key Index Row to search in the index.
* @param indexNumber Identifies the index to use.
*
* @exception StandardException thrown on failure.
*/
RowLocation getRowLocation(TransactionController tc, ExecIndexRow key, int indexNumber) throws StandardException {
ConglomerateController heapCC;
heapCC = tc.openConglomerate(getHeapConglomerate(), false, // for read only
0, TransactionController.MODE_RECORD, TransactionController.ISOLATION_REPEATABLE_READ);
try {
RowLocation[] rl = new RowLocation[1];
ExecRow notUsed = getRowInternal(tc, heapCC, key, indexNumber, rl);
return rl[0];
} finally {
heapCC.close();
}
}
Aggregations