[
https://issues.apache.org/jira/browse/HADOOP-13448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15475290#comment-15475290
]
Aaron Fabbri commented on HADOOP-13448:
---------------------------------------
Thanks for the patch [~cnauroth]. Looks good. Couple of comments below.
{code}
+ /**
+ * @return entries in the directory
+ */
+ public Collection<FileStatus> getFileStatuses() {
+ return listMap.values();
{code}
Should this be "return Collections.unmodifiableCollection(listMap.values())" )?
I think main callers will be clients, which shouldn't be updating directories
this way. Looks like modification of the
[values()|https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html#values()]
collection are reflected in the Map.
{code}
+ /**
+ * Lookup entry within this directory listing. This may return null if the
+ * {@code MetadataStore} only tracks a partial set of the directory entries.
+ * In the case where {@link #isAuthoritative()} is true, however, this
+ * function returns null iff the directory is known not to contain the
listing
+ * at given path (within the scope of the {@code MetadataStore} that returned
+ * it)
+ *
+ * @param childPath path of entry to look for.
+ * @return entry, or null if it is not present or not being tracked.
+ */
+ public FileStatus get(Path childPath) {
{code}
FYI, I've since changed DirListingMetadata to deal with PathMetadata instead of
FileStatus. This is to implement consistent file deletions. (i.e. you can
get() a PathMetadata that contains a flag isDeleted = true to record a file
deletion, even if you're not tracking the full contents of the directory).
I think this function will change to expose the same PathMetadata return value.
Thoughts?
I'm happy to submit a follow-up patch that adds this stuff.
{code}
+ checkChildPath(childPath);
{code}
Cool, thanks for adding this.
{code}
+ /**
+ * Lists metadata for all direct children of a path.
+ *
+ * @param path the path to list
+ * @return metadata for all direct children of {@code path}, not {@code
null},
+ * but possibly empty
+ * @throws IOException if there is an error
+ */
+ DirListingMetadata listChildren(Path path) throws IOException;
+
{code}
I neglected to update this javadoc when I changed the return type. I now
have this comment as:
{code}
/**
* Lists metadata for all direct children of a path.
*
* @param path the path to list
* @return metadata for all direct children of {@code path} which are
* being tracked by the MetadataStore, or null if the path was not
* found in the MetadataStore.
* @throws IOException if there is an error
*/
{code}
So, if the path exists but dir is empty, we get a DirListingMetadata with an
empty
list of children.
If the path does not exist in the MS, we return null (could instead throw
FileNotFoundException, but I don't think this qualifies as "exceptional", and
also it is not really File Not Found, but File Not Tracked by this
MetadataStore. It could be confusing if propagated. )
> S3Guard: Define MetadataStore interface.
> ----------------------------------------
>
> Key: HADOOP-13448
> URL: https://issues.apache.org/jira/browse/HADOOP-13448
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: fs/s3
> Reporter: Chris Nauroth
> Assignee: Chris Nauroth
> Attachments: HADOOP-13448-HADOOP-13345.001.patch,
> HADOOP-13448-HADOOP-13345.002.patch, HADOOP-13448-HADOOP-13345.003.patch
>
>
> Define the common interface for metadata store operations. This is the
> interface that any metadata back-end must implement in order to integrate
> with S3Guard.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]