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
main
Andrew Kryczka 7 years ago committed by Facebook Github Bot
parent fb4ae4d810
commit 8dd0a7e11a
  1. 4
      db/column_family.cc

@ -854,6 +854,10 @@ SuperVersion* ColumnFamilyData::GetReferencedSuperVersion(
sv = GetThreadLocalSuperVersion(db_mutex);
sv->Ref();
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();
}
return sv;

Loading…
Cancel
Save