Skip to content

TEZ-4514: Reduce Some FileSystem Calls. - #309

Merged
abstractdog merged 2 commits into
apache:masterfrom
ayushtkn:FS
Oct 3, 2023
Merged

TEZ-4514: Reduce Some FileSystem Calls.#309
abstractdog merged 2 commits into
apache:masterfrom
ayushtkn:FS

Conversation

@ayushtkn

Copy link
Copy Markdown
Member

No description provided.

@tez-yetus

This comment was marked as outdated.

@tez-yetus

This comment was marked as outdated.

@ayushtknayushtkn changed the title Reduce Some FileSystem Calls.TEZ-4514: Reduce Some FileSystem Calls.Sep 28, 2023
@tez-yetus

This comment was marked as outdated.

FileSystem fs = p.getFileSystem(conf);
p = fs.resolvePath(p.makeQualified(fs.getUri(), fs.getWorkingDirectory()));
FileSystem targetFS = p.getFileSystem(conf);
return targetFS.listFiles(p, false);

@abstractdogabstractdogOct 2, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as I can understand, this single listFiles call can be used instead of a "directory or file" check, making this method simpler, looks good

} else {
type = LocalResourceType.FILE;
}
RemoteIterator<LocatedFileStatus> fileStatuses = getListFilesFileStatus(configUri, conf);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getListFilesFileStatus receives a "String fileName" param, and here we pass a "configUri", can you unify and use whatever is closer to the truth? also I can see that getListFilesFileStatus creates an URI eventually, we can pass it here, right?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done thing, the name is URI, but it isn't a URI object but string, it is extracted from a conf which has name URI, so kept the name old as configURI

try {
fsStatus = fs.getFileStatus(stagingArea);
} catch (FileNotFoundException fnf) {
// Ignore

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about returning if

if (fsStatus == null) {
return fs;
}

and having the rest of the method unindented

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't return, there is an else block below if fsStatus is null

else {
TezCommonUtils.mkDirForAM(fs, stagingArea);
}

+ ", dagId=" + lastInProgressDAG.toString()
+ ", dagRecoveryFile=" + dagRecoveryFile
+ ", len=" + fileStatus.getLen());
LOG.info("Trying to recover dag from recovery file, dagId={}, dagRecoveryFile={}", lastInProgressDAG,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed fileStatus.getLen() from the log message, is it intentional?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it was shooting an RPC just for log and file length, so removed it

@abstractdogabstractdogOct 3, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we about leaving the useful info on DEBUG level, but in that case, we can log the full FileStatus, like

LOG.info("Trying to recover dag from recovery file, dagId={}, dagRecoveryFile={}", lastInProgressDAG, dagRecoveryFile);
if (LOG.isDebugEnabled()) {
// extra RPC call
FileStatus fileStatus = recoveryFS.getFileStatus(dagRecoveryFile);
LOG.debug("Recovery file details: {}", fileStatus);
}

+ ", path=" + summaryFile.toString()
+ ", len=" + summaryFileStatus.getLen()
+ ", lastModTime=" + summaryFileStatus.getModificationTime());
if (LOG.isDebugEnabled()) {

@abstractdogabstractdogOct 2, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we might want to keep this on INFO level
recovery is not a heavily used code path under normal circumstances, and AN extra filesystem call due to getFileStatus is fine, especially if we're deep inside in debugging a non-reproducible recovery issue, where we usually want to see summary file info every time: which we would lose otherwise on DEBUG level, as by default we're on INFO level

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

@abstractdog

Copy link
Copy Markdown
Contributor

thanks for the patch @ayushtkn , left some comments

@tez-yetus

This comment was marked as outdated.

@tez-yetus

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec14m 53sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚@author0m 0sThe patch does not contain any @author tags.
-1 ❌test4tests0m 0sThe patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
_ master Compile Tests _
+0 🆗mvndep4m 56sMaven dependency ordering for branch
+1 💚mvninstall5m 21smaster passed
+1 💚compile1m 1smaster passed with JDK Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu122.04
+1 💚compile0m 57smaster passed with JDK Private Build-1.8.0_382-8u382-ga-1~22.04.1-b05
+1 💚checkstyle1m 14smaster passed
+1 💚javadoc1m 1smaster passed with JDK Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu122.04
+1 💚javadoc0m 48smaster passed with JDK Private Build-1.8.0_382-8u382-ga-1~22.04.1-b05
+0 🆗spotbugs0m 53sUsed deprecated FindBugs config; considering switching to SpotBugs.
+1 💚findbugs2m 4smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 8sMaven dependency ordering for patch
+1 💚mvninstall0m 35sthe patch passed
+1 💚compile0m 38sthe patch passed with JDK Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu122.04
+1 💚javac0m 38sthe patch passed
+1 💚compile0m 33sthe patch passed with JDK Private Build-1.8.0_382-8u382-ga-1~22.04.1-b05
+1 💚javac0m 33sthe patch passed
+1 💚checkstyle0m 9stez-api: The patch generated 0 new + 21 unchanged - 1 fixed = 21 total (was 22)
+1 💚checkstyle0m 18sThe patch passed checkstyle in tez-dag
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚javadoc0m 26sthe patch passed with JDK Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu122.04
+1 💚javadoc0m 25sthe patch passed with JDK Private Build-1.8.0_382-8u382-ga-1~22.04.1-b05
+1 💚findbugs1m 26sthe patch passed
_ Other Tests _
+1 💚unit1m 58stez-api in the patch passed.
+1 💚unit4m 17stez-dag in the patch passed.
+1 💚asflicense0m 21sThe patch does not generate ASF License warnings.
44m 28s
SubsystemReport/Notes
DockerClientAPI=1.43 ServerAPI=1.43 base: https://ci-hadoop.apache.org/job/tez-multibranch/job/PR-309/5/artifact/out/Dockerfile
GITHUB PR#309
JIRA IssueTEZ-4514
Optional Testsdupname asflicense javac javadoc unit spotbugs findbugs checkstyle compile
unameLinux 1b3b600ca92b 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Build toolmaven
Personalitypersonality/tez.sh
git revisionmaster / 7855c1f
Default JavaPrivate Build-1.8.0_382-8u382-ga-1~22.04.1-b05
Multi-JDK versions/usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.20.1+1-post-Ubuntu-0ubuntu122.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_382-8u382-ga-1~22.04.1-b05
Test Resultshttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-309/5/testReport/
Max. process+thread count572 (vs. ulimit of 5500)
modulesC: tez-api tez-dag U: .
Console outputhttps://ci-hadoop.apache.org/job/tez-multibranch/job/PR-309/5/console
versionsgit=2.34.1 maven=3.6.3 findbugs=3.0.1
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@abstractdog
abstractdog self-requested a review October 3, 2023 15:36

@abstractdogabstractdog left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@abstractdog
abstractdog merged commit 2ad10b6 into apache:masterOct 3, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@ayushtkn@tez-yetus@abstractdog