@InterfaceAudience.Private public class ServerNonceManager extends Object
| Modifier and Type | Class and Description | 
|---|---|
| private static class  | ServerNonceManager.OperationContext | 
| Modifier and Type | Field and Description | 
|---|---|
| private int | conflictWaitIterationMsThe time to wait in an extremely unlikely case of a conflict with a running op. | 
| private int | deleteNonceGracePeriod | 
| static String | HASH_NONCE_GRACE_PERIOD_KEY | 
| private static org.slf4j.Logger | LOG | 
| private ConcurrentHashMap<NonceKey,ServerNonceManager.OperationContext> | noncesNonces. | 
| private static SimpleDateFormat | tsFormat | 
| Constructor and Description | 
|---|
| ServerNonceManager(org.apache.hadoop.conf.Configuration conf) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addMvccToOperationContext(long group,
                         long nonce,
                         long mvcc)Store the write point in OperationContext when the operation succeed. | 
| private void | cleanUpOldNonces() | 
| ScheduledChore | createCleanupScheduledChore(Stoppable stoppable)Creates a scheduled chore that is used to clean up old nonces. | 
| void | endOperation(long group,
            long nonce,
            boolean success)Ends the operation started by startOperation. | 
| long | getMvccFromOperationContext(long group,
                           long nonce)Return the write point of the previous succeed operation. | 
| void | reportOperationFromWal(long group,
                      long nonce,
                      long writeTime)Reports the operation from WAL during replay. | 
| void | setConflictWaitIterationMs(int conflictWaitIterationMs) | 
| boolean | startOperation(long group,
              long nonce,
              Stoppable stoppable)Starts the operation if operation with such nonce has not already succeeded. | 
public static final String HASH_NONCE_GRACE_PERIOD_KEY
private static final org.slf4j.Logger LOG
private int conflictWaitIterationMs
private static final SimpleDateFormat tsFormat
private ConcurrentHashMap<NonceKey,ServerNonceManager.OperationContext> nonces
private int deleteNonceGracePeriod
public ServerNonceManager(org.apache.hadoop.conf.Configuration conf)
public void setConflictWaitIterationMs(int conflictWaitIterationMs)
public boolean startOperation(long group, long nonce, Stoppable stoppable) throws InterruptedException
group - Nonce group.nonce - Nonce.stoppable - Stoppable that terminates waiting (if any) when the server is stopped.InterruptedExceptionpublic void endOperation(long group, long nonce, boolean success)
group - Nonce group.nonce - Nonce.success - Whether the operation has succeeded.public void addMvccToOperationContext(long group, long nonce, long mvcc)
group - Nonce group.nonce - Nonce.mvcc - Write point of the succeed operation.public long getMvccFromOperationContext(long group, long nonce)
group - Nonce group.nonce - Nonce.public void reportOperationFromWal(long group, long nonce, long writeTime)
group - Nonce group.nonce - Nonce.writeTime - Entry write time, used to ignore entries that are too old.public ScheduledChore createCleanupScheduledChore(Stoppable stoppable)
stoppable - Stoppable for the chore.private void cleanUpOldNonces()
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.