Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix TLS reload doesn't work after delete cert file (#609) #612

Merged
merged 1 commit into from
Jun 14, 2022

Conversation

ti-srebot
Copy link
Collaborator

@ti-srebot ti-srebot commented Jun 14, 2022

cherry-pick #609 to release-3.3
You can switch your code base to this Pull Request by using git-extras:

# In client-java repo:
git pr https://github.com/tikv/client-java/pull/612

After apply modifications, you can push your change to this PR via:

git push git@github.com:ti-srebot/client-java.git pr/612:release-3.3-75f05863389d

Signed-off-by: Daemonxiao 735462752@qq.com

What problem does this PR solve?

TiSpark met some problem when use TLS Reload.

Problem Description: tryReload() is used as a task in ScheduledFuture. When tryReload() throws an exception, the schedule will be suppressed which makes tryReload() will not work.

What is changed and how does it work?

Add try-catch in tryReload().

    // If any execution of the task encounters an exception, subsequent executions are suppressed.
    private void tryReload() {
      // Add exception handling to avoid schedule stop.
      try {
        if (needReload()) {
          onChange.run();
        }
      } catch (Exception e) {
        logger.error("Failed to reload cert!" + e);
      }
    }

Code changes

  • Has exported function/method change

Check List for Tests

This PR has been tested by at least one of the following methods:

  • Unit test
  • Integration test

Side effects

  • NO side effects

Related changes

  • Need to cherry-pick to the release branch

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Collaborator Author

/run-all-tests

@codecov
Copy link

codecov bot commented Jun 14, 2022

Codecov Report

❗ No coverage uploaded for pull request base (release-3.3@aacbb8c). Click here to learn what that means.
The diff coverage is n/a.

@@              Coverage Diff               @@
##             release-3.3     #612   +/-   ##
==============================================
  Coverage               ?   34.63%           
  Complexity             ?     1418           
==============================================
  Files                  ?      278           
  Lines                  ?    17352           
  Branches               ?     1971           
==============================================
  Hits                   ?     6010           
  Misses                 ?    10737           
  Partials               ?      605           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aacbb8c...3328275. Read the comment docs.

Copy link
Member

@iosmanthus iosmanthus left a comment

Choose a reason for hiding this comment

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

LGTM

@iosmanthus iosmanthus merged commit 64beacf into tikv:release-3.3 Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants