use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class StreamFileContainer method getContainerProperties.
/**
* Request the system properties associated with a stream container.
* <p>
* Request the value of properties associated with a stream container.
* The following properties can be requested:
* derby.storage.streamFileBufferSize
*
* <p>
* 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.streamFileBufferSize", "");
* cc.getContainerProperties(prop);
*
* System.out.println(
* "stream table's buffer size = " +
* prop.getProperty("derby.storage.streamFileBufferSize");
* }
*
* @param prop Property list to fill in.
*
* @exception StandardException Standard exception policy.
*/
public void getContainerProperties(Properties prop) throws StandardException {
AccessFactory af = (AccessFactory) getServiceModule(dataFactory, AccessFactory.MODULE);
TransactionController tc = (af == null) ? null : af.getTransaction(getContextService().getCurrentContextManager());
bufferSize = PropertyUtil.getServiceInt(tc, prop, RawStoreFactory.STREAM_FILE_BUFFER_SIZE_PARAMETER, RawStoreFactory.STREAM_FILE_BUFFER_SIZE_MINIMUM, RawStoreFactory.STREAM_FILE_BUFFER_SIZE_MAXIMUM, RawStoreFactory.STREAM_FILE_BUFFER_SIZE_DEFAULT);
}
use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class LogToFile method performWork.
public int performWork(ContextManager context) {
synchronized (this) {
if (corrupt != null)
// don't do this again.
return Serviceable.DONE;
}
// check to see if checkpointInterval and logSwitchInterval has changed
AccessFactory af = (AccessFactory) getServiceModule(this, AccessFactory.MODULE);
try {
if (af != null) {
TransactionController tc = null;
try {
tc = af.getAndNameTransaction(context, AccessFactoryGlobals.SYS_TRANS_NAME);
getLogFactoryProperties(tc);
} finally {
if (tc != null)
tc.commit();
}
}
// checkpoint will start its own internal transaction on the current
// context.
rawStoreFactory.checkpoint();
} catch (StandardException se) {
Monitor.logTextMessage(MessageId.LOG_CHECKPOINT_EXCEPTION);
logErrMsg(se);
} catch (ShutdownException shutdown) {
// If we are shutting down, just ignore the error and let the
// system go down without printing errors to the log.
}
checkpointDaemonCalled = false;
return Serviceable.DONE;
}
use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class D_DiagnosticUtil method diag_conglomid.
/**
* Given a Database name and conglomid, return diagnositic string.
* <p>
* Return a string with diagnostic information about a particular
* conglomerate, can be called for any type of conglomerate (some types
* may not return any info though).
* <p>
* Can be called from ij to find out info about conglomid 19 in database
* 'msgdb' by using the following syntax:
*
* values
* com.ibm.db2j.protocol.BasicServices.Diagnostic.T_Diagnosticable::
* diag_conglomid('msgdb', 19);
* maximumdisplaywidth 9000;
*
* CREATE FUNCTION DIAG_CONGLOMID(DBNAME VARCHAR(128), CONGLOMID INT)
* RETURNS VARCHAR(32000) RETURNS NULL ON NULL INPUT
* EXTERNAL NAME
* 'org.apache.derby.impl.store.raw.data.D_DiagnosticUtil.diag_conglomid'
* LANGUAGE JAVA PARAMETER STYLE JAVA;
*
* values DIAG_CONGLOMID('msgdb', 19);
* com.ibm.db2j.protocol.BasicServices.Diagnostic.T_Diagnosticable::
* diag_conglomid_print('msgdb', 19);
*
* RESOLVE - An interface that takes a table name would be nice.
*
* @param db_name name of the database
* @param conglomid conglomerate id of the conglomerate to debug
*
* @exception StandardException Standard exception policy.
*/
public static String diag_conglomid(String db_name, long conglomid) throws StandardException {
String ret_string = null;
AccessFactory store_module = null;
store_module = (AccessFactory) getModuleFromDbName(db_name);
if (store_module != null) {
TransactionController tc = store_module.getTransaction(FileContainer.getContextService().getCurrentContextManager());
ConglomerateController open_table = tc.openConglomerate(conglomid, false, 0, TransactionController.MODE_TABLE, TransactionController.ISOLATION_SERIALIZABLE);
open_table.debugConglomerate();
Diagnosticable diag_obj = DiagnosticUtil.findDiagnostic(open_table);
ret_string = diag_obj.diag();
open_table.close();
} else {
System.out.println("Could not find module for database: " + db_name);
}
return (ret_string);
}
use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class RAMAccessManager method getAndNameTransaction.
public TransactionController getAndNameTransaction(ContextManager cm, String transName) throws StandardException {
if (cm == null)
// XXX (nat) should throw exception
return null;
// See if there's already a transaction context.
RAMTransactionContext rtc = (RAMTransactionContext) cm.getContext(AccessFactoryGlobals.RAMXACT_CONTEXT_ID);
if (rtc == null) {
// No transaction context. Create or find a raw store transaction,
// make a context for it, and push the context. Note this puts the
// raw store transaction context above the access context, which is
// required for error handling assumptions to be correct.
Transaction rawtran = rawstore.findUserTransaction(cm, transName);
RAMTransaction rt = new RAMTransaction(this, rawtran, null);
rtc = new RAMTransactionContext(cm, AccessFactoryGlobals.RAMXACT_CONTEXT_ID, rt, false);
TransactionController tc = rtc.getTransaction();
if (xactProperties != null) {
rawtran.setup(tc);
tc.commit();
}
rawtran.setDefaultLockingPolicy(system_default_locking_policy);
tc.commit();
return tc;
}
return rtc.getTransaction();
}
use of org.apache.derby.iapi.store.access.TransactionController in project derby by apache.
the class TemporaryRowHolderImpl method getResultSet.
/**
* Get a result set for scanning what has been inserted
* so far.
*
* @return a result set to use
*/
public CursorResultSet getResultSet() {
state = STATE_DRAIN;
TransactionController tc = activation.getTransactionController();
if (isUniqueStream) {
return new TemporaryRowHolderResultSet(tc, rowArray, resultDescription, isVirtualMemHeap, true, positionIndexConglomId, this);
} else {
return new TemporaryRowHolderResultSet(tc, rowArray, resultDescription, isVirtualMemHeap, this);
}
}
Aggregations