Reverting the change r1400285 since it included unrelated changes

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2802@1400290 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2012-10-19 21:04:29 +00:00
parent 4cccdc2a96
commit 40f8b7dcfb
4 changed files with 11 additions and 126 deletions

View File

@ -1,5 +1,14 @@
Hadoop HDFS Change Log
Branch-2802 Snapshot (Unreleased)
NEW FEATURES
HDFS-4076. Support snapshot of single files. (szetszwo)
HDFS-4082. Add editlog opcodes for snapshot create and delete operations.
(suresh via szetszwo)
Trunk (Unreleased)
INCOMPATIBLE CHANGES

View File

@ -44,14 +44,12 @@
import org.apache.hadoop.hdfs.server.common.Storage.FormatConfirmable;
import org.apache.hadoop.hdfs.server.common.Storage.StorageDirectory;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.AddOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.AllowSnapshotOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.CancelDelegationTokenOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.CloseOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.ConcatDeleteOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.CreateSnapshotOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.DeleteOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.DeleteSnapshotOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.DisallowSnapshotOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.GetDelegationTokenOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.LogSegmentOp;
import org.apache.hadoop.hdfs.server.namenode.FSEditLogOp.MkdirOp;
@ -879,18 +877,6 @@ void logDeleteSnapshot(String snapName, String snapRoot) {
logEdit(op);
}
void logAllowSnapshot(String snapName, String snapRoot) {
AllowSnapshotOp op = AllowSnapshotOp.getInstance(cache.get())
.setSnapshotRoot(snapRoot);
logEdit(op);
}
void logDisallowSnapshot(String snapName, String snapRoot) {
DisallowSnapshotOp op = DisallowSnapshotOp.getInstance(cache.get())
.setSnapshotRoot(snapRoot);
logEdit(op);
}
/**
* Get all the journals this edit log is currently operating on.
*/

View File

@ -2281,115 +2281,7 @@ public String toString() {
return builder.toString();
}
}
/**
* Operation corresponding to allow creating snapshot on a directory
*/
static class AllowSnapshotOp extends FSEditLogOp {
String snapshotRoot;
public AllowSnapshotOp() {
super(OP_ALLOW_SNAPSHOT);
}
public AllowSnapshotOp(String snapRoot) {
super(OP_ALLOW_SNAPSHOT);
snapshotRoot = snapRoot;
}
static AllowSnapshotOp getInstance(OpInstanceCache cache) {
return (AllowSnapshotOp) cache.get(OP_ALLOW_SNAPSHOT);
}
public AllowSnapshotOp setSnapshotRoot(String snapRoot) {
snapshotRoot = snapRoot;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
snapshotRoot = FSImageSerialization.readString(in);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(snapshotRoot, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SNAPSHOTROOT", snapshotRoot);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
snapshotRoot = st.getValue("SNAPSHOTROOT");
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("AllowSnapshotOp [snapshotRoot=");
builder.append(snapshotRoot);
builder.append("]");
return builder.toString();
}
}
/**
* Operation corresponding to disallow creating snapshot on a directory
*/
static class DisallowSnapshotOp extends FSEditLogOp {
String snapshotRoot;
public DisallowSnapshotOp() {
super(OP_DISALLOW_SNAPSHOT);
}
public DisallowSnapshotOp(String snapRoot) {
super(OP_DISALLOW_SNAPSHOT);
snapshotRoot = snapRoot;
}
static DisallowSnapshotOp getInstance(OpInstanceCache cache) {
return (DisallowSnapshotOp) cache.get(OP_DISALLOW_SNAPSHOT);
}
public DisallowSnapshotOp setSnapshotRoot(String snapRoot) {
snapshotRoot = snapRoot;
return this;
}
@Override
void readFields(DataInputStream in, int logVersion) throws IOException {
snapshotRoot = FSImageSerialization.readString(in);
}
@Override
public void writeFields(DataOutputStream out) throws IOException {
FSImageSerialization.writeString(snapshotRoot, out);
}
@Override
protected void toXml(ContentHandler contentHandler) throws SAXException {
XMLUtils.addSaxString(contentHandler, "SNAPSHOTROOT", snapshotRoot);
}
@Override
void fromXml(Stanza st) throws InvalidXmlException {
snapshotRoot = st.getValue("SNAPSHOTROOT");
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("DisallowSnapshotOp [snapshotRoot=");
builder.append(snapshotRoot);
builder.append("]");
return builder.toString();
}
}
static private short readShort(DataInputStream in) throws IOException {
return Short.parseShort(FSImageSerialization.readString(in));
}

View File

@ -58,9 +58,7 @@ public enum FSEditLogOpCodes {
OP_START_LOG_SEGMENT ((byte) 24),
OP_UPDATE_BLOCKS ((byte) 25),
OP_CREATE_SNAPSHOT ((byte) 26),
OP_DELETE_SNAPSHOT ((byte) 27),
OP_ALLOW_SNAPSHOT ((byte) 28),
OP_DISALLOW_SNAPSHOT ((byte) 29);
OP_DELETE_SNAPSHOT ((byte) 27);
private byte opCode;