[bug](bdbje) Add retry for reSetupBdbEnvironment() restore.execute() (#18777)
* In reSetupBdbEnvironment() `restore.execute()` may throw NullPointerException, add retry for `restore.execute()`
This commit is contained in:
@ -375,10 +375,25 @@ public class BDBJEJournal implements Journal { // CHECKSTYLE IGNORE THIS LINE: B
|
||||
// ATTN: here we use `getServingEnv()`, because only serving catalog has
|
||||
// helper nodes.
|
||||
HostInfo 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.getIp() + ":" + helperNode.getPort(), Env.getServingEnv().isElectable());
|
||||
|
||||
Reference in New Issue
Block a user