Search in sources :

Example 6 with LogRecord

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();
        }
    }
}
Also used : ILogRecord(org.apache.asterix.common.transactions.ILogRecord) LogRecord(org.apache.asterix.common.transactions.LogRecord) ITransactionContext(org.apache.asterix.common.transactions.ITransactionContext)

Example 7 with LogRecord

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);
    }
}
Also used : LogRecord(org.apache.asterix.common.transactions.LogRecord) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) ILogMarkerCallback(org.apache.asterix.common.transactions.ILogMarkerCallback) ACIDException(org.apache.asterix.common.exceptions.ACIDException)

Aggregations

LogRecord (org.apache.asterix.common.transactions.LogRecord)7 ACIDException (org.apache.asterix.common.exceptions.ACIDException)5 ILogRecord (org.apache.asterix.common.transactions.ILogRecord)3 ITransactionContext (org.apache.asterix.common.transactions.ITransactionContext)3 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)3 PrimaryIndexOperationTracker (org.apache.asterix.common.context.PrimaryIndexOperationTracker)1 IReplicationThread (org.apache.asterix.common.replication.IReplicationThread)1 ILogMarkerCallback (org.apache.asterix.common.transactions.ILogMarkerCallback)1 ILSMIndex (org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex)1 ILSMMemoryComponent (org.apache.hyracks.storage.am.lsm.common.api.ILSMMemoryComponent)1 ILSMOperationTracker (org.apache.hyracks.storage.am.lsm.common.api.ILSMOperationTracker)1