Class PartitionUpdateCounterErrorWrapper
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.PartitionUpdateCounterErrorWrapper
-
- All Implemented Interfaces:
Iterable<long[]>,PartitionUpdateCounter
public class PartitionUpdateCounterErrorWrapper extends Object implements PartitionUpdateCounter
Update counter wrapper for error logging.
-
-
Constructor Summary
Constructors Constructor Description PartitionUpdateCounterErrorWrapper(int partId, PartitionUpdateCounter delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectcomparableState()CacheGroupContextcontext()PartitionUpdateCountercopy()booleanempty()booleanequals(Object o)GridLongListfinalizeUpdateCounters()Flushes pending update counters closing all possible gaps.longget()Get LWM.@org.jetbrains.annotations.Nullable byte[]getBytes()longhighestAppliedCounter()Returns highest applied update counter.voidinit(long initUpdCntr, @org.jetbrains.annotations.Nullable byte[] cntrUpdData)Restores update counter state.longinitial()Iterator<long[]>iterator()longnext()Increment LWM by 1.longnext(long delta)Increment LWM by delta.longreserve(long delta)Increment HWM by delta.longreserved()Returns HWM.voidreset()Reset counter internal state to zero.voidresetInitialCounter()Reset the initial counter value to zero.booleansequential()StringtoString()voidupdate(long val)Sets update counter to absolute value.booleanupdate(long start, long delta)Applies counter update out of range.voidupdateInitial(long start, long delta)-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
PartitionUpdateCounterErrorWrapper
public PartitionUpdateCounterErrorWrapper(int partId, PartitionUpdateCounter delegate)- Parameters:
partId- Part id.delegate- Delegate.
-
-
Method Detail
-
reserve
public long reserve(long delta)
Increment HWM by delta.- Specified by:
reservein interfacePartitionUpdateCounter- Parameters:
delta- Delta.- Returns:
- New HWM.
-
init
public void init(long initUpdCntr, @Nullable @org.jetbrains.annotations.Nullable byte[] cntrUpdData)Restores update counter state.- Specified by:
initin interfacePartitionUpdateCounter- Parameters:
initUpdCntr- LWM.cntrUpdData- Counter updates raw data.
-
next
public long next()
Increment LWM by 1.- Specified by:
nextin interfacePartitionUpdateCounter- Returns:
- New LWM.
-
next
public long next(long delta)
Increment LWM by delta.- Specified by:
nextin interfacePartitionUpdateCounter- Parameters:
delta- Delta.- Returns:
- New LWM.
-
update
public void update(long val) throws IgniteCheckedExceptionSets update counter to absolute value. All missed updates will be discarded.- Specified by:
updatein interfacePartitionUpdateCounter- Parameters:
val- Absolute value.- Throws:
IgniteCheckedException- if counter cannot be set to passed value due to incompatibility with current state.
-
update
public boolean update(long start, long delta)Applies counter update out of range. Update ranges must not intersect.- Specified by:
updatein interfacePartitionUpdateCounter- Parameters:
start- Start (<= lwm).delta- Delta.- Returns:
Trueif update was actually applied.
-
reset
public void reset()
Reset counter internal state to zero.- Specified by:
resetin interfacePartitionUpdateCounter
-
updateInitial
public void updateInitial(long start, long delta)- Specified by:
updateInitialin interfacePartitionUpdateCounter- Parameters:
start- Counter.delta- Delta.
-
finalizeUpdateCounters
public GridLongList finalizeUpdateCounters()
Flushes pending update counters closing all possible gaps.- Specified by:
finalizeUpdateCountersin interfacePartitionUpdateCounter- Returns:
- Even-length array of pairs [start, end] for each gap.
-
resetInitialCounter
public void resetInitialCounter()
Reset the initial counter value to zero.- Specified by:
resetInitialCounterin interfacePartitionUpdateCounter
-
initial
public long initial()
- Specified by:
initialin interfacePartitionUpdateCounter
-
get
public long get()
Get LWM.- Specified by:
getin interfacePartitionUpdateCounter- Returns:
- Current LWM.
-
reserved
public long reserved()
Returns HWM.- Specified by:
reservedin interfacePartitionUpdateCounter- Returns:
- Current HWM.
-
highestAppliedCounter
public long highestAppliedCounter()
Returns highest applied update counter.- Specified by:
highestAppliedCounterin interfacePartitionUpdateCounter- Returns:
- Highest applied counter.
-
getBytes
@Nullable public @org.jetbrains.annotations.Nullable byte[] getBytes()
- Specified by:
getBytesin interfacePartitionUpdateCounter
-
sequential
public boolean sequential()
- Specified by:
sequentialin interfacePartitionUpdateCounter- Returns:
Trueif counter has no missed updates.
-
empty
public boolean empty()
- Specified by:
emptyin interfacePartitionUpdateCounter- Returns:
Trueif counter has not seen any update.
-
iterator
public Iterator<long[]> iterator()
- Specified by:
iteratorin interfaceIterable<long[]>- Specified by:
iteratorin interfacePartitionUpdateCounter- Returns:
- Iterator for pairs [start, range] for each out-of-order update in the update counter sequence.
-
context
public CacheGroupContext context()
- Specified by:
contextin interfacePartitionUpdateCounter- Returns:
- Cache group context.
-
copy
public PartitionUpdateCounter copy()
- Specified by:
copyin interfacePartitionUpdateCounter- Returns:
- A deep copy of current instance.
-
comparableState
public Object comparableState()
- Specified by:
comparableStatein interfacePartitionUpdateCounter- Returns:
- Comparable counter state.
-
-