Skip to content

Commit

Permalink
HDFS-8965. Harden edit log reading code against out of memory errors …
Browse files Browse the repository at this point in the history
…(cmccabe)
  • Loading branch information
Colin Patrick Mccabe committed Sep 1, 2015
1 parent 8fa41d9 commit 24f6a7c
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 105 deletions.
2 changes: 2 additions & 0 deletions hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
Expand Up @@ -872,6 +872,8 @@ Release 2.8.0 - UNRELEASED

HDFS-8946. Improve choosing datanode storage for block placement. (yliu)

HDFS-8965. Harden edit log reading code against out of memory errors (cmccabe)

OPTIMIZATIONS

HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than
Expand Down
Expand Up @@ -83,7 +83,7 @@ class BookKeeperEditLogInputStream extends EditLogInputStream {
tracker = new FSEditLogLoader.PositionTrackingInputStream(bin);
DataInputStream in = new DataInputStream(tracker);

reader = new FSEditLogOp.Reader(in, tracker, logVersion);
reader = FSEditLogOp.Reader.create(in, tracker, logVersion);
}

@Override
Expand Down
Expand Up @@ -87,7 +87,7 @@ public static enum Feature implements LayoutFeature {
FSIMAGE_COMPRESSION(-25, "Support for fsimage compression"),
FSIMAGE_CHECKSUM(-26, "Support checksum for fsimage"),
REMOVE_REL13_DISK_LAYOUT_SUPPORT(-27, "Remove support for 0.13 disk layout"),
EDITS_CHESKUM(-28, "Support checksum for editlog"),
EDITS_CHECKSUM(-28, "Support checksum for editlog"),
UNUSED(-29, "Skipped version"),
FSIMAGE_NAME_OPTIMIZATION(-30, "Store only last part of path in fsimage"),
RESERVED_REL20_203(-31, -19, "Reserved for release 0.20.203", true,
Expand Down
Expand Up @@ -119,7 +119,7 @@ void setBytes(byte[] newBytes, int version) throws IOException {

this.version = version;

reader = new FSEditLogOp.Reader(in, tracker, version);
reader = FSEditLogOp.Reader.create(in, tracker, version);
}

void clear() throws IOException {
Expand Down
Expand Up @@ -157,7 +157,7 @@ private void init(boolean verifyLayoutVersion)
"flags from log");
}
}
reader = new FSEditLogOp.Reader(dataIn, tracker, logVersion);
reader = FSEditLogOp.Reader.create(dataIn, tracker, logVersion);
reader.setMaxOpSize(maxOpSize);
state = State.OPEN;
} finally {
Expand Down

0 comments on commit 24f6a7c

Please sign in to comment.