org.apache.hadoop.hdfs.qjournal.server
Class Journal

java.lang.Object
  extended by org.apache.hadoop.hdfs.qjournal.server.Journal
All Implemented Interfaces:
Closeable

public class Journal
extends Object
implements Closeable

A JournalNode can manage journals for several clusters at once. Each such journal is entirely independent despite being hosted by the same JVM.


Field Summary
static String LAST_PROMISED_FILENAME
           
static String LAST_WRITER_EPOCH
           
 
Method Summary
 void acceptRecovery(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo, QJournalProtocolProtos.SegmentStateProto segment, URL fromUrl)
           
 Boolean canRollBack(org.apache.hadoop.hdfs.server.common.StorageInfo storage, org.apache.hadoop.hdfs.server.common.StorageInfo prevStorage, int targetLayoutVersion)
           
 void close()
          Unlock and release resources.
 void doFinalize()
           
 void doPreUpgrade()
           
 void doRollback()
           
 void doUpgrade(org.apache.hadoop.hdfs.server.common.StorageInfo sInfo)
           
 void finalizeLogSegment(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo, long startTxId, long endTxId)
          Finalize the log segment at the given transaction ID.
 RemoteEditLogManifest getEditLogManifest(long sinceTxId, boolean inProgressOk)
           
 Long getJournalCTime()
           
 long getLastWriterEpoch()
           
 void heartbeat(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo)
           
 boolean isFormatted()
           
 QJournalProtocolProtos.PrepareRecoveryResponseProto prepareRecovery(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo, long segmentTxId)
           
 void purgeLogsOlderThan(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo, long minTxIdToKeep)
           
 void startLogSegment(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo, long txid, int layoutVersion)
          Start a new segment at the given txid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LAST_PROMISED_FILENAME

public static final String LAST_PROMISED_FILENAME
See Also:
Constant Field Values

LAST_WRITER_EPOCH

public static final String LAST_WRITER_EPOCH
See Also:
Constant Field Values
Method Detail

close

public void close()
           throws IOException
Unlock and release resources.

Specified by:
close in interface Closeable
Throws:
IOException

getLastWriterEpoch

public long getLastWriterEpoch()
                        throws IOException
Throws:
IOException

heartbeat

public void heartbeat(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo)
               throws IOException
Throws:
IOException

isFormatted

public boolean isFormatted()

startLogSegment

public void startLogSegment(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo,
                            long txid,
                            int layoutVersion)
                     throws IOException
Start a new segment at the given txid. The previous segment must have already been finalized.

Throws:
IOException

finalizeLogSegment

public void finalizeLogSegment(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo,
                               long startTxId,
                               long endTxId)
                        throws IOException
Finalize the log segment at the given transaction ID.

Throws:
IOException

purgeLogsOlderThan

public void purgeLogsOlderThan(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo,
                               long minTxIdToKeep)
                        throws IOException
Throws:
IOException
See Also:
LogsPurgeable.purgeLogsOlderThan(long)

getEditLogManifest

public RemoteEditLogManifest getEditLogManifest(long sinceTxId,
                                                boolean inProgressOk)
                                         throws IOException
Throws:
IOException
See Also:
QJournalProtocol.getEditLogManifest(String, long, boolean)

prepareRecovery

public QJournalProtocolProtos.PrepareRecoveryResponseProto prepareRecovery(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo,
                                                                           long segmentTxId)
                                                                    throws IOException
Throws:
IOException
See Also:
QJournalProtocol.prepareRecovery(RequestInfo, long)

acceptRecovery

public void acceptRecovery(org.apache.hadoop.hdfs.qjournal.protocol.RequestInfo reqInfo,
                           QJournalProtocolProtos.SegmentStateProto segment,
                           URL fromUrl)
                    throws IOException
Throws:
IOException
See Also:
QJournalProtocol.acceptRecovery(RequestInfo, QJournalProtocolProtos.SegmentStateProto, URL)

doPreUpgrade

public void doPreUpgrade()
                  throws IOException
Throws:
IOException

doUpgrade

public void doUpgrade(org.apache.hadoop.hdfs.server.common.StorageInfo sInfo)
               throws IOException
Throws:
IOException

doFinalize

public void doFinalize()
                throws IOException
Throws:
IOException

canRollBack

public Boolean canRollBack(org.apache.hadoop.hdfs.server.common.StorageInfo storage,
                           org.apache.hadoop.hdfs.server.common.StorageInfo prevStorage,
                           int targetLayoutVersion)
                    throws IOException
Throws:
IOException

doRollback

public void doRollback()
                throws IOException
Throws:
IOException

getJournalCTime

public Long getJournalCTime()
                     throws IOException
Throws:
IOException


Copyright © 2014 Apache Software Foundation. All Rights Reserved.