use of org.apache.asterix.common.transactions.LogRecord in project asterixdb by apache.
the class LogBuffer method batchUnlock.
private void batchUnlock(int beginOffset, int endOffset) throws ACIDException {
if (endOffset > beginOffset) {
logBufferTailReader.initializeScan(beginOffset, endOffset);
ITransactionContext txnCtx = null;
LogRecord logRecord = logBufferTailReader.next();
while (logRecord != null) {
if (logRecord.getLogSource() == LogSource.LOCAL) {
if (logRecord.getLogType() == LogType.ENTITY_COMMIT) {
reusableJobId.setId(logRecord.getJobId());
reusableDatasetId.setId(logRecord.getDatasetId());
txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(reusableJobId, false);
txnSubsystem.getLockManager().unlock(reusableDatasetId, logRecord.getPKHashValue(), LockMode.ANY, txnCtx);
txnCtx.notifyOptracker(false);
if (txnSubsystem.getTransactionProperties().isCommitProfilerEnabled()) {
txnSubsystem.incrementEntityCommitCount();
}
} else if (logRecord.getLogType() == LogType.JOB_COMMIT || logRecord.getLogType() == LogType.ABORT) {
reusableJobId.setId(logRecord.getJobId());
txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(reusableJobId, false);
txnCtx.notifyOptracker(true);
notifyJobTermination();
} else if (logRecord.getLogType() == LogType.FLUSH) {
notifyFlushTermination();
} else if (logRecord.getLogType() == LogType.WAIT) {
notifyWaitTermination();
}
} else if (logRecord.getLogSource() == LogSource.REMOTE) {
if (logRecord.getLogType() == LogType.JOB_COMMIT || logRecord.getLogType() == LogType.ABORT) {
notifyReplicationTermination();
}
}
logRecord = logBufferTailReader.next();
}
}
}
use of org.apache.asterix.common.transactions.LogRecord in project asterixdb by apache.
the class CommitRuntime method open.
@Override
public void open() throws HyracksDataException {
try {
transactionContext = transactionManager.getTransactionContext(jobId, false);
transactionContext.setWriteTxn(isWriteTransaction);
ILogMarkerCallback callback = TaskUtil.get(ILogMarkerCallback.KEY_MARKER_CALLBACK, ctx);
logRecord = new LogRecord(callback);
if (isSink) {
return;
}
initAccessAppend(ctx);
writer.open();
} catch (ACIDException e) {
throw new HyracksDataException(e);
}
}
Aggregations