You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by "abstractdog (via GitHub)" <gi...@apache.org> on 2023/09/22 15:16:48 UTC
[GitHub] [hive] abstractdog opened a new pull request, #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
abstractdog opened a new pull request, #4741:
URL: https://github.com/apache/hive/pull/4741
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://cwiki.apache.org/confluence/display/Hive/HowToContribute
2. Ensure that you have created an issue on the Hive project JIRA: https://issues.apache.org/jira/projects/HIVE/summary
3. Ensure you have added or run the appropriate tests for your PR:
4. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP]HIVE-XXXXX: Your PR title ...'.
5. Be sure to keep the PR description updated to reflect all changes.
6. Please write your PR title to summarize what this PR proposes.
7. If possible, provide a concise example to reproduce the issue for a faster review.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description, screenshot and/or a reproducable example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Hive versions or within the unreleased branches such as master.
If no, write 'No'.
-->
### Is the change a dependency upgrade?
<!--
If yes, please attach a file with output from mvn dependency:tree to validate a complete upgrade of dependency.
If no, write 'No'.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1334667044
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
do we need to maintain a map for localized resources or it's enough to have a Set<> and skip the duplicates?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] sonarcloud[bot] commented on pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #4741:
URL: https://github.com/apache/hive/pull/4741#issuecomment-1734485460
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=4741)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4741&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4741&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4741&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4741&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4741&metric=duplicated_lines_density&view=list) No Duplication information
 The version of Java (11.0.8) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more [here](https://docs.sonarcloud.io/appendices/scanner-environment/)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1337358790
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -194,6 +199,8 @@ public class DagUtils {
*/
private final ConcurrentHashMap<String, Object> copyNotifiers = new ConcurrentHashMap<>();
+ private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
Review Comment:
makes sense
we tend to use this gauva cache as far as I can see
if there is already a ticket about a migration, please mention here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335752618
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
the SHA as a map key is an easy way to find a jar with the same content (e.g. so the same jar file present in the same parcel) localized already...how to utilize only a Set<LocalResource> for this purpose? set.contains() looks risky, as we're intentionally trying to prevent localizing the same jar file (which is present in the local filesystem even with different names), so we would end up calling LocalResource.equals / LocalResource.hashCode while looking it up in the set, which most probably considers LocalResource.url, leading to different hashCode, making this optimization fail by adding e.g. hive-jar and hive-exec-3.1.3000.7.2.18.0-334.jar as a LocalResource again
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] SourabhBadhya commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "SourabhBadhya (via GitHub)" <gi...@apache.org>.
SourabhBadhya commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1337247701
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -194,6 +199,8 @@ public class DagUtils {
*/
private final ConcurrentHashMap<String, Object> copyNotifiers = new ConcurrentHashMap<>();
+ private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
Review Comment:
nit: Consider using a Caffeine cache (more performant than Guava and has better utilities). Even though not the purpose of this PR. Maybe as part of another task.
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -1221,9 +1231,31 @@ private Map<String, LocalResource> addTempResources(Configuration conf, String h
LOG.info("Skipping vertex resource " + file + " that already exists in the session");
continue;
}
- Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(new Path(file)));
- LocalResource localResource = localizeResource(new Path(file),
- hdfsFilePath, type, conf);
+ Path filePath = new Path(file);
+ Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(filePath));
+ LocalResource localResource = null;
+ /*
+ * This method can be called with HDFS resources, which leads to a 'Wrong FS' IllegalArgumentException
+ * while trying to obtain a Path of a file on hdfs from a RawLocalFileSystem.
+ * A typical example is a usecase like below (sha optimization is used only for local resources):
+ * set hive.aux.jars.path=hdfs:///tmp/test_load_aux_jar/some.jar;
+ */
+ String scheme = filePath.getFileSystem(conf).getScheme();
+ if (!"file".equalsIgnoreCase(scheme)) {
Review Comment:
There is a similar duplication as part of CopyUtils#isLocal(FileSystem fs), maybe a static method can be created in FileUtils.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] sonarcloud[bot] commented on pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #4741:
URL: https://github.com/apache/hive/pull/4741#issuecomment-1732029410
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=4741)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4741&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4741&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4741&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=CODE_SMELL) [3 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4741&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4741&metric=duplicated_lines_density&view=list) No Duplication information
 The version of Java (11.0.8) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more [here](https://docs.sonarcloud.io/appendices/scanner-environment/)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] sonarcloud[bot] commented on pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #4741:
URL: https://github.com/apache/hive/pull/4741#issuecomment-1733780053
Kudos, SonarCloud Quality Gate passed! [](https://sonarcloud.io/dashboard?id=apache_hive&pullRequest=4741)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=BUG) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=BUG) [1 Bug](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=BUG)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=VULNERABILITY) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=VULNERABILITY)
[](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4741&resolved=false&types=SECURITY_HOTSPOT) [](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4741&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_hive&pullRequest=4741&resolved=false&types=SECURITY_HOTSPOT)
[](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=CODE_SMELL) [](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache_hive&pullRequest=4741&resolved=false&types=CODE_SMELL)
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4741&metric=coverage&view=list) No Coverage information
[](https://sonarcloud.io/component_measures?id=apache_hive&pullRequest=4741&metric=duplicated_lines_density&view=list) No Duplication information
 The version of Java (11.0.8) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 17.
Read more [here](https://docs.sonarcloud.io/appendices/scanner-environment/)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335729626
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
btw, we already have Set\<LocalResource\> localizedResources in TezSessionState
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335755617
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -1221,9 +1231,20 @@ private Map<String, LocalResource> addTempResources(Configuration conf, String h
LOG.info("Skipping vertex resource " + file + " that already exists in the session");
continue;
}
- Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(new Path(file)));
- LocalResource localResource = localizeResource(new Path(file),
- hdfsFilePath, type, conf);
+ Path filePath = new Path(file);
+ Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(filePath));
+ String sha = getSha(filePath, conf);
Review Comment:
that wasn't called here before, so we are. adding extra overhead
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -1221,9 +1231,20 @@ private Map<String, LocalResource> addTempResources(Configuration conf, String h
LOG.info("Skipping vertex resource " + file + " that already exists in the session");
continue;
}
- Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(new Path(file)));
- LocalResource localResource = localizeResource(new Path(file),
- hdfsFilePath, type, conf);
+ Path filePath = new Path(file);
+ Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(filePath));
+ String sha = getSha(filePath, conf);
Review Comment:
that wasn't called here before, so we are adding extra overhead
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335521442
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
I wanted to use a simply Set<> first but I realized I need to be able to return with the original LocalResouce when it's already added because the callers of these methods already expect that
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335714678
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
can we return an empty Optional in that case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335744323
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -194,6 +199,8 @@ public class DagUtils {
*/
private final ConcurrentHashMap<String, Object> copyNotifiers = new ConcurrentHashMap<>();
+ private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
Review Comment:
```
what I am saying is this cache should be tight to some TezSession class like
```
not necessarily: this cache connects local file's path to a SHA hash, which is independent of a tez session...if we connect it to a TezSessionState object, then we'll lose the already costly calculates hashes...this cache was a static one even before this patch, so it's behavior is not changed
would it make sense to make a code comment on this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335589819
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -1221,9 +1231,20 @@ private Map<String, LocalResource> addTempResources(Configuration conf, String h
LOG.info("Skipping vertex resource " + file + " that already exists in the session");
continue;
}
- Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(new Path(file)));
- LocalResource localResource = localizeResource(new Path(file),
- hdfsFilePath, type, conf);
+ Path filePath = new Path(file);
+ Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(filePath));
+ String sha = getSha(filePath, conf);
+ LocalResource localResource = null;
+ boolean alreadyLocalized = localizedJarSha.containsKey(sha);
+ LOG.debug("Checking SHA {} for filePath: {} (temp), already localized: {}", sha, filePath, alreadyLocalized);
+ if (alreadyLocalized) {
+ LOG.info("Skip creating already localized jar (temp) by sha {}: {}", sha, localResource);
+ localResource = localizedJarSha.get(sha);
Review Comment:
oops, I need to assign localResource before logging it :) will fix in next patch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335747840
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
shouldn't we simply return the same fileName when sha256 matches? in that case, DagUtils.checkPreExisting should take care of dups?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1337330939
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
see DagUtils.localizeResource
````
if (checkPreExisting(srcFs, src, dest, conf)) {
return createLocalResource(destFS, dest, type, LocalResourceVisibility.PRIVATE);
}
````
if the dest is already localized, no need to do it again. Set<SHA> should be completely sufficient
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
see DagUtils.localizeResource
````
if (checkPreExisting(srcFs, src, dest, conf)) {
return createLocalResource(destFS, dest, type, LocalResourceVisibility.PRIVATE);
}
````
if the dest is already localized, no need to do it again. Set\<SHA\> should be completely sufficient
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335729626
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
btw, we already have Set<LocalResource> localizedResources in TezSessionState
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335713697
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -194,6 +199,8 @@ public class DagUtils {
*/
private final ConcurrentHashMap<String, Object> copyNotifiers = new ConcurrentHashMap<>();
+ private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
Review Comment:
what I am saying is this cache should be tight to some TezSession class like TezSessionState and not the util class
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1337360797
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
okay, let me check
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on PR #4741:
URL: https://github.com/apache/hive/pull/4741#issuecomment-1738956549
closing, a better approach is being implemented in https://github.com/apache/hive/pull/4753
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335791067
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -1221,9 +1231,20 @@ private Map<String, LocalResource> addTempResources(Configuration conf, String h
LOG.info("Skipping vertex resource " + file + " that already exists in the session");
continue;
}
- Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(new Path(file)));
- LocalResource localResource = localizeResource(new Path(file),
- hdfsFilePath, type, conf);
+ Path filePath = new Path(file);
+ Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(filePath));
+ String sha = getSha(filePath, conf);
Review Comment:
yeah, right, that's a codepath where the duplicated/symlinked hive-exec jars were coming from, so the tradeoff is: calculate an SHA once (in HS2 lifetime) and localize if it's not localized yet vs. localize every jars every time, so it's like:
BEFORE patch
```
SESSION #1
local hive-exec jar: no SHA calc, localize
local hive-exec jar again: no SHA calc, localize
udf1.jar: no SHA calc, localize
udf2.jar: no SHA calc, localize
SESSION #2
local hive-exec jar: no SHA calc, localize
local hive-exec jar again: no SHA calc, localize
udf1.jar: no SHA calc, localize
udf2.jar: no SHA calc, localize
```
AFTER patch
```
local hive-exec jar: SHA calc, localize
local hive-exec jar again: SHA from cache, won't localize again
udf1.jar: SHA calc, localize
udf2.jar: SHA calc, localize
SESSION #2
local hive-exec jar: SHA from cache, localize
local hive-exec jar again: SHA from cache, won't localize again
udf1.jar: SHA calc from cache, localize
udf2.jar: SHA calc from cache, localize
```
so the extra overhead is 1 SHA calculate / each UDF jar / hiveserver2 lifetime (NOT PER SESSION), which is fair enough if you keep using the same UDF jars in subsequent session
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335752618
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
the SHA as a map key is an easy way to find a jar with the same content (e.g. so the same jar file present in the same parcel) localized already...how to utilize only a Set<LocalResource> for this purpose? set.contains() looks risky, as we're intentionally trying to prevent localizing the same jar file (which is present in the local filesystem even with different names), so we would end up calling LocalResource.equals / LocalResource.hashCode while looking it up in the set, which most probably considers LocalResource.url too, leading to a different hashCode, making this optimization fail by adding e.g. hive-jar and hive-exec-3.1.3000.7.2.18.0-334.jar as a LocalResource again
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335747840
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
shouldn't we simply return the same fileName when sha256 matches? in that case, DagUtils.checkPreExisting should take care or dups?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1337330939
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java:
##########
@@ -144,14 +140,17 @@ public String toString() {
}
}
- private HiveResources resources;
+ @VisibleForTesting
+ HiveResources resources;
@JsonProperty("doAsEnabled")
private boolean doAsEnabled;
private boolean isLegacyLlapMode;
private WmContext wmContext;
private KillQuery killQuery;
- private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
+ // a map for jars (with SHA) that have been already localized in the session
+ @VisibleForTesting
+ final Map<String, LocalResource> localizedJarSha = new HashMap<>();
Review Comment:
see DagUtils.localizeResource
````
if (checkPreExisting(srcFs, src, dest, conf)) {
return createLocalResource(destFS, dest, type, LocalResourceVisibility.PRIVATE);
}
````
if the dest is already localized, no need to do it again. <Set> should be completely sufficient
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1337359410
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -1221,9 +1231,31 @@ private Map<String, LocalResource> addTempResources(Configuration conf, String h
LOG.info("Skipping vertex resource " + file + " that already exists in the session");
continue;
}
- Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(new Path(file)));
- LocalResource localResource = localizeResource(new Path(file),
- hdfsFilePath, type, conf);
+ Path filePath = new Path(file);
+ Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(filePath));
+ LocalResource localResource = null;
+ /*
+ * This method can be called with HDFS resources, which leads to a 'Wrong FS' IllegalArgumentException
+ * while trying to obtain a Path of a file on hdfs from a RawLocalFileSystem.
+ * A typical example is a usecase like below (sha optimization is used only for local resources):
+ * set hive.aux.jars.path=hdfs:///tmp/test_load_aux_jar/some.jar;
+ */
+ String scheme = filePath.getFileSystem(conf).getScheme();
+ if (!"file".equalsIgnoreCase(scheme)) {
Review Comment:
let me check this one and create suitable method in FileUtils if needed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1334661236
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -194,6 +199,8 @@ public class DagUtils {
*/
private final ConcurrentHashMap<String, Object> copyNotifiers = new ConcurrentHashMap<>();
+ private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
Review Comment:
i don't think it's a good idea to have cache as part of util class
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335518948
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -194,6 +199,8 @@ public class DagUtils {
*/
private final ConcurrentHashMap<String, Object> copyNotifiers = new ConcurrentHashMap<>();
+ private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
Review Comment:
this is tricky: we use this class as an instance (DagUtils.getInstance) and some classes in the hive code own an instance of this class, not as a static utility, so cache is not a problem from this point of view
having it as a static might be confusing, but it wants to be shared across different sessions as SHA computation is expensive
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1335744323
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -194,6 +199,8 @@ public class DagUtils {
*/
private final ConcurrentHashMap<String, Object> copyNotifiers = new ConcurrentHashMap<>();
+ private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
Review Comment:
```
what I am saying is this cache should be tight to some TezSession class like
```
not necessarily: this cache connects local file's path to a SHA hash, which is independent of a tez session...if we connect it to a TezSessionState object, then we'll lose the already costly calculated hashes across sessions...this cache was a static one even before this patch, so it's behavior is not changed
would it make sense to make a code comment on this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1337321461
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -194,6 +199,8 @@ public class DagUtils {
*/
private final ConcurrentHashMap<String, Object> copyNotifiers = new ConcurrentHashMap<>();
+ private static final Cache<String, String> shaCache = CacheBuilder.newBuilder().maximumSize(100).build();
Review Comment:
logically connect, localization happens in TezSessionState, I think the original place was more appropriate than the util class
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] abstractdog closed pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "abstractdog (via GitHub)" <gi...@apache.org>.
abstractdog closed pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
URL: https://github.com/apache/hive/pull/4741
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org
[GitHub] [hive] deniskuzZ commented on a diff in pull request #4741: HIVE-27723: Prevent localizing the same file more than once by checking SHA
Posted by "deniskuzZ (via GitHub)" <gi...@apache.org>.
deniskuzZ commented on code in PR #4741:
URL: https://github.com/apache/hive/pull/4741#discussion_r1337343214
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -1221,9 +1231,20 @@ private Map<String, LocalResource> addTempResources(Configuration conf, String h
LOG.info("Skipping vertex resource " + file + " that already exists in the session");
continue;
}
- Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(new Path(file)));
- LocalResource localResource = localizeResource(new Path(file),
- hdfsFilePath, type, conf);
+ Path filePath = new Path(file);
+ Path hdfsFilePath = new Path(hdfsDirPathStr, getResourceBaseName(filePath));
+ String sha = getSha(filePath, conf);
Review Comment:
agree
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org