com.sleepycat.je.rep.util.ldiff
Class LDiff

java.lang.Object
  extended by com.sleepycat.je.rep.util.ldiff.LDiff

public class LDiff
extends Object

LDiff provides a mechanism for efficiently comparing two quiescent databases, typically residing on different machines connected by a network. The comparison is done at the logical level rather than the physical level, so that we can compare the contents of replicated databases where the logical contents may be identical, but the physical logs may be very different. If the databases are found to be different, it provides information that would help identify the specific nature of the differences. This class provides the external API used to initiate a comparison. For details, please review the document at:

See Also:
LDiff

Nested Class Summary
(package private)  class LDiff.MismatchException
          The exception that is thrown when a database diff detects differences.
 
Constructor Summary
LDiff(LDiffConfig cfg)
          Configure a new object with which to compare two databases.
 
Method Summary
 BlockBag createBlockBag(Database db)
          Create a bag of blocks from the records in a given database, using the configuration parameters specified when the LDiff object was created.
 boolean diff(Database db, BlockBag blkBag)
          A mechanism for efficiently comparing two quiescent databases, typically residing on different machines connected by a network.
 boolean diff(Database db1, Database db2)
          A mechanism for efficiently comparing two quiescent databases.
 boolean diff(Database db, InetSocketAddress addr)
          A mechanism for efficiently comparing two quiescent databases, one of which resides on a remote machine.
 boolean diff(Environment env1, Environment env2)
          A mechanism for efficiently comparing all databases in two quiescent environments.
 boolean diff(Environment env, InetSocketAddress addr)
          A mechanism for efficiently comparing two quiescent environments, one local and one on a remote machine.
 List<MismatchedRegion> getDiffRegions()
           
 Iterator<Block> iterator(Database db)
           
static void main(String[] args)
          The main used by the LDiff utility.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDiff

public LDiff(LDiffConfig cfg)
Configure a new object with which to compare two databases.

Parameters:
cfg - the configuration parameters for the new object.
Method Detail

main

public static void main(String[] args)
The main used by the LDiff utility.

Parameters:
args - The arguments accepted by the LDiff utility.
 usage: java com.sleepycat.je.rep.util.ldiff.LDiff
             [-s database1,database2] -h dbEnvHome1[,dbEnvHome2]
             [-a] [-b blockSize] [-m maxErrors] [-q]
 

-a - generate an analysis of the differences
-b blockSize - the number of records to compare at one time
-h dbEnvHome - the directory or directories containing environment(s) in which to perform the ldiff
-m maxErrors - the maximum number of errors to detect before declaring the databases different and ending the operation.
-s database1,database2 - the databases to ldiff.
-q - be quiet, do not write to stdout

If ldiff-ing a specific database, two database names must be specified. If no database names are given, two environments must be specified. If two database names and two environments are specified, the first database is opened in the first environment and the second database is opened in the second environment.


diff

public boolean diff(Environment env1,
                    Environment env2)
             throws Exception
A mechanism for efficiently comparing all databases in two quiescent environments.

Parameters:
env1 - a valid, open Environment handle
env2 - a valid, open Environment handle
Returns:
true if all databases in env1 and env2 are identical
Throws:
LDiff.MismatchException
Exception

diff

public boolean diff(Database db1,
                    Database db2)
             throws Exception
A mechanism for efficiently comparing two quiescent databases.

Parameters:
db1 - a valid, open Database handle
db2 - a valid, open Database handle
Returns:
true if the db1 and db2 are identical
Throws:
LDiff.MismatchException
Exception

diff

public boolean diff(Environment env,
                    InetSocketAddress addr)
             throws IOException,
                    BinaryProtocol.ProtocolException,
                    ServiceDispatcher.ServiceConnectFailedException,
                    Exception
A mechanism for efficiently comparing two quiescent environments, one local and one on a remote machine.

Parameters:
env - a valid, open Environment handle
addr - the address of the remote machine
Returns:
true if all the databases in both environments are the same
Throws:
IOException - if a network error occurs
BinaryProtocol.ProtocolException - if an unexpected message is received
ServiceDispatcher.ServiceConnectFailedException - if the remote service was busy
LDiff.MismatchException
Exception

diff

public boolean diff(Database db,
                    InetSocketAddress addr)
             throws IOException,
                    BinaryProtocol.ProtocolException,
                    ServiceDispatcher.ServiceConnectFailedException,
                    Exception
A mechanism for efficiently comparing two quiescent databases, one of which resides on a remote machine.

Parameters:
db - a valid, open Database handle
addr - the address of the remote host
Returns:
true if the local Database and the remote Database are identical
Throws:
IOException - if a network error occurs
BinaryProtocol.ProtocolException - if the remote database does not exist
ServiceDispatcher.ServiceConnectFailedException - if the remote service is busy
LDiff.MismatchException
Exception

diff

public boolean diff(Database db,
                    BlockBag blkBag)
             throws Exception
A mechanism for efficiently comparing two quiescent databases, typically residing on different machines connected by a network.

Parameters:
db - a valid, open Database handle
blkBag - a bag of blocks to diff against db.
Returns:
true if the two comparing databases are identical.
Throws:
LDiff.MismatchException
Exception

getDiffRegions

public List<MismatchedRegion> getDiffRegions()

createBlockBag

public BlockBag createBlockBag(Database db)
Create a bag of blocks from the records in a given database, using the configuration parameters specified when the LDiff object was created.

Parameters:
db - the database from which to create the bag of blocks
Returns:
a bag of blocks built from the records in db

iterator

public Iterator<Block> iterator(Database db)


Copyright (c) 2004-2012 Oracle. All rights reserved.