private Message makeResponseToEntryRequest(VLSNRange range,
EntryRequest request,
boolean isFirstResponse)
throws IOException, ChecksumException {
VLSN requestMatchpoint = request.getVLSN();
/*
* We need to guarantee that we will be able to service the replication
* stream after a matchpoint is chosen. Because of that, the matchpoint
* must be >= the first in the rep stream, for obvious reasons (we
* wouldn't have the log record), and also >= the global CBVLSN (the
* log cleaner is allowed to delete anything < the global CBVLSN.
*/
VLSN globalCBVLSN = repNode.getGroupCBVLSN();
if (globalCBVLSN.isNull()) {
if (range.getFirst().compareTo(requestMatchpoint) > 0) {
/*
* This case can only happen if the node's log was created as
* the result of a network restore or a standalone
* conversion. The global CBVLSN is not set yet, and the range
* does not start with 1. If the node had been populated the
* usual way, the global CBVLSN would be set.
*/
return protocol.new EntryNotFound();
}
} else {
if (globalCBVLSN.compareTo(requestMatchpoint) > 0) {
return protocol.new EntryNotFound();
}
}
/*
* The global CBVLSN should have throttle log cleaning, so the first
* value in the range should always be <= the global CBVLSN.
*/
if (!globalCBVLSN.isNull() &&
range.getFirst().compareTo(globalCBVLSN) > 0) {
throw EnvironmentFailureException.unexpectedState
("Range " + range + " precedes globalCBVLSN " + globalCBVLSN);
}