|
|
@ -894,6 +894,7 @@ InternalIterator* DBImpl::NewInternalIterator( |
|
|
|
range_del_agg); |
|
|
|
range_del_agg); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
TEST_SYNC_POINT_CALLBACK("DBImpl::NewInternalIterator:StatusCallback", &s); |
|
|
|
if (s.ok()) { |
|
|
|
if (s.ok()) { |
|
|
|
// Collect iterators for files in L0 - Ln
|
|
|
|
// Collect iterators for files in L0 - Ln
|
|
|
|
if (read_options.read_tier != kMemtableTier) { |
|
|
|
if (read_options.read_tier != kMemtableTier) { |
|
|
@ -907,8 +908,10 @@ InternalIterator* DBImpl::NewInternalIterator( |
|
|
|
internal_iter->RegisterCleanup(CleanupIteratorState, cleanup, nullptr); |
|
|
|
internal_iter->RegisterCleanup(CleanupIteratorState, cleanup, nullptr); |
|
|
|
|
|
|
|
|
|
|
|
return internal_iter; |
|
|
|
return internal_iter; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
CleanupSuperVersion(super_version); |
|
|
|
} |
|
|
|
} |
|
|
|
return NewErrorInternalIterator(s); |
|
|
|
return NewErrorInternalIterator(s, arena); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ColumnFamilyHandle* DBImpl::DefaultColumnFamily() const { |
|
|
|
ColumnFamilyHandle* DBImpl::DefaultColumnFamily() const { |
|
|
@ -1819,11 +1822,7 @@ SuperVersion* DBImpl::GetAndRefSuperVersion(uint32_t column_family_id) { |
|
|
|
return GetAndRefSuperVersion(cfd); |
|
|
|
return GetAndRefSuperVersion(cfd); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void DBImpl::ReturnAndCleanupSuperVersion(ColumnFamilyData* cfd, |
|
|
|
void DBImpl::CleanupSuperVersion(SuperVersion* sv) { |
|
|
|
SuperVersion* sv) { |
|
|
|
|
|
|
|
bool unref_sv = !cfd->ReturnThreadLocalSuperVersion(sv); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (unref_sv) { |
|
|
|
|
|
|
|
// Release SuperVersion
|
|
|
|
// Release SuperVersion
|
|
|
|
if (sv->Unref()) { |
|
|
|
if (sv->Unref()) { |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1835,6 +1834,12 @@ void DBImpl::ReturnAndCleanupSuperVersion(ColumnFamilyData* cfd, |
|
|
|
} |
|
|
|
} |
|
|
|
RecordTick(stats_, NUMBER_SUPERVERSION_RELEASES); |
|
|
|
RecordTick(stats_, NUMBER_SUPERVERSION_RELEASES); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DBImpl::ReturnAndCleanupSuperVersion(ColumnFamilyData* cfd, |
|
|
|
|
|
|
|
SuperVersion* sv) { |
|
|
|
|
|
|
|
if (!cfd->ReturnThreadLocalSuperVersion(sv)) { |
|
|
|
|
|
|
|
CleanupSuperVersion(sv); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// REQUIRED: this function should only be called on the write thread.
|
|
|
|
// REQUIRED: this function should only be called on the write thread.
|
|
|
|