@InterfaceAudience.Private public class ProcedureStoreTracker extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ProcedureStoreTracker.DeleteState |
Modifier and Type | Field and Description |
---|---|
private boolean |
keepDeletes
If true, do not remove bits corresponding to deleted procedures.
|
private static org.slf4j.Logger |
LOG |
private TreeMap<Long,BitSetNode> |
map |
private long |
maxModifiedProcId |
private long |
minModifiedProcId |
(package private) boolean |
partial
If true, it means tracker has incomplete information about the active/deleted procedures.
|
Constructor and Description |
---|
ProcedureStoreTracker() |
Modifier and Type | Method and Description |
---|---|
private BitSetNode |
delete(BitSetNode node,
long procId) |
void |
delete(long procId) |
void |
delete(long[] procIds) |
void |
dump() |
long |
getActiveMinProcId() |
long[] |
getAllActiveProcIds()
Will be used when there are too many proc wal files.
|
long |
getModifiedMaxProcId() |
long |
getModifiedMinProcId() |
private BitSetNode |
getOrCreateNode(long procId) |
private BitSetNode |
growNode(BitSetNode node,
long procId)
Grows
node to contain procId and updates the map. |
private BitSetNode |
insert(BitSetNode node,
long procId) |
void |
insert(long procId) |
void |
insert(long[] procIds) |
void |
insert(long procId,
long[] subProcIds) |
boolean |
isAllModified() |
ProcedureStoreTracker.DeleteState |
isDeleted(long procId)
If
partial is false, returns state from the bitmap. |
boolean |
isEmpty() |
boolean |
isModified(long procId) |
boolean |
isPartial() |
private BitSetNode |
lookupClosestNode(BitSetNode node,
long procId)
lookup the node containing the specified procId.
|
private BitSetNode |
mergeNodes(BitSetNode leftNode,
BitSetNode rightNode)
Merges
leftNode & rightNode and updates the map. |
void |
reset() |
void |
resetModified()
Clears the list of updated procedure ids.
|
void |
resetTo(ProcedureStoreTracker tracker)
Resets internal state to same as given
tracker . |
void |
resetTo(ProcedureStoreTracker tracker,
boolean resetDelete)
Resets internal state to same as given
tracker , and change the deleted flag according
to the modified flag if resetDelete is true. |
void |
resetToProto(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureStoreTracker trackerProtoBuf) |
void |
setDeleted(long procId,
boolean isDeleted)
This method is used when restarting where we need to rebuild the ProcedureStoreTracker.
|
void |
setDeletedIfDeletedByThem(ProcedureStoreTracker tracker)
For the global tracker, we will use this method to build the holdingCleanupTracker, as the
modified flags will be cleared after rolling so we only need to test the deleted flags.
|
void |
setDeletedIfModified(long... procId)
Set the given bit for the procId to delete if it was modified before.
|
void |
setDeletedIfModifiedInBoth(ProcedureStoreTracker tracker)
|
private void |
setDeleteIf(ProcedureStoreTracker tracker,
BiFunction<BitSetNode,Long,Boolean> func) |
void |
setKeepDeletes(boolean keepDeletes) |
void |
setMinMaxModifiedProcIds(long min,
long max)
Will be called when restarting where we need to rebuild the ProcedureStoreTracker.
|
void |
setPartialFlag(boolean isPartial) |
org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureStoreTracker |
toProto()
Builds
org.apache.hadoop.hbase.protobuf.generated.ProcedureProtos.ProcedureStoreTracker
protocol buffer from current state.
|
private void |
trackProcIds(long procId) |
private BitSetNode |
update(BitSetNode node,
long procId) |
void |
update(long procId) |
private static final org.slf4j.Logger LOG
private final TreeMap<Long,BitSetNode> map
private boolean keepDeletes
boolean partial
isDeleted(long)
docs to
understand it's real use.private long minModifiedProcId
private long maxModifiedProcId
public ProcedureStoreTracker()
public void resetToProto(org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureStoreTracker trackerProtoBuf)
public void resetTo(ProcedureStoreTracker tracker)
tracker
. Does deep copy of the bitmap.public void resetTo(ProcedureStoreTracker tracker, boolean resetDelete)
tracker
, and change the deleted flag according
to the modified flag if resetDelete
is true. Does deep copy of the bitmap.
The resetDelete
will be set to true when building cleanup tracker, please see the
comments in BitSetNode.BitSetNode(BitSetNode, boolean)
to learn how we change the
deleted flag if resetDelete
is true.public void insert(long procId)
public void insert(long[] procIds)
public void insert(long procId, long[] subProcIds)
private BitSetNode insert(BitSetNode node, long procId)
public void update(long procId)
private BitSetNode update(BitSetNode node, long procId)
public void delete(long procId)
public void delete(long[] procIds)
private BitSetNode delete(BitSetNode node, long procId)
public void setMinMaxModifiedProcIds(long min, long max)
public void setDeleted(long procId, boolean isDeleted)
delete(long)
method above assume that the BitSetNode
exists, but when restart
this is not true, as we will read the wal files in reverse order so a delete may come first.public void setDeletedIfModified(long... procId)
private void setDeleteIf(ProcedureStoreTracker tracker, BiFunction<BitSetNode,Long,Boolean> func)
public void setDeletedIfDeletedByThem(ProcedureStoreTracker tracker)
public void setDeletedIfModifiedInBoth(ProcedureStoreTracker tracker)
setDeletedIfModified(long...)
, but here the procId
are given by
the tracker
. If a procedure is modified by us, and also by the given tracker
,
then we mark it as deleted.setDeletedIfModified(long...)
private BitSetNode lookupClosestNode(BitSetNode node, long procId)
node
- cached node to check before doing a lookupprocId
- the procId to lookupprivate void trackProcIds(long procId)
public long getModifiedMinProcId()
public long getModifiedMaxProcId()
public void reset()
public boolean isModified(long procId)
public ProcedureStoreTracker.DeleteState isDeleted(long procId)
partial
is false, returns state from the bitmap. If no state is found for
procId
, returns YES.
If partial is true, tracker doesn't have complete view of system state, so it returns MAYBE
if there is no update for the procedure or if it doesn't have a state in bitmap. Otherwise,
returns state from the bitmap.public long getActiveMinProcId()
public void setKeepDeletes(boolean keepDeletes)
public boolean isPartial()
public void setPartialFlag(boolean isPartial)
public boolean isEmpty()
public boolean isAllModified()
resetModified()
.public long[] getAllActiveProcIds()
public void resetModified()
private BitSetNode getOrCreateNode(long procId)
private BitSetNode growNode(BitSetNode node, long procId)
node
to contain procId
and updates the map.BitSetNode
instance which contains procId
.private BitSetNode mergeNodes(BitSetNode leftNode, BitSetNode rightNode)
leftNode
& rightNode
and updates the map.public void dump()
public org.apache.hadoop.hbase.shaded.protobuf.generated.ProcedureProtos.ProcedureStoreTracker toProto() throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.