jsteemann
de76909464
refactor SavePoints ( #5192 )
...
Summary:
Savepoints are assumed to be used in a stack-wise fashion (only
the top element should be used), so they were stored by `WriteBatch`
in a member variable `save_points` using an std::stack.
Conceptually this is fine, but the implementation had a few issues:
- the `save_points_` instance variable was a plain pointer to a heap-
allocated `SavePoints` struct. The destructor of `WriteBatch` simply
deletes this pointer. However, the copy constructor of WriteBatch
just copied that pointer, meaning that copying a WriteBatch with
active savepoints will very likely have crashed before. Now a proper
copy of the savepoints is made in the copy constructor, and not just
a copy of the pointer
- `save_points_` was an std::stack, which defaults to `std::deque` for
the underlying container. A deque is a bit over the top here, as we
only need access to the most recent savepoint (i.e. stack.top()) but
never any elements at the front. std::deque is rather expensive to
initialize in common environments. For example, the STL implementation
shipped with GNU g++ will perform a heap allocation of more than 500
bytes to create an empty deque object. Although the `save_points_`
container is created lazily by RocksDB, moving from a deque to a plain
`std::vector` is much more memory-efficient. So `save_points_` is now
a vector.
- `save_points_` was changed from a plain pointer to an `std::unique_ptr`,
making ownership more explicit.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5192
Differential Revision: D15024074
Pulled By: maysamyabandeh
fbshipit-source-id: 5b128786d3789cde94e46465c9e91badd07a25d7
2019-04-19 20:33:04 -07:00
..
2019-04-10 19:31:18 -07:00
2019-04-10 19:31:18 -07:00
2019-04-18 10:55:01 -07:00
2019-03-19 09:43:22 -07:00
2019-02-14 14:41:36 -08:00
2019-04-16 23:32:20 -07:00
2019-04-16 23:32:20 -07:00
2019-02-14 14:41:36 -08:00
2018-10-08 22:54:43 -07:00
2018-12-07 17:06:02 -08:00
2017-08-19 14:10:08 -07:00
2019-02-14 14:41:36 -08:00
2019-02-11 15:01:46 -08:00
2019-02-07 16:57:33 -08:00
2019-02-14 14:41:36 -08:00
2019-03-19 17:28:19 -07:00
2019-04-10 19:31:18 -07:00
2019-03-19 17:28:19 -07:00
2019-04-16 23:32:20 -07:00
2019-04-16 23:32:20 -07:00
2019-02-14 14:41:36 -08:00
2019-02-28 10:27:59 -08:00
2018-05-29 15:44:34 -07:00
2019-04-16 23:32:20 -07:00
2019-04-16 23:32:20 -07:00
2019-02-14 11:23:55 -08:00
2018-10-09 15:19:38 -07:00
2019-02-14 14:41:36 -08:00
2018-11-09 11:19:58 -08:00
2019-02-14 14:41:36 -08:00
2019-02-14 14:41:36 -08:00
2019-04-15 11:35:21 -07:00
2017-10-17 08:57:09 -07:00
2019-02-14 14:41:36 -08:00
2019-04-12 17:07:49 -07:00
2019-02-14 14:41:36 -08:00
2019-04-18 22:39:34 -07:00
2018-11-12 16:42:16 -08:00
2018-11-09 11:19:58 -08:00
2018-11-12 12:24:26 -08:00
2018-12-13 15:12:40 -08:00
2019-04-16 23:32:20 -07:00
2019-04-16 23:32:20 -07:00
2018-08-03 17:42:34 -07:00
2019-03-28 15:17:13 -07:00
2019-04-15 18:51:04 -07:00
2019-02-28 10:27:59 -08:00
2019-03-27 16:24:45 -07:00
2019-03-26 16:45:31 -07:00
2019-03-26 16:45:31 -07:00
2019-04-15 18:51:04 -07:00
2019-04-15 11:35:21 -07:00
2019-04-16 23:32:20 -07:00
2018-10-09 17:15:51 -07:00
2017-07-15 16:11:23 -07:00
2017-07-15 16:11:23 -07:00
2018-10-29 14:36:31 -07:00
2018-05-21 14:43:11 -07:00
2019-02-14 14:41:36 -08:00
2019-04-19 10:38:43 -07:00
2018-12-17 17:33:46 -08:00
2019-04-16 11:37:47 -07:00
2019-02-14 14:41:36 -08:00
2019-02-14 14:41:36 -08:00
2019-04-02 14:47:16 -07:00
2019-03-29 10:08:50 -07:00
2019-02-15 09:51:41 -08:00
2019-04-16 23:32:20 -07:00
2019-03-26 16:45:31 -07:00
2019-04-16 23:32:20 -07:00
2019-03-01 10:42:09 -08:00
2018-09-20 15:15:28 -07:00
2018-07-17 14:43:18 -07:00
2019-04-16 23:32:20 -07:00
2019-04-11 14:28:26 -07:00
2019-04-11 14:28:26 -07:00
2019-04-11 14:28:26 -07:00
2019-02-14 14:41:36 -08:00
2018-12-28 18:02:28 -08:00
2019-04-06 06:40:36 -07:00
2018-07-13 17:42:38 -07:00
2019-03-27 16:24:45 -07:00
2019-04-11 14:28:26 -07:00
2019-04-02 21:15:44 -07:00
2018-09-17 13:14:07 -07:00
2018-10-04 20:46:50 -07:00
2018-10-04 20:46:50 -07:00
2019-04-11 14:33:49 -07:00
2018-09-15 13:43:04 -07:00
2018-04-12 17:59:16 -07:00
2019-02-14 14:41:36 -08:00
2019-03-19 17:28:19 -07:00
2019-02-12 19:16:17 -08:00
2019-04-08 11:16:34 -07:00
2019-02-14 14:41:36 -08:00
2019-02-14 14:41:36 -08:00
2017-07-15 16:11:23 -07:00
2017-07-15 16:11:23 -07:00
2017-07-15 16:11:23 -07:00
2019-03-19 17:28:19 -07:00
2019-04-10 19:31:18 -07:00
2019-03-19 17:28:19 -07:00
2017-07-15 16:11:23 -07:00
2017-07-15 16:11:23 -07:00
2018-07-13 17:27:39 -07:00
2019-04-16 11:37:47 -07:00
2018-03-05 13:13:41 -08:00
2019-02-20 15:52:54 -08:00
2019-02-20 15:52:54 -08:00
2019-04-18 10:55:01 -07:00
2019-03-19 17:28:19 -07:00
2019-01-15 21:34:38 -08:00
2019-04-16 23:32:20 -07:00
2018-08-24 18:13:20 -07:00
2019-03-26 16:45:31 -07:00
2019-03-27 10:28:21 -07:00
2019-03-26 16:45:31 -07:00
2019-03-27 10:28:21 -07:00
2019-03-27 10:28:21 -07:00
2018-05-03 15:43:09 -07:00
2018-05-03 15:43:09 -07:00
2019-04-11 14:28:26 -07:00
2019-01-03 16:30:12 -08:00
2017-07-15 16:11:23 -07:00
2019-02-14 14:41:36 -08:00
2019-02-14 14:41:36 -08:00
2019-02-13 18:33:42 -08:00
2019-01-31 14:49:51 -08:00
2019-04-17 10:15:05 -07:00
2019-02-19 12:15:39 -08:00
2019-04-11 14:28:26 -07:00
2019-02-14 14:41:36 -08:00
2019-02-28 10:27:59 -08:00
2018-12-17 17:33:46 -08:00
2017-07-15 16:11:23 -07:00
2019-02-14 14:41:36 -08:00
2019-03-28 13:16:02 -07:00
2018-07-13 17:27:39 -07:00
2019-03-27 12:27:54 -07:00
2017-07-15 16:11:23 -07:00
2019-03-01 15:45:45 -08:00
2019-04-02 15:17:47 -07:00
2019-02-14 14:41:36 -08:00
2018-12-19 13:29:51 -08:00
2018-12-17 17:33:46 -08:00
2019-04-18 12:27:25 -07:00
2019-04-18 12:27:25 -07:00
2018-12-11 12:10:48 -08:00
2019-04-16 11:37:47 -07:00
2018-12-17 13:20:51 -08:00
2019-04-12 14:40:41 -07:00
2018-10-12 10:41:54 -07:00
2019-04-19 11:55:13 -07:00
2019-01-16 09:55:32 -08:00
2017-07-15 16:11:23 -07:00
2019-04-02 14:47:16 -07:00
2019-04-11 14:28:26 -07:00
2019-04-11 14:28:26 -07:00
2019-03-18 12:15:34 -07:00
2019-03-18 12:15:34 -07:00
2019-03-18 12:15:34 -07:00
2019-03-27 12:27:54 -07:00
2019-03-27 12:27:54 -07:00
2019-02-19 13:39:49 -08:00
2019-03-26 16:45:31 -07:00
2019-03-26 16:45:31 -07:00
2019-02-11 11:20:24 -08:00
2019-02-08 11:33:11 -08:00
2019-03-26 16:45:31 -07:00
2019-02-19 13:39:49 -08:00
2019-04-18 22:39:34 -07:00
2019-04-17 18:15:20 -07:00
2018-11-09 11:19:58 -08:00
2019-03-28 15:17:13 -07:00
2018-01-11 18:57:33 -08:00
2017-07-15 16:11:23 -07:00
2018-06-28 18:58:29 -07:00
2019-02-19 13:39:49 -08:00
2019-04-19 20:33:04 -07:00
2019-04-02 15:17:47 -07:00
2017-07-15 16:11:23 -07:00
2019-02-19 13:39:49 -08:00
2017-07-15 16:11:23 -07:00
2017-07-15 16:11:23 -07:00
2018-11-07 14:07:53 -08:00
2019-01-03 12:40:42 -08:00