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

Aaron Fabbri commented on HADOOP-14756:
---------------------------------------

Hey [~gabor.bota] thank you for looking at this.
{quote}In case the "isNew" flag implementation is needed I assume it would be 
an additional attribute in dynamodb table for the entries. Is this correct?
{quote}
I don't think there is anything to do here, or it is pretty low priority.  I 
will explain, just for history's sake:

When writing the code, I observed a small optimization: Consider mkdir() 
codepath. Since it is a new dir, we know it is empty, and thus its contents are 
"fully cached" or "authoritative" in the MetadataStore. I.e.

{color:#654982}After {{fs.mkdir(new_dir_path)}}, then 
fs.getMetadataStore().listChildren(new_dir_path).isAuthoritative() should be 
true if the metadata store supports authoritative mode (if it persists the 
isAuthoritative bit).{color}

Today, a fs client can accomplish this with two calls (in pseudocode):

metadataStore.put(new PathMetadata(new_dir_path))
 metadataStore.put(new DirListingMetadata(new_dir_path, children={}, 
isAuthoritative=true)  // <-- all this just to set auth. bit

Instead, if {{put(PathMetadata)}} had a second parameter, {{boolean isNew}} we 
could skip the second call to {{put(DirListingMetadata)}}, potentially making 
mkdirs() codepath faster and saving a DynamoDB write.

I don't think there is any additional new state that needs to be stored in the 
database--it would be covered by the isAuthoritative (i.e. isFullyCached) bit 
on a directory path.

So it is not a required change, only a low-priority optimization for codepaths 
that create empty directories.

I'll comment on patch separately.

> S3Guard: expose capability query in MetadataStore and add tests of 
> authoritative mode
> -------------------------------------------------------------------------------------
>
>                 Key: HADOOP-14756
>                 URL: https://issues.apache.org/jira/browse/HADOOP-14756
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/s3
>    Affects Versions: 3.0.0-beta1
>            Reporter: Steve Loughran
>            Assignee: Gabor Bota
>            Priority: Major
>         Attachments: HADOOP-14756.001.patch
>
>
> {{MetadataStoreTestBase.testListChildren}} would be improved with the ability 
> to query the features offered by the store, and the outcome of {{put()}}, so 
> probe the correctness of the authoritative mode
> # Add predicate to MetadataStore interface  
> {{supportsAuthoritativeDirectories()}} or similar
> # If #1 is true, assert that directory is fully cached after changes
> # Add "isNew" flag to MetadataStore.put(DirListingMetadata); use to verify 
> when changes are made



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to