FastRestore:getVersionBatchState can be called before VB is init

This commit is contained in:
Meng Xu 2020-02-28 14:47:11 -08:00
parent 7c003bfa70
commit d001820219
2 changed files with 4 additions and 4 deletions

View File

@ -368,10 +368,11 @@ struct RestoreApplierData : RestoreRoleData, public ReferenceCounted<RestoreAppl
~RestoreApplierData() = default;
// getVersionBatchState may be called periodically to dump version batch state,
// even when no version batch has been started.
int getVersionBatchState(int batchIndex) {
std::map<int, Reference<ApplierBatchData>>::iterator item = batch.find(batchIndex);
if (item == batch.end()) {
ASSERT_WE_THINK(false);
if (item == batch.end()) { // Simply caller's effort in when it can call this func.
return ApplierVersionBatchState::INVALID;
} else {
return item->second->vbState.get();

View File

@ -152,8 +152,7 @@ struct RestoreLoaderData : RestoreRoleData, public ReferenceCounted<RestoreLoade
int getVersionBatchState(int batchIndex) {
std::map<int, Reference<LoaderBatchData>>::iterator item = batch.find(batchIndex);
if (item != batch.end()) {
ASSERT_WE_THINK(false);
if (item != batch.end()) { // Simply caller's effort in when it can call this func.
return LoaderVersionBatchState::INVALID;
} else {
return item->second->vbState.get();