hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wang XL (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-12862) When modify cacheDirective ,editLog may serial relative expiryTime
Date Thu, 30 Nov 2017 03:02:00 GMT

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

Wang XL commented on HDFS-12862:
--------------------------------

I will post a patch later.

> When modify cacheDirective ,editLog may serial relative expiryTime
> ------------------------------------------------------------------
>
>                 Key: HDFS-12862
>                 URL: https://issues.apache.org/jira/browse/HDFS-12862
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: caching, hdfs
>    Affects Versions: 2.7.1
>         Environment: 
>            Reporter: Wang XL
>
> The logic in FSNDNCacheOp#modifyCacheDirective is not correct.  when modify cacheDirective,the
expiration in directive may be a relative expiryTime, and EditLog will serial a relative expiry
time.
> {code:java}
> // Some comments here
> static void modifyCacheDirective(
>       FSNamesystem fsn, CacheManager cacheManager, CacheDirectiveInfo directive,
>       EnumSet<CacheFlag> flags, boolean logRetryCache) throws IOException {
>     final FSPermissionChecker pc = getFsPermissionChecker(fsn);
>     cacheManager.modifyDirective(directive, pc, flags);
>     fsn.getEditLog().logModifyCacheDirectiveInfo(directive, logRetryCache);
>   }
> {code}
> But when SBN replay the log ,it will invoke FSImageSerialization#readCacheDirectiveInfo
 as a absolute expiryTime.It will result in the inconsistency .
> {code:java}
>   public static CacheDirectiveInfo readCacheDirectiveInfo(DataInput in)
>       throws IOException {
>     CacheDirectiveInfo.Builder builder =
>         new CacheDirectiveInfo.Builder();
>     builder.setId(readLong(in));
>     int flags = in.readInt();
>     if ((flags & 0x1) != 0) {
>       builder.setPath(new Path(readString(in)));
>     }
>     if ((flags & 0x2) != 0) {
>       builder.setReplication(readShort(in));
>     }
>     if ((flags & 0x4) != 0) {
>       builder.setPool(readString(in));
>     }
>     if ((flags & 0x8) != 0) {
>       builder.setExpiration(
>           CacheDirectiveInfo.Expiration.newAbsolute(readLong(in)));
>     }
>     if ((flags & ~0xF) != 0) {
>       throw new IOException("unknown flags set in " +
>           "ModifyCacheDirectiveInfoOp: " + flags);
>     }
>     return builder.build();
>   }
> {code}
> In other words´╝î fsn.getEditLog().logModifyCacheDirectiveInfo(directive, logRetryCache)
 may serial a relative expiry time,But  builder.setExpiration(CacheDirectiveInfo.Expiration.newAbsolute(readLong(in)))
  read it as a absolute expiryTime.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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


Mime
View raw message