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

java.lang.Object
  extended by com.sleepycat.je.rep.utilint.BinaryProtocol
      extended by com.sleepycat.je.rep.util.ldiff.Protocol

public class Protocol
extends BinaryProtocol

Protocol used by LDiff to request the blocks associated with a database and do the record level analysis. BLOCK LEVEL ANALYSIS ========================================= The request response sequence for a block list request is: EnvDiff -> EnvInfo -> DbBlocks -> BlockListStart [BlockInfo]+ BlockListEnd A DbMismatch response is sent back if the database does not exist, or if the database has different persistent attributes associated with it. Note that this request is designed to maximize overlap. That is, the responder could be working on block n, while the requester is working on blocks n+1 and beyond (to the end of the database). The above is the minimal set of messages, biased for performance when the databases are expected to match. RECORD LEVEL ANALYSIS ========================================= User can configure LDiff to do record level analysis by setting LDiffConfig.setDiffAnalysis(true), it can help you find out which records are different between two databases. The request response sequence for record level analysis is: RemoteDiffRequest -> DiffAreaStart|Error [RemoteRecord] DiffAreaEnd -> Done The local Environment would send out a RemoteDiffRequest to the remote Environment, the remote Environment can get all the records of a different area: 1. If there exists exceptions during the fetching process, remote Environment would send back an Error message, local Environment would throw out a LDiffRecordRequestException and exit. 2. If the fetching process is correct, remote Environment would send a DiffAreaStart message to the local Environment to notify that it now transfers RemoteRecords of a different area. 3. After all the records of a different area are transferred, remote Environment would send out a DiffAreaEnd message, which specifies transferring a different area is finished. 4. When all the RemoteDiffRequest are processed, local Environment would send a Done message to presents the record level analysis is done. TODO: 1) Protocol version matching 2) Block granularity sync request. 3) Protocol to narrow a diff down to a specific set of key inserts, updates and deletes.


Nested Class Summary
 class Protocol.BlockInfo
          Supplies the properties of an individual block.
 class Protocol.BlockListEnd
          Denotes the end of the list of blocks.
 class Protocol.BlockListStart
          Denotes the start of the list of blocks.
 class Protocol.DbBlocks
          Message used to request a list of blocks.
 class Protocol.DbMismatch
          Issued in response to a database level mismatch either because the database itself does not exist at the node, or because it's properties are different.
 class Protocol.DiffAreaEnd
          Message used to present the transfer of a different area on remote database is done.
 class Protocol.DiffAreaStart
          Message used to present the transfer of a different area on remote database begins.
 class Protocol.Done
          Message used to present the transfer of all the different data is done.
 class Protocol.EnvDiff
          Message used to present that an Environment is requesting to do a LDiff with another Environment.
 class Protocol.EnvInfo
          Message used to present how many databases in a compared Environment.
 class Protocol.Error
          Message used to present an operation error on remote database.
 class Protocol.RemoteDiffRequest
          Message used to request records of a different area on the remote database.
 class Protocol.RemoteRecord
          Message used to transfer a record from remote to local database.
 
Nested classes/interfaces inherited from class com.sleepycat.je.rep.utilint.BinaryProtocol
BinaryProtocol.ClientVersion, BinaryProtocol.IncompatibleVersion, BinaryProtocol.Message, BinaryProtocol.MessageOp, BinaryProtocol.ProtocolError, BinaryProtocol.ProtocolException, BinaryProtocol.RejectMessage, BinaryProtocol.ServerVersion, BinaryProtocol.SimpleMessage
 
Field Summary
static BinaryProtocol.MessageOp BLOCK_INFO
           
static BinaryProtocol.MessageOp BLOCK_LIST_END
           
static BinaryProtocol.MessageOp BLOCK_LIST_START
           
static BinaryProtocol.MessageOp DB_BLOCKS
           
static BinaryProtocol.MessageOp DB_MISMATCH
           
static BinaryProtocol.MessageOp DIFF_AREA_END
           
static BinaryProtocol.MessageOp DIFF_AREA_START
           
static BinaryProtocol.MessageOp DONE
           
static BinaryProtocol.MessageOp ENV_DIFF
           
static BinaryProtocol.MessageOp ENV_INFO
           
static BinaryProtocol.MessageOp ERROR
           
static BinaryProtocol.MessageOp REMOTE_DIFF_REQUEST
           
static BinaryProtocol.MessageOp REMOTE_RECORD
           
static int VERSION
           
 
Fields inherited from class com.sleepycat.je.rep.utilint.BinaryProtocol
CLIENT_VERSION, codeVersion, configuredVersion, envImpl, formatter, header, INCOMPATIBLE_VERSION, logger, MESSAGE_HEADER_SIZE, nameIdPair, nBytesRead, nBytesWritten, nMessagesRead, nMessagesWritten, nReadNanos, nWriteNanos, PROTOCOL_ERROR, SERVER_VERSION, stats
 
Constructor Summary
Protocol(NameIdPair nameIdPair, EnvironmentImpl envImpl)
           
 
Method Summary
 
Methods inherited from class com.sleepycat.je.rep.utilint.BinaryProtocol
getPredefinedMessageCount, getStats, getString, getVersion, initializeMessageOps, messageCount, putString, read, read, resetStats, stringSize, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final int VERSION
See Also:
Constant Field Values

DB_BLOCKS

public static final BinaryProtocol.MessageOp DB_BLOCKS

DB_MISMATCH

public static final BinaryProtocol.MessageOp DB_MISMATCH

BLOCK_LIST_START

public static final BinaryProtocol.MessageOp BLOCK_LIST_START

BLOCK_INFO

public static final BinaryProtocol.MessageOp BLOCK_INFO

BLOCK_LIST_END

public static final BinaryProtocol.MessageOp BLOCK_LIST_END

ENV_DIFF

public static final BinaryProtocol.MessageOp ENV_DIFF

ENV_INFO

public static final BinaryProtocol.MessageOp ENV_INFO

REMOTE_DIFF_REQUEST

public static final BinaryProtocol.MessageOp REMOTE_DIFF_REQUEST

REMOTE_RECORD

public static final BinaryProtocol.MessageOp REMOTE_RECORD

DIFF_AREA_START

public static final BinaryProtocol.MessageOp DIFF_AREA_START

DIFF_AREA_END

public static final BinaryProtocol.MessageOp DIFF_AREA_END

DONE

public static final BinaryProtocol.MessageOp DONE

ERROR

public static final BinaryProtocol.MessageOp ERROR
Constructor Detail

Protocol

public Protocol(NameIdPair nameIdPair,
                EnvironmentImpl envImpl)


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