public class GlobalCBVLSN extends Object
In version 7.5 and greater we instead retain all files up to the disk
limits just in case they are needed for replication, and the GlobalCBVLSN
is no longer needed. The FileProtector is
used for preventing file deletion on a local node. See [#25220] in the
JE 7.5 change log for a list of related external changes.
The global and local CBVLSNs are completely defunct (no longer maintained) in a rep group where all nodes are running JE 7.5 or greater. In a mixed version group of new (7.5 or later) and old (pre-7.5) nodes, we must continue to maintain the GlobalCBVLSN for the sake of the old nodes. If we did not do this, for example, the following scenario could occur:
- RF-3, N1 is new, N2 and N3 are old.
- N1 is the master, N2 is an up-to-date replica, N3 is a lagging replica.
- N2 deletes files that would be needed to feed N3, because the GlobalVLSN
is not updated and therefore N2 doesn't know that N3 is lagging.
- N1 goes down, N2 is elected master
- N3 requires a network restore because N2 doesn't have the files that N3
needs for syncup.
The c.s.je.rep.impl.node.cbvlsn package contains most of the code for maintaining the CBVLSN. This code is isolated here for two reasons:
When it is not yet defunct, the GlobalCBVLSN class represents this node's view of the global CBVLSN. Each node has its own view of the global CBVLSN, based upon its local replicated copy of the rep group db. There is a single instance of the GlobalCBVLSN and it exists for the lifetime of the RepNode.
A global CBVLSN is a per-environment value, and is safeguarded from decreasing during the lifetime of a single RepImpl. Because nodes crash and re-sync, and new nodes join, it's possible that the persisted local cbvlsns can decrease, and drag the global cbvlsn value down, but those decreases are ignored during the lifetime of the global CBVLSN instance.
On pre-7.5 nodes, the global CBVLSN is used by:
| Constructor and Description |
|---|
GlobalCBVLSN(RepNode repNode) |
| Modifier and Type | Method and Description |
|---|---|
VLSN |
getCBVLSN()
Returns the global CBVLSN if it is not defunct.
|
VLSN |
getRestoreResponseVLSN(VLSNRange range)
Returns a VLSN appropriate for the RestoreResponse.cbvlsn field when the
GlobalCBVLSN is not defunct.
|
void |
init(RepNode repNode,
JEVersion minJEVersion)
Uses minJEVersion to determine whether the global CBVLSN is defunct.
|
boolean |
isDefunct()
Returns true if all nodes in the group are running JE 7.5 or later, and
therefore the GlobalCBVLSN is not maintained.
|
void |
recalculate(RepGroupImpl groupInfo)
Recalculates the GlobalVLSN when it is not defunct.
|
void |
setDefunctJEVersion(RepNode repNode)
Calls RepNode.setMinJEVersion to upgrade the min version to
DEFUNCT_JE_VERSION.
|
void |
updateGroupInfo(NameIdPair updateNameIdPair,
CleanerBarrierState barrierState)
Updates the cached group info for the node, avoiding a database read,
if the global CBVLSN is not defunct.
|
public GlobalCBVLSN(RepNode repNode)
public void init(RepNode repNode, JEVersion minJEVersion)
setDefunctJEVersion(RepNode) for how the minJEVersion is
set for a new group (with new software) and for an upgraded group.minJEVersion - the min JE version for the group, or null if
unknown.public void setDefunctJEVersion(RepNode repNode)
public boolean isDefunct()
public VLSN getCBVLSN()
For sake of old nodes, the global CBVLSN is computed as the minimum of CBVLSNs after discarding CBVLSNs that are obsolete. A CBVLSN is considered obsolete if it has not been updated within a configurable time interval relative to the time that the most recent CBVLSN was updated.
public void updateGroupInfo(NameIdPair updateNameIdPair, CleanerBarrierState barrierState)
updateNameIdPair - the node whose localCBVLSN must be updated.barrierState - the new node syncup statepublic void recalculate(RepGroupImpl groupInfo)
For sake of old nodes, the globalCBVLSN is computed as it was earlier: the minimum of CBVLSNs after discarding CBVLSNs that are obsolete. A CBVLSN is considered obsolete if it has not been updated within a configurable time interval relative to the time that the most recent CBVLSN was updated.
Note that the read of GroupInfo is not protected, and that groupInfo could be changing. That's okay, because we guarantee that none of the local CBVLSNs can be LT globalCBVLSN. If a local CBVLSN is written, and we miss it, it only means that this recalculation of global CBVLSN is too pessimistic -- it's too low.
Secondary nodes do not appear in the RepGroupDB, but the feeder has local CBVLSN values for them which are part of this calculation. Secondary nodes and new nodes have their VLSN ranges protected by the mechanism which tries to ensure that files which may be needed by active feeders are not candidates for deletion.
public VLSN getRestoreResponseVLSN(VLSNRange range)
When sending a RestoreResponse to a (potentially) old node, we supply a VLSN that will cause selection of reasonably current nodes as a server (feeder) for the network restore. The return value is the VLSN range end of this node (the master) minus a value that will allow up-to-date servers to qualify (NETWORKBACKUP_MAX_LAG). Old nodes will reject servers whose VLSN range does not cover this VLSN.
In JE 7.4 and earlier, the "group CBVLSN" was used for this value. This was incorrect, because it was the lower bound for lagging replicas and reserved files. In JE 7.5 we improve on this by sending the value described above, when older nodes must be supported.
When GlobalCBLVSN is defunct, a null VLSN is returned because the
RestoreResponse.cbvlsn field is not used at all. See the updated
'Algorithm' in NetworkRestore.
Copyright © 2024. All rights reserved.