File tree 5 files changed +31
-26
lines changed 5 files changed +31
-26
lines changed Original file line number Diff line number Diff line change 1
1
devel
2
2
-----
3
3
4
+ * Avoid the acquisition of a recursive read lock on server shutdown, which
5
+ could in theory lead to shutdown hangs at least if a concurrent thread is
6
+ trying to modify the list of collections (very unlikely and never observed
7
+ until now).
8
+
4
9
* Fixed display of unicode characters in Windows console.
5
10
6
11
* Fixed issue BTS-531 "Error happens during EXE package installation if
Original file line number Diff line number Diff line change @@ -305,8 +305,7 @@ Result GlobalInitialSyncer::updateServerInventory(VPackSlice const& leaderDataba
305
305
if (!collection->system ()) { // we will not drop system collections here
306
306
toDrop.emplace_back (collection);
307
307
}
308
- },
309
- false );
308
+ });
310
309
311
310
for (auto const & collection : toDrop) {
312
311
try {
Original file line number Diff line number Diff line change @@ -484,14 +484,13 @@ void DatabaseFeature::stop() {
484
484
#endif
485
485
vocbase->stop ();
486
486
487
- vocbase->processCollections (
487
+ vocbase->processCollectionsOnShutdown (
488
488
[](LogicalCollection* collection) {
489
489
// no one else must modify the collection's status while we are in
490
490
// here
491
491
collection->executeWhileStatusWriteLocked (
492
492
[collection]() { collection->close (); });
493
- },
494
- true );
493
+ });
495
494
496
495
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
497
496
// i am here for debugging only.
Original file line number Diff line number Diff line change @@ -1722,33 +1722,34 @@ std::vector<std::shared_ptr<arangodb::LogicalView>> TRI_vocbase_t::views() {
1722
1722
return views;
1723
1723
}
1724
1724
1725
- void TRI_vocbase_t::processCollections (std::function<void (LogicalCollection*)> const & cb,
1726
- bool includeDeleted) {
1725
+ void TRI_vocbase_t::processCollectionsOnShutdown (std::function<void (LogicalCollection*)> const & cb) {
1726
+ RECURSIVE_WRITE_LOCKER (_dataSourceLock, _dataSourceLockWriteOwner);
1727
+
1728
+ for (auto const & it : _collections) {
1729
+ cb (it.get ());
1730
+ }
1731
+ }
1732
+
1733
+ void TRI_vocbase_t::processCollections (std::function<void (LogicalCollection*)> const & cb) {
1727
1734
RECURSIVE_READ_LOCKER (_dataSourceLock, _dataSourceLockWriteOwner);
1728
1735
1729
- if (includeDeleted) {
1730
- for (auto const & it : _collections) {
1731
- cb (it.get ());
1732
- }
1733
- } else {
1734
- for (auto & entry : _dataSourceById) {
1735
- TRI_ASSERT (entry.second );
1736
+ for (auto & entry : _dataSourceById) {
1737
+ TRI_ASSERT (entry.second );
1736
1738
1737
- if (entry.second ->category () != LogicalCollection::category ()) {
1738
- continue ;
1739
- }
1739
+ if (entry.second ->category () != LogicalCollection::category ()) {
1740
+ continue ;
1741
+ }
1740
1742
1741
1743
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
1742
- auto collection =
1743
- std::dynamic_pointer_cast<arangodb::LogicalCollection>(entry.second );
1744
- TRI_ASSERT (collection);
1744
+ auto collection =
1745
+ std::dynamic_pointer_cast<arangodb::LogicalCollection>(entry.second );
1746
+ TRI_ASSERT (collection);
1745
1747
#else
1746
- auto collection =
1747
- std::static_pointer_cast<arangodb::LogicalCollection>(entry.second );
1748
+ auto collection =
1749
+ std::static_pointer_cast<arangodb::LogicalCollection>(entry.second );
1748
1750
#endif
1749
1751
1750
- cb (collection.get ());
1751
- }
1752
+ cb (collection.get ());
1752
1753
}
1753
1754
}
1754
1755
Original file line number Diff line number Diff line change @@ -286,8 +286,9 @@ struct TRI_vocbase_t {
286
286
// / @brief returns all known collections
287
287
std::vector<std::shared_ptr<arangodb::LogicalCollection>> collections (bool includeDeleted);
288
288
289
- void processCollections (std::function<void (arangodb::LogicalCollection*)> const & cb,
290
- bool includeDeleted);
289
+ void processCollectionsOnShutdown (std::function<void (arangodb::LogicalCollection*)> const & cb);
290
+
291
+ void processCollections (std::function<void (arangodb::LogicalCollection*)> const & cb);
291
292
292
293
// / @brief returns names of all known collections
293
294
std::vector<std::string> collectionNames ();
You can’t perform that action at this time.
0 commit comments