Skip to content

Commit

Permalink
[bug](bdbje) Add retry for reSetupBdbEnvironment() restore.execute() (
Browse files Browse the repository at this point in the history
apache#18777)

* In reSetupBdbEnvironment() `restore.execute()` may throw NullPointerException,
  add retry for `restore.execute()`
  • Loading branch information
SWJTU-ZhangLei authored and caiconghui1 committed Jun 21, 2023
1 parent 056b7a9 commit 75ed931
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,25 @@ private void reSetupBdbEnvironment(InsufficientLogException insufficientLogEx) {
// ATTN: here we use `getServingEnv()`, because only serving catalog has
// helper nodes.
Pair<String, Integer> helperNode = Env.getServingEnv().getHelperNode();
NetworkRestore restore = new NetworkRestore();
NetworkRestoreConfig config = new NetworkRestoreConfig();
config.setRetainLogFiles(false);
restore.execute(insufficientLogEx, config);

for (int i = 0; i < RETRY_TIME; i++) {
try {
NetworkRestore restore = new NetworkRestore();
NetworkRestoreConfig config = new NetworkRestoreConfig();
config.setRetainLogFiles(false);
restore.execute(insufficientLogEx, config);
break;
} catch (Exception e) {
LOG.warn("retry={}, reSetupBdbEnvironment exception:", i, e);
try {
Thread.sleep(5 * 1000);
LOG.warn("after sleep insufficientLogEx:", insufficientLogEx);
} catch (InterruptedException e1) {
LOG.warn("InterruptedException", e1);
}
}
}

bdbEnvironment.close();
bdbEnvironment.setup(new File(environmentPath), selfNodeName, selfNodeHostPort,
helperNode.first + ":" + helperNode.second, Env.getServingEnv().isElectable());
Expand Down

0 comments on commit 75ed931

Please sign in to comment.