public class NetworkBackup extends Object
The log files that are retrieved over the network are placed in a directory that can serve as an environment directory for a JE stand alone or HA environment. If log files are already present in the target directory, it will try reuse them, if they are really consistent with those on the server. Extant log files that are no longer part of the current backup file set are deleted or are renamed, depending on how the backup operation was configured.
Renamed backup files have the following syntax: NNNNNNNN.bup.backup number where the backup number is the number associated with the backup attempt, rather than with an individual file. That is, the backup number is increased by one each time a backup is repeated in the same directory and log files actually needed to be renamed.
The implementation tries to be resilient in the face of network failures and
minimizes the amount of work that might need to be done if the client or
server were to fail and had to be restarted. Users of this API must be
careful to ensure that the execute() completes successfully before accessing
the environment. The user fails to do this, the InsufficientLogException
will be thrown again when the user attempts to open the environment. This
safeguard is implemented using the RestoreMarker mechanism.
| Modifier and Type | Class and Description |
|---|---|
protected static class |
NetworkBackup.DigestException
Exception indicating that the digest sent by the server did not match
the digest computed by the client, that is, the log file was corrupted
during transit.
|
static class |
NetworkBackup.InsufficientVLSNRangeException
Exception indicating that the server vlsn range did not cover the VLSN
of interest.
|
static class |
NetworkBackup.LoadThresholdExceededException |
static class |
NetworkBackup.RejectedServerException
Exception indicating that the server could not be used for the restore.
|
| Constructor and Description |
|---|
NetworkBackup(InetSocketAddress serverSocket,
File envDir,
NameIdPair clientNameId,
boolean retainLogfiles,
FileManager fileManager,
LogManager logManager,
DataChannelFactory channelFactory)
Convenience overloading.
|
NetworkBackup(InetSocketAddress serverSocket,
int receiveBufferSize,
File envDir,
NameIdPair clientNameId,
boolean retainLogfiles,
int serverLoadThreshold,
VLSN minVLSN,
RepImpl repImpl,
FileManager fileManager,
LogManager logManager,
DataChannelFactory channelFactory,
Properties exceptionProperties)
Creates a configured backup instance which when executed will backup the
files to the environment directory.
|
| Modifier and Type | Method and Description |
|---|---|
String[] |
execute()
Execute the backup.
|
protected void |
getFile(File file)
Requests and obtains the specific log file from the server.
|
NetworkBackupStats |
getStats()
Returns statistics associated with the NetworkBackup execution.
|
void |
setInterruptHook(TestHook<File> hook) |
void |
setTestBarrier(CyclicBarrier testBarrier) |
public NetworkBackup(InetSocketAddress serverSocket, int receiveBufferSize, File envDir, NameIdPair clientNameId, boolean retainLogfiles, int serverLoadThreshold, VLSN minVLSN, RepImpl repImpl, FileManager fileManager, LogManager logManager, DataChannelFactory channelFactory, Properties exceptionProperties) throws IllegalArgumentException
serverSocket - the socket on which to contact the serverreceiveBufferSize - the receive buffer size to be associated with
the socket used for the log file transfers.envDir - the directory in which to place the log filesclientNameId - the id used to identify this clientretainLogfiles - determines whether obsolete log files should be
retained by renaming them, instead of deleting them.serverLoadThreshold - only backup from this server if it has fewer
than this number of feeders active.repImpl - is passed in as a distinct field from the log manager and
file manager because it is used only for logging and environment
invalidation. A network backup may be invoked by unit tests without
an enclosing environment.minVLSN - the VLSN that should be covered by the server. It ensures
that the log files are sufficiently current for this client's needs.IllegalArgumentException - if the environment directory is not
valid. When used internally, this should be caught appropriately.public NetworkBackup(InetSocketAddress serverSocket, File envDir, NameIdPair clientNameId, boolean retainLogfiles, FileManager fileManager, LogManager logManager, DataChannelFactory channelFactory) throws DatabaseException
public NetworkBackupStats getStats()
public String[] execute() throws IOException, DatabaseException, ServiceDispatcher.ServiceConnectFailedException, NetworkBackup.LoadThresholdExceededException, NetworkBackup.InsufficientVLSNRangeException, RestoreMarker.FileCreationException
protected void getFile(File file) throws IOException, BinaryProtocol.ProtocolException, NetworkBackup.DigestException, RestoreMarker.FileCreationException
public void setTestBarrier(CyclicBarrier testBarrier)
Copyright © 2024. All rights reserved.