8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +01:00

Fix recovery of incompletely erased indices

This commit is contained in:
AlexPeshkoff 2025-01-10 19:33:31 +03:00
parent 86a9e78b66
commit 2bbfd526b5
3 changed files with 14 additions and 4 deletions

View File

@ -559,6 +559,11 @@ public:
}
}
bool isReady()
{
return (flg == READY) || ((thd == Thread::getId()) && (flg == SCANNING));
}
private:
std::condition_variable cond;
std::mutex mtx;
@ -628,6 +633,9 @@ public:
listEntry->scanObject(
[&](bool rld) { return scanCallback(tdbb, obj, rld, fl); },
fl);
if ((!(fl & CacheFlag::NOSCAN)) && (!(listEntry->bar.isReady())))
return nullptr;
}
return obj;
}

View File

@ -415,6 +415,9 @@ void BTR_all(thread_db* tdbb, Cached::Relation* relation, IndexDescList& idxList
for (MetaId i = 0; i < root->irt_count; i++)
{
if (!relation->lookup_index(tdbb, i, CacheFlag::AUTOCREATE))
continue;
index_desc idx;
if (BTR_description(tdbb, relation, root, &idx, i))
idxList.add(idx);

View File

@ -3553,7 +3553,7 @@ bool jrd_rel::scan(thread_db* tdbb, ObjectBase::Flag flags)
rel_current_format = NULL;
dependencies = sys_triggers = false;
return true;
return getName().hasData();
}
@ -5286,9 +5286,8 @@ bool IndexVersion::scan(thread_db* tdbb, ObjectBase::Flag flags)
if (idv_name.isEmpty())
{
fb_assert(false);
fatal_exception::raiseFmt("Index with id=%d for relation %s not found\n",
getId(), getPermanent()->getRelation()->c_name());
idv_inactive = true;
return false;
}
perm->idp_name = idv_name;