Skip to content

Commit

Permalink
fix the coredump issue when creating multiple raft groups concurrentl…
Browse files Browse the repository at this point in the history
…y in meta merge mode
  • Loading branch information
lijianyu committed May 21, 2020
1 parent b26c4f6 commit efa0712
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/braft/raft_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class MetaStorageManager {
typedef butil::DoublyBufferedData<MetaStorageMap> DoublyBufferedMetaStorageMap;

static size_t _add(MetaStorageMap& m, const std::string& path,
const scoped_refptr<KVBasedMergedMetaStorageImpl> mss) {
const scoped_refptr<KVBasedMergedMetaStorageImpl>& mss) {
std::pair<MetaStorageMap::const_iterator, bool> iter =
m.insert(std::make_pair(path, mss));
if (iter.second) {
Expand Down
3 changes: 2 additions & 1 deletion src/braft/raft_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ friend class scoped_refptr<KVBasedMergedMetaStorageImpl>;

public:
explicit KVBasedMergedMetaStorageImpl(const std::string& path)
: _is_inited(false), _path(path) {}
: _is_inited(false), _path(path), _db(nullptr) {}
KVBasedMergedMetaStorageImpl() {}
virtual ~KVBasedMergedMetaStorageImpl() {
if (_db) {
delete _db;
_db = nullptr;
}
}

Expand Down

0 comments on commit efa0712

Please sign in to comment.