GitHub user jinxing64 opened a pull request:

    https://github.com/apache/spark/pull/16779

    [SPARK-19437] Rectify spark executor id in HeartbeatReceiverSuite.

    ## What changes were proposed in this pull request?
    
    The current code in `HeartbeatReceiverSuite`, executorId is set as below:
    ```
      private val executorId1 = "executor-1"
      private val executorId2 = "executor-2"
    ```
    
    The executorId is sent to driver when register as below:
    
    ```
    test("expire dead hosts should kill executors with replacement 
(SPARK-8119)")  {
      ...
      fakeSchedulerBackend.driverEndpoint.askSync[Boolean](
          RegisterExecutor(executorId1, dummyExecutorEndpointRef1, "1.2.3.4", 
0, Map.empty))
      ...
    }
    ```
    
    Receiving `RegisterExecutor` in `CoarseGrainedSchedulerBackend`, the 
executorId will be compared with `currentExecutorIdCounter` as below:
    ```
    case RegisterExecutor(executorId, executorRef, hostname, cores, logUrls)  =>
      if (executorDataMap.contains(executorId)) {
        executorRef.send(RegisterExecutorFailed("Duplicate executor ID: " + 
executorId))
        context.reply(true)
      } else {
      ...
      executorDataMap.put(executorId, data)
      if (currentExecutorIdCounter < executorId.toInt) {
        currentExecutorIdCounter = executorId.toInt
      }
      ...
    ```
    
    `executorId.toInt` will cause NumberformatException.
    
    This unit test can pass currently because of `askWithRetry`, when catching 
exception, RPC will call again, thus it will go `if` branch and return true.
    
    **To fix**
    Rectify executorId and replace `askWithRetry` with `askSync`, refer to 
https://github.com/apache/spark/pull/16690
    ## How was this patch tested?
    This fix is for unit test and no need to add another one.(If this patch 
involves UI changes, please attach a screenshot; otherwise, remove this)

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jinxing64/spark SPARK-19437

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/16779.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #16779
    
----
commit c8403eafbf11837e315a5e5732d7e2e4ccdc673d
Author: jinxing <jinx...@meituan.com>
Date:   2017-02-02T14:14:35Z

    [SPARK-19437] Rectify spark executor id in HeartbeatReceiverSuite.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to