From 760ef68a69d1e727e80487a5f9d15ccad47bab00 Mon Sep 17 00:00:00 2001
From: Andrew Kryczka <andrewkr@fb.com>
Date: Wed, 16 Nov 2016 13:52:00 -0800
Subject: [PATCH] fix deleterange asan issue

Summary:
pinned_iters_mgr_ pins iterators allocated with arena_, so we should order the
instance variable declarations such that the pinned iterators have their destructors
executed before the arena is destroyed.
Closes https://github.com/facebook/rocksdb/pull/1528

Differential Revision: D4191984

Pulled By: ajkr

fbshipit-source-id: 1386f20
---
 db/range_del_aggregator.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/db/range_del_aggregator.h b/db/range_del_aggregator.h
index d1b11873e..9935cd33e 100644
--- a/db/range_del_aggregator.h
+++ b/db/range_del_aggregator.h
@@ -89,9 +89,10 @@ class RangeDelAggregator {
   Status AddTombstones(InternalIterator* input, bool arena);
   TombstoneMap& GetTombstoneMap(SequenceNumber seq);
 
-  PinnedIteratorsManager pinned_iters_mgr_;
   StripeMap stripe_map_;
   const InternalKeyComparator icmp_;
-  Arena arena_;
+  Arena arena_;  // must be destroyed after pinned_iters_mgr_ which references
+                 // memory in this arena
+  PinnedIteratorsManager pinned_iters_mgr_;
 };
 }  // namespace rocksdb