mirror of https://github.com/facebook/rocksdb.git
add comment in SuperVersion referencing logic
Summary: The referencing logic is super confusing so added a comment at the part that took me longest to figure out. Closes https://github.com/facebook/rocksdb/pull/2996 Differential Revision: D6034969 Pulled By: ajkr fbshipit-source-id: 9cc2e744c1f79d6d57d378f86ed59238a5f583db
This commit is contained in:
parent
fb4ae4d810
commit
8dd0a7e11a
|
@ -854,6 +854,10 @@ SuperVersion* ColumnFamilyData::GetReferencedSuperVersion(
|
||||||
sv = GetThreadLocalSuperVersion(db_mutex);
|
sv = GetThreadLocalSuperVersion(db_mutex);
|
||||||
sv->Ref();
|
sv->Ref();
|
||||||
if (!ReturnThreadLocalSuperVersion(sv)) {
|
if (!ReturnThreadLocalSuperVersion(sv)) {
|
||||||
|
// This Unref() corresponds to the Ref() in GetThreadLocalSuperVersion()
|
||||||
|
// when the thread-local pointer was populated. So, the Ref() earlier in
|
||||||
|
// this function still prevents the returned SuperVersion* from being
|
||||||
|
// deleted out from under the caller.
|
||||||
sv->Unref();
|
sv->Unref();
|
||||||
}
|
}
|
||||||
return sv;
|
return sv;
|
||||||
|
|
Loading…
Reference in New Issue