You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/12/08 16:28:25 UTC

[GitHub] [spark] pan3793 opened a new pull request, #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

pan3793 opened a new pull request, #38985:
URL: https://github.com/apache/spark/pull/38985

   <!--
   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://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### 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.
   -->
   Use "-" instead of empty abbrevMarker in `StringUtils.abbreviate` in `KubernetesConf.getAppNameLabel`
   
   ### 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.
   -->
   
   [LANG-1463](https://issues.apache.org/jira/browse/LANG-1463) affects Apache Commons Lang3 3.6~3.9, and it may cause `KubernetesConf#getAppNameLabel` return unexpected values and eventually cause the job failed on requesting executors.
   
   ```
   2022-12-08 11:47:37 [WARN] [kubernetes-executor-snapshots-subscribers-1] org.apache.spark.scheduler.cluster.k8s.ExecutorPodsSnapshotsStoreImpl#94 - Exception when notifying snapshot subscriber.
   io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://xxxxxxxxx:6443/api/v1/namespaces/spark/pods. Message: Pod "kyuubi-connection-spark-sql-hive-c11b352d-d4ce-4d11-bb68-128bfdd5000f-43048584efd88528-exec-3" is invalid: metadata.labels: Invalid value: "kyuubi-connection-spark-sql-hive-c11b352d-d4ce-4d11-bb68-128bfdd5000f": must be no more than 63 characters. Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=metadata.labels, message=Invalid value: "kyuubi-connection-spark-sql-hive-c11b352d-d4ce-4d11-bb68-128bfdd5000f": must be no more than 63 characters, reason=FieldValueInvalid, additionalProperties={})], group=null, kind=Pod, name=kyuubi-connection-spark-sql-hive-c11b352d-d4ce-4d11-bb68-128bfdd5000f-43048584efd88528-exec-3, retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Pod "kyuubi-connection-spark-sql-hive-c11b352d-d4ce-4d11-bb68-128bfdd5000f-43048584efd88528-ex
 ec-3" is invalid: metadata.labels: Invalid value: "kyuubi-connection-spark-sql-hive-c11b352d-d4ce-4d11-bb68-128bfdd5000f": must be no more than 63 characters, metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).
   	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:682) ~[kubernetes-client-5.12.2.jar:?]
   	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.requestFailure(OperationSupport.java:661) ~[kubernetes-client-5.12.2.jar:?]
   	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.assertResponseCode(OperationSupport.java:612) ~[kubernetes-client-5.12.2.jar:?]
   	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:555) ~[kubernetes-client-5.12.2.jar:?]
   	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleResponse(OperationSupport.java:518) ~[kubernetes-client-5.12.2.jar:?]
   	at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleCreate(OperationSupport.java:305) ~[kubernetes-client-5.12.2.jar:?]
   	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleCreate(BaseOperation.java:644) ~[kubernetes-client-5.12.2.jar:?]
   	at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleCreate(BaseOperation.java:83) ~[kubernetes-client-5.12.2.jar:?]
   	at io.fabric8.kubernetes.client.dsl.base.CreateOnlyResourceOperation.create(CreateOnlyResourceOperation.java:61) ~[kubernetes-client-5.12.2.jar:?]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsAllocator.$anonfun$requestNewExecutors$1(ExecutorPodsAllocator.scala:462) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:158) ~[scala-library-2.12.15.jar:?]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsAllocator.requestNewExecutors(ExecutorPodsAllocator.scala:421) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsAllocator.$anonfun$onNewSnapshots$37(ExecutorPodsAllocator.scala:385) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsAllocator.$anonfun$onNewSnapshots$37$adapted(ExecutorPodsAllocator.scala:378) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62) ~[scala-library-2.12.15.jar:?]
   	at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55) ~[scala-library-2.12.15.jar:?]
   	at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49) ~[scala-library-2.12.15.jar:?]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsAllocator.onNewSnapshots(ExecutorPodsAllocator.scala:378) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsAllocator.$anonfun$start$3(ExecutorPodsAllocator.scala:131) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsAllocator.$anonfun$start$3$adapted(ExecutorPodsAllocator.scala:130) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsSnapshotsStoreImpl$SnapshotsSubscriber.org$apache$spark$scheduler$cluster$k8s$ExecutorPodsSnapshotsStoreImpl$SnapshotsSubscriber$$processSnapshotsInternal(ExecutorPodsSnapshotsStoreImpl.scala:143) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsSnapshotsStoreImpl$SnapshotsSubscriber.processSnapshots(ExecutorPodsSnapshotsStoreImpl.scala:131) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at org.apache.spark.scheduler.cluster.k8s.ExecutorPodsSnapshotsStoreImpl$$anon$1.run(ExecutorPodsSnapshotsStoreImpl.scala:94) ~[spark-kubernetes_2.12-3.3.1.2-SNAPSHOT.jar:3.3.1.2-SNAPSHOT]
   	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_352]
   	at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_352]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_352]
   	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_352]
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_352]
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_352]
   	at java.lang.Thread.run(Thread.java:750) ~[?:1.8.0_352]
   ```
   
   Strictly speaking, it's not an issue of Spark, because Spark depends on a higher version of Apache Commons Lang3 which fixed [LANG-1463](https://issues.apache.org/jira/browse/LANG-1463), but considering the following facts, I strongly suggest to avoid using empty abbrevMarker in `StringUtils.abbreviate`.
   
   - I suppose the trim algorithm of long app name is some kind of Spark internal implementation, this change should not affect Spark users.
   - It's a common case that users or vendors want to tune the version of some dependencies because they need to align w/ other components, this change makes the Spark compatible w/ Apache Commons Lang3 3.6~3.9 as well(specific to this case).
   - For those developers who are used to creating "fat jar" but w/o properly class relocation, a "StringUtils" class may be shipped by the "fat jar", supposing the "fat jar" is a plugin of Spark and it was added into `SPARK_HOME/jars`, then Spark has a chance to load that bad class, then trigger the bug. (actually we are in such situation, I know we should not blame Spark, but this PR makes Spark much tolerated) 
   
   ### 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 and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   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.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   UT updated, and manually tested.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1043983985


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -275,7 +275,7 @@ private[spark] object KubernetesConf {
         .toLowerCase(Locale.ROOT)
         .replaceAll("[^a-z0-9\\-]", "-")
         .replaceAll("-+", "-"),
-      "",
+      "-", // avoid using empty string, see https://issues.apache.org/jira/browse/LANG-1463

Review Comment:
   Yes, LANG-1463 is fixed at 3.10 and Apache Spark is using 3.12. Removed the confusing comment. And I explained why I propose this change in PR description, 
   
   > Strictly speaking, it's not an issue of Spark ...



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1044056418


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -241,14 +241,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   test("SPARK-36566: get app name label") {
     assert(KubernetesConf.getAppNameLabel(" Job+Spark-Pi 2021") === "job-spark-pi-2021")
     assert(KubernetesConf.getAppNameLabel("a" * 63) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 253) === "a" * 63)
+    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 62)

Review Comment:
   Emm, how about using "-abbr" instead of "-"?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] LuciferYang commented on pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on PR #38985:
URL: https://github.com/apache/spark/pull/38985#issuecomment-1343768447

   It seems this is to fix a bad case caused by user use way? The current `lang3` version used by Spark does not trigger this issue, right? I don't know how many similar bad cases will be triggered when users use old jars. Is it necessary for Spark to do fault tolerance?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1043867948


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -241,14 +241,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   test("SPARK-36566: get app name label") {
     assert(KubernetesConf.getAppNameLabel(" Job+Spark-Pi 2021") === "job-spark-pi-2021")
     assert(KubernetesConf.getAppNameLabel("a" * 63) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 253) === "a" * 63)
+    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 62)

Review Comment:
   When `KUBERNETES_DNS_LABEL_NAME_MAX_LENGTH` is 63, why do we need to get `62`? The previous result looks more correct to me. Could you explain your rational?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1043983985


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -275,7 +275,7 @@ private[spark] object KubernetesConf {
         .toLowerCase(Locale.ROOT)
         .replaceAll("[^a-z0-9\\-]", "-")
         .replaceAll("-+", "-"),
-      "",
+      "-", // avoid using empty string, see https://issues.apache.org/jira/browse/LANG-1463

Review Comment:
   Yes, LANG-1463 is fixed at 3.10 and Apache Spark is using 3.12. Removed the confusing comment. And I explained why I propose this change in PR description, 
   
   > Strictly speaking, it's not an issue of Spark ... but considering the following facts ...



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1043983005


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -241,14 +241,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   test("SPARK-36566: get app name label") {
     assert(KubernetesConf.getAppNameLabel(" Job+Spark-Pi 2021") === "job-spark-pi-2021")
     assert(KubernetesConf.getAppNameLabel("a" * 63) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 253) === "a" * 63)
+    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 62)

Review Comment:
   The result is correct, because `KubernetesConf#getAppNameLabel` calls `.stripSuffix("-")` after `abbreviate`
   
   ```
   scala> StringUtils.abbreviate("aaaa", "-", 3)
   res4: String = aa-
   
   scala> StringUtils.abbreviate("aaaa", "-", 3).stripPrefix("-").stripSuffix("-")
   res5: String = aa
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 closed pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 closed pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate
URL: https://github.com/apache/spark/pull/38985


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] Yikun commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
Yikun commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1044003100


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -241,14 +241,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   test("SPARK-36566: get app name label") {
     assert(KubernetesConf.getAppNameLabel(" Job+Spark-Pi 2021") === "job-spark-pi-2021")
     assert(KubernetesConf.getAppNameLabel("a" * 63) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 253) === "a" * 63)
+    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 62)

Review Comment:
   - `64 * a` --(abbreviate)--> `62 * a + '-'` --(strip)--> `62 * a`
   - `63 * a` --(abbreviate)--> `63 * a` --(strip)--> `63 * a`
   
   If we want to apply this fix, we'd bettter to expalin the behavior, we might need to doc some on `getAppNameLabel` (or test at least), the current note will make people think that it is simply taking the first 63 characters. but current behavior is:
   
   - If len <= 63, return dircetly
   - If len > 63, return first 62 characters.
   



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on PR #38985:
URL: https://github.com/apache/spark/pull/38985#issuecomment-1344930220

   Thank you for closing, @pan3793 .


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 commented on pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38985:
URL: https://github.com/apache/spark/pull/38985#issuecomment-1344033996

   Got it, close then. Thanks @dongjoon-hyun @Yikun @LuciferYang


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 commented on pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38985:
URL: https://github.com/apache/spark/pull/38985#issuecomment-1342983176

   cc @Yikun @dongjoon-hyun @LuciferYang would you please take a look? thx


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 commented on pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 commented on PR #38985:
URL: https://github.com/apache/spark/pull/38985#issuecomment-1343774719

   > It seems this is to fix a bad case caused by user use way?
   
   It right.
   
   > Is it necessary for Spark to do fault tolerance?
   
   The change is small, I think it's valuable.
   
   Given `commons-*`, `guava`, `jackson` are widely adopted, when user jar compiled based on the old hadoop/hive versions, I think the risk is quite high, especially, the error is not a `NoSuchMethodError`, when run into such issue, it quite confusing.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1044069338


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -241,14 +241,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   test("SPARK-36566: get app name label") {
     assert(KubernetesConf.getAppNameLabel(" Job+Spark-Pi 2021") === "job-spark-pi-2021")
     assert(KubernetesConf.getAppNameLabel("a" * 63) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 253) === "a" * 63)
+    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 62)

Review Comment:
   To avoid confusing, I changed the `abbrevMarker` to "-abbr"



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1043866184


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -275,7 +275,7 @@ private[spark] object KubernetesConf {
         .toLowerCase(Locale.ROOT)
         .replaceAll("[^a-z0-9\\-]", "-")
         .replaceAll("-+", "-"),
-      "",
+      "-", // avoid using empty string, see https://issues.apache.org/jira/browse/LANG-1463

Review Comment:
   It's a little confusing that LANG-1463 is marked as fixed at 3.10 and Apache Spark is using 3.12.
   If LANG-1463 is not fixed yet, please mention correctly instead of saying `see ...`.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1043866601


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -241,14 +241,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   test("SPARK-36566: get app name label") {
     assert(KubernetesConf.getAppNameLabel(" Job+Spark-Pi 2021") === "job-spark-pi-2021")
     assert(KubernetesConf.getAppNameLabel("a" * 63) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 253) === "a" * 63)
+    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 62)

Review Comment:
   Is this correct?



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] LuciferYang commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1044047853


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -241,14 +241,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   test("SPARK-36566: get app name label") {
     assert(KubernetesConf.getAppNameLabel(" Job+Spark-Pi 2021") === "job-spark-pi-2021")
     assert(KubernetesConf.getAppNameLabel("a" * 63) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 253) === "a" * 63)
+    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 62)

Review Comment:
   Agreed with @Yikun , and comments should be added in the code to clarify the change intent, so as to avoid being wrongly changed by other developers in the future ...
   
   



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] pan3793 commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
pan3793 commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1043983005


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -241,14 +241,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   test("SPARK-36566: get app name label") {
     assert(KubernetesConf.getAppNameLabel(" Job+Spark-Pi 2021") === "job-spark-pi-2021")
     assert(KubernetesConf.getAppNameLabel("a" * 63) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 63)
-    assert(KubernetesConf.getAppNameLabel("a" * 253) === "a" * 63)
+    assert(KubernetesConf.getAppNameLabel("a" * 64) === "a" * 62)

Review Comment:
   The result is correct, because `KubernetesConf#getAppNameLabel` calls `.stripSuffix("-")` after `abbreviate`
   
   ```
   scala> StringUtils.abbreviate("aaaa", "-", 3)
   res4: String = aa-
   
   scala> StringUtils.abbreviate("aaaa", "", 3).stripPrefix("-").stripSuffix("-")
   res5: String = aaa
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #38985: [SPARK-41451][K8S] Avoid using empty abbrevMarker in StringUtils.abbreviate

Posted by GitBox <gi...@apache.org>.
dongjoon-hyun commented on code in PR #38985:
URL: https://github.com/apache/spark/pull/38985#discussion_r1044222032


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -266,16 +266,16 @@ private[spark] object KubernetesConf {
 
   def getAppNameLabel(appName: String): String = {
     // According to https://kubernetes.io/docs/concepts/overview/working-with-objects/labels,
-    // must be 63 characters or less to follow the DNS label standard, so take the 63 characters
-    // of the appName name as the label. In addition, label value must start and end with
-    // an alphanumeric character.
+    // must be 63 characters or less to follow the DNS label standard, for appName longer than
+    // 63 characters, replace the tail w/ "-abbr" as the label. In addition, label value must
+    // start and end with an alphanumeric character.
     StringUtils.abbreviate(
       s"$appName"
         .trim
         .toLowerCase(Locale.ROOT)
         .replaceAll("[^a-z0-9\\-]", "-")
         .replaceAll("-+", "-"),
-      "",
+      "-abbr",

Review Comment:
   Sorry, but this looks a little not good to me, @pan3793 .



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org