JournalProtocol (Apache Hadoop HDFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs.server.protocol, interface: JournalProtocol

Package org.apache.hadoop.hdfs.server.protocol

# Interface JournalProtocol

All Known Implementing Classes:
  `JournalProtocolTranslatorPB`

@Private public interface JournalProtocol
Protocol used to journal edits to a remote node. Currently, this is used to publish edits from the NameNode to a BackupNode.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final long`
  `versionID`
  This class is used by both the Namenode (client) and BackupNode (server) to insulate from the protocol serialization.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FenceResponse`
  `fence(JournalInfo journalInfo, long epoch, String fencerInfo)`
  Request to fence any other journal writers.
  `void`
  `journal(JournalInfo journalInfo, long epoch, long firstTxnId, int numTxns, byte[] records)`
  Journal edit records.
  `void`
  `startLogSegment(JournalInfo journalInfo, long epoch, long txid)`
  Notify the BackupNode that the NameNode has rolled its edit logs and is now writing a new log segment.

- ## Field Details

  - ### versionID

    static final long versionID
    This class is used by both the Namenode (client) and BackupNode (server) to insulate from the protocol serialization. If you are adding/changing DN's interface then you need to change both this class and ALSO related protocol buffer wire protocol definition in JournalProtocol.proto. For more details on protocol buffer wire protocol, please see .../org/apache/hadoop/hdfs/protocolPB/overview.html
    See Also:
      - Constant Field Values

- ## Method Details

  - ### journal

    void journal(JournalInfo journalInfo, long epoch, long firstTxnId, int numTxns, 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:
      `journalInfo` - journal information
      `epoch` - marks beginning a new journal writer
      `firstTxnId` - the first transaction of this batch
      `numTxns` - number of transactions
      `records` - byte array containing serialized journal records
    Throws:
      `FencedException` - if the resource has been fenced
      `IOException`

  - ### startLogSegment

    void startLogSegment(JournalInfo journalInfo, long epoch, long txid) throws IOException
    Notify the BackupNode that the NameNode has rolled its edit logs and is now writing a new log segment.
    Parameters:
      `journalInfo` - journal information
      `epoch` - marks beginning a new journal writer
      `txid` - the first txid in the new log
    Throws:
      `FencedException` - if the resource has been fenced
      `IOException`

  - ### fence

    FenceResponse fence(JournalInfo journalInfo, long epoch, String fencerInfo) throws IOException
    Request to fence any other journal writers. Older writers with at previous epoch will be fenced and can no longer perform journal operations.
    Parameters:
      `journalInfo` - journal information
      `epoch` - marks beginning a new journal writer
      `fencerInfo` - info about fencer for debugging purposes
    Throws:
      `FencedException` - if the resource has been fenced
      `IOException`