Search in sources :

Example 6 with ILogRecord

use of org.apache.asterix.common.transactions.ILogRecord in project asterixdb by apache.

the class ReplicationManager method addAckToJob.

/**
     * When an ACK for a JOB_COMMIT is received, it is added to the corresponding job.
     *
     * @param jobId
     * @param replicaId
     *            The remote replica id the ACK received from.
     */
private void addAckToJob(int jobId, String replicaId) {
    synchronized (jobCommitAcks) {
        //add ACK to the job
        if (jobCommitAcks.containsKey(jobId)) {
            Set<String> replicaIds = jobCommitAcks.get(jobId);
            replicaIds.add(replicaId);
        } else {
            if (LOGGER.isLoggable(Level.WARNING)) {
                LOGGER.warning("Invalid job replication ACK received for jobId(" + jobId + ")");
            }
            return;
        }
        if (jobCommitAcks.get(jobId).size() == replicationFactor && replicationJobsPendingAcks.containsKey(jobId)) {
            ILogRecord pendingLog = replicationJobsPendingAcks.get(jobId);
            synchronized (pendingLog) {
                pendingLog.notifyAll();
            }
        }
    }
}
Also used : ILogRecord(org.apache.asterix.common.transactions.ILogRecord)

Aggregations

ILogRecord (org.apache.asterix.common.transactions.ILogRecord)6 ACIDException (org.apache.asterix.common.exceptions.ACIDException)3 Checkpoint (org.apache.asterix.common.transactions.Checkpoint)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 IDatasetLifecycleManager (org.apache.asterix.common.api.IDatasetLifecycleManager)2 TxnId (org.apache.asterix.transaction.management.service.recovery.TxnId)2 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)2 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 TestNodeController (org.apache.asterix.app.bootstrap.TestNodeController)1 TestTupleCounterFrameWriter (org.apache.asterix.app.data.gen.TestTupleCounterFrameWriter)1 TupleGenerator (org.apache.asterix.app.data.gen.TupleGenerator)1 DatasetLocalResource (org.apache.asterix.common.dataflow.DatasetLocalResource)1 LSMInsertDeleteOperatorNodePushable (org.apache.asterix.common.dataflow.LSMInsertDeleteOperatorNodePushable)1 IAppRuntimeContextProvider (org.apache.asterix.common.transactions.IAppRuntimeContextProvider)1 ILogReader (org.apache.asterix.common.transactions.ILogReader)1