com.sleepycat.je.rep.impl.networkRestore
Class NetworkBackup
java.lang.Object
com.sleepycat.je.rep.impl.networkRestore.NetworkBackup
public class NetworkBackup
- extends Object
This class implements a hot network backup that permits it to obtain a
consistent set of log files from any running environment that provides a
LogFileFeeder service. This class thus plays the role of a client, and the
running environment that of a server.
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.
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. [Sam: should we create a je.lck file to ensure that this is
the case?]
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serverLoadThreshold
final int serverLoadThreshold
messageDigest
final MessageDigest messageDigest
NetworkBackup
public NetworkBackup(InetSocketAddress serverSocket,
File envDir,
NameIdPair clientNameId,
boolean retainLogfiles,
int serverLoadThreshold,
VLSN minVLSN,
RepImpl repImpl)
throws IllegalArgumentException
- Creates a configured backup instance which when executed will backup the
files to the environment directory.
- Parameters:
serverSocket
- the socket on which to contact the serverenvDir
- 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.minVLSN
- the VLSN that should be covered by the server. It ensures
that the log files are sufficiently current for this client's needs.
- Throws:
IllegalArgumentException
- if the environment directory is not
valid. When used internally, this should be caught appropriately.
NetworkBackup
public NetworkBackup(InetSocketAddress serverSocket,
File envDir,
NameIdPair clientNameId,
boolean retainLogfiles)
throws DatabaseException
- Convenience overloading.
- Throws:
DatabaseException
- See Also:
NetworkBackup(InetSocketAddress, File, NameIdPair, boolean, int,
VLSN, RepImpl)
getStats
public StatGroup getStats()
- Returns statistics associated with the NetworkBackup execution.
execute
public String[] execute()
throws IOException,
DatabaseException,
ServiceDispatcher.ServiceConnectFailedException,
NetworkBackup.LoadThresholdExceededException,
NetworkBackup.InsufficientVLSNRangeException
- Execute the backup.
- Throws:
ServiceDispatcher.ServiceConnectFailedException
NetworkBackup.LoadThresholdExceededException
NetworkBackup.InsufficientVLSNRangeException
IOException
DatabaseException
getFile
protected void getFile(File file)
throws IOException,
BinaryProtocol.ProtocolException,
NetworkBackup.DigestException
- Requests and obtains the specific log file from the server. The file is
first created under a name with the .tmp suffix and is renamed to its
true name only after its digest has been verified.
This method is protected to facilitate error testing.
- Throws:
IOException
BinaryProtocol.ProtocolException
NetworkBackup.DigestException
setTestBarrier
public void setTestBarrier(CyclicBarrier testBarrier)
Copyright (c) 2004-2010 Oracle. All rights reserved.