[ 
https://issues.apache.org/jira/browse/HDFS-15054?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17191842#comment-17191842
 ] 

Brahma Reddy Battula commented on HDFS-15054:
---------------------------------------------

HDFS-14922 , HDFS-14924 and this  are incompatible changes..? 

 

As we added new field,I feel we should have like following..to address the 
rollingupgrade scenaro's ..?
{code:java}
@Override
 void readFields(DataInputStream in, int logVersion) throws IOException {
+ int flags = in.readInt();
 snapshotRoot = FSImageSerialization.readString(in);
 snapshotName = FSImageSerialization.readString(in);
- mtime = FSImageSerialization.readLong(in);
-
+ if ((flags & 0x1) != 0) {
+ mtime = FSImageSerialization.readLong(in);
+ }
+
+
 // read RPC ids if necessary
 readRpcIds(in, logVersion);
 }
@@ -3483,9 +3484,15 @@ void readFields(DataInputStream in, int logVersion) 
throws IOException {
 @Override
 public void writeFields(DataOutputStream out, int logVersion)
 throws IOException {
+ int flags =
+ ((mtime != 0L && mtime != Long.MAX_VALUE ) ? 0x1 : 0);
+ out.writeInt(flags);
 FSImageSerialization.writeString(snapshotRoot, out);
 FSImageSerialization.writeString(snapshotName, out);
- FSImageSerialization.writeLong(mtime, out);
+ if (((mtime != 0L && mtime != Long.MAX_VALUE))) {
+ FSImageSerialization.writeLong(mtime, out);
+ }{code}

+

> Delete Snapshot not updating new modification time
> --------------------------------------------------
>
>                 Key: HDFS-15054
>                 URL: https://issues.apache.org/jira/browse/HDFS-15054
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Hemanth Boyina
>            Assignee: Hemanth Boyina
>            Priority: Major
>             Fix For: 3.3.0
>
>         Attachments: HDFS-15054.001.patch, HDFS-15054.002.patch
>
>
> on creating a snapshot , we set modifcation time for the snapshot along with 
> that we update modification time of snapshot created directory
> {code:java}
>   snapshotRoot.updateModificationTime(now, Snapshot.CURRENT_STATE_ID);
>   s.getRoot().setModificationTime(now, Snapshot.CURRENT_STATE_ID); {code}
> So on deleting snapshot , we should update the modification time for snapshot 
> created directory .



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to