org.apache.hadoop.hdfs.server.protocol
Interface NamenodeProtocol

All Superinterfaces:
org.apache.hadoop.ipc.VersionedProtocol
All Known Subinterfaces:
NamenodeProtocols
All Known Implementing Classes:
BackupNode, NameNode

@InterfaceAudience.Private
public interface NamenodeProtocol
extends org.apache.hadoop.ipc.VersionedProtocol

Protocol that a secondary NameNode uses to communicate with the NameNode. It's used to get part of the name node state


Field Summary
static int ACT_CHECKPOINT
           
static int ACT_SHUTDOWN
           
static int ACT_UNKNOWN
           
static int FATAL
           
static byte JA_CHECKPOINT_TIME
           
static byte JA_IS_ALIVE
           
static byte JA_JOURNAL
           
static byte JA_JSPOOL_START
           
static int NOTIFY
           
static long versionID
          Compared to the previous version the following changes have been introduced: (Only the latest change is reflected.
 
Method Summary
 void endCheckpoint(NamenodeRegistration registration, CheckpointSignature sig)
          A request to the active name-node to finalize previously started checkpoint.
 void errorReport(NamenodeRegistration registration, int errorCode, String msg)
          Report to the active name-node an error occurred on a subordinate node.
 ExportedAccessKeys getAccessKeys()
          Get the current access keys
 BlocksWithLocations getBlocks(DatanodeInfo datanode, long size)
          Get a list of blocks belonging to datanode whose total size equals size.
 long getEditLogSize()
          Deprecated. See SecondaryNameNode
 void journal(NamenodeRegistration registration, int jAction, int length, byte[] records)
          Journal edit records.
 long journalSize(NamenodeRegistration registration)
          Get the size of the active name-node journal (edit log) in bytes.
 NamenodeRegistration register(NamenodeRegistration registration)
          Register a subordinate name-node like backup node.
 CheckpointSignature rollEditLog()
          Deprecated. See SecondaryNameNode
 void rollFsImage()
          Deprecated. See SecondaryNameNode
 NamenodeCommand startCheckpoint(NamenodeRegistration registration)
          A request to the active name-node to start a checkpoint.
 NamespaceInfo versionRequest()
          Request name-node version and storage information.
 
Methods inherited from interface org.apache.hadoop.ipc.VersionedProtocol
getProtocolVersion
 

Field Detail

versionID

static final long versionID
Compared to the previous version the following changes have been introduced: (Only the latest change is reflected. The log of historical changes can be retrieved from the svn). 4: new method added: getAccessKeys()

See Also:
Constant Field Values

NOTIFY

static final int NOTIFY
See Also:
Constant Field Values

FATAL

static final int FATAL
See Also:
Constant Field Values

JA_IS_ALIVE

static final byte JA_IS_ALIVE
See Also:
Constant Field Values

JA_JOURNAL

static final byte JA_JOURNAL
See Also:
Constant Field Values

JA_JSPOOL_START

static final byte JA_JSPOOL_START
See Also:
Constant Field Values

JA_CHECKPOINT_TIME

static final byte JA_CHECKPOINT_TIME
See Also:
Constant Field Values

ACT_UNKNOWN

static final int ACT_UNKNOWN
See Also:
Constant Field Values

ACT_SHUTDOWN

static final int ACT_SHUTDOWN
See Also:
Constant Field Values

ACT_CHECKPOINT

static final int ACT_CHECKPOINT
See Also:
Constant Field Values
Method Detail

getBlocks

BlocksWithLocations getBlocks(DatanodeInfo datanode,
                              long size)
                              throws IOException
Get a list of blocks belonging to datanode whose total size equals size.

Parameters:
datanode - a data node
size - requested size
Returns:
a list of blocks & their locations
Throws:
RemoteException - if size is less than or equal to 0 or datanode does not exist
IOException
See Also:
Balancer

getAccessKeys

ExportedAccessKeys getAccessKeys()
                                 throws IOException
Get the current access keys

Returns:
ExportedAccessKeys containing current access keys
Throws:
IOException

getEditLogSize

@Deprecated
long getEditLogSize()
                    throws IOException
Deprecated. See SecondaryNameNode

Get the size of the current edit log (in bytes).

Returns:
The number of bytes in the current edit log.
Throws:
IOException

rollEditLog

@Deprecated
CheckpointSignature rollEditLog()
                                throws IOException
Deprecated. See SecondaryNameNode

Closes the current edit log and opens a new one. The call fails if the file system is in SafeMode.

Returns:
a unique token to identify this transaction.
Throws:
IOException

rollFsImage

@Deprecated
void rollFsImage()
                 throws IOException
Deprecated. See SecondaryNameNode

Rolls the fsImage log. It removes the old fsImage, copies the new image to fsImage, removes the old edits and renames edits.new to edits. The call fails if any of the four files are missing.

Throws:
IOException

versionRequest

NamespaceInfo versionRequest()
                             throws IOException
Request name-node version and storage information.

Returns:
NamespaceInfo identifying versions and storage information of the name-node
Throws:
IOException

errorReport

void errorReport(NamenodeRegistration registration,
                 int errorCode,
                 String msg)
                 throws IOException
Report to the active name-node an error occurred on a subordinate node. Depending on the error code the active node may decide to unregister the reporting node.

Parameters:
registration - requesting node.
errorCode - indicates the error
msg - free text description of the error
Throws:
IOException

register

NamenodeRegistration register(NamenodeRegistration registration)
                              throws IOException
Register a subordinate name-node like backup node.

Returns:
NamenodeRegistration of the node, which this node has just registered with.
Throws:
IOException

startCheckpoint

NamenodeCommand startCheckpoint(NamenodeRegistration registration)
                                throws IOException
A request to the active name-node to start a checkpoint. The name-node should decide whether to admit it or reject. The name-node also decides what should be done with the backup node image before and after the checkpoint.

Parameters:
registration - the requesting node
Returns:
CheckpointCommand if checkpoint is allowed.
Throws:
IOException
See Also:
CheckpointCommand, NamenodeCommand, ACT_SHUTDOWN

endCheckpoint

void endCheckpoint(NamenodeRegistration registration,
                   CheckpointSignature sig)
                   throws IOException
A request to the active name-node to finalize previously started checkpoint.

Parameters:
registration - the requesting node
sig - CheckpointSignature which identifies the checkpoint.
Throws:
IOException

journalSize

long journalSize(NamenodeRegistration registration)
                 throws IOException
Get the size of the active name-node journal (edit log) in bytes.

Parameters:
registration - the requesting node
Returns:
The number of bytes in the journal.
Throws:
IOException

journal

void journal(NamenodeRegistration registration,
             int jAction,
             int length,
             byte[] records)
             throws IOException
Journal edit records. This message is sent by the active name-node to the backup node via EditLogBackupOutputStream in order to synchronize meta-data changes with the backup namespace image.

Parameters:
registration - active node registration
jAction - journal action
length - length of the byte array
records - byte array containing serialized journal records
Throws:
IOException


Copyright © 2009 The Apache Software Foundation