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
v3.8.2 (XXXX-XX-XX)
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
* Fix active failover, so that the new host actually has working
5
10
foxx services. (BTS-558)
6
11
Original file line number Diff line number Diff line change @@ -303,8 +303,7 @@ Result GlobalInitialSyncer::updateServerInventory(VPackSlice const& leaderDataba
303
303
if (!collection->system ()) { // we will not drop system collections here
304
304
toDrop.emplace_back (collection);
305
305
}
306
- },
307
- false );
306
+ });
308
307
309
308
for (auto const & collection : toDrop) {
310
309
try {
Original file line number Diff line number Diff line change @@ -487,14 +487,13 @@ void DatabaseFeature::stop() {
487
487
#endif
488
488
vocbase->stop ();
489
489
490
- vocbase->processCollections (
490
+ vocbase->processCollectionsOnShutdown (
491
491
[](LogicalCollection* collection) {
492
492
// no one else must modify the collection's status while we are in
493
493
// here
494
494
collection->executeWhileStatusWriteLocked (
495
495
[collection]() { collection->close (); });
496
- },
497
- true );
496
+ });
498
497
499
498
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
500
499
// i am here for debugging only.
Original file line number Diff line number Diff line change @@ -1736,33 +1736,34 @@ std::vector<std::shared_ptr<arangodb::LogicalView>> TRI_vocbase_t::views() {
1736
1736
return views;
1737
1737
}
1738
1738
1739
- void TRI_vocbase_t::processCollections (std::function<void (LogicalCollection*)> const & cb,
1740
- bool includeDeleted) {
1739
+ void TRI_vocbase_t::processCollectionsOnShutdown (std::function<void (LogicalCollection*)> const & cb) {
1740
+ RECURSIVE_WRITE_LOCKER (_dataSourceLock, _dataSourceLockWriteOwner);
1741
+
1742
+ for (auto const & it : _collections) {
1743
+ cb (it.get ());
1744
+ }
1745
+ }
1746
+
1747
+ void TRI_vocbase_t::processCollections (std::function<void (LogicalCollection*)> const & cb) {
1741
1748
RECURSIVE_READ_LOCKER (_dataSourceLock, _dataSourceLockWriteOwner);
1742
1749
1743
- if (includeDeleted) {
1744
- for (auto const & it : _collections) {
1745
- cb (it.get ());
1746
- }
1747
- } else {
1748
- for (auto & entry : _dataSourceById) {
1749
- TRI_ASSERT (entry.second );
1750
+ for (auto & entry : _dataSourceById) {
1751
+ TRI_ASSERT (entry.second );
1750
1752
1751
- if (entry.second ->category () != LogicalCollection::category ()) {
1752
- continue ;
1753
- }
1753
+ if (entry.second ->category () != LogicalCollection::category ()) {
1754
+ continue ;
1755
+ }
1754
1756
1755
1757
#ifdef ARANGODB_ENABLE_MAINTAINER_MODE
1756
- auto collection =
1757
- std::dynamic_pointer_cast<arangodb::LogicalCollection>(entry.second );
1758
- TRI_ASSERT (collection);
1758
+ auto collection =
1759
+ std::dynamic_pointer_cast<arangodb::LogicalCollection>(entry.second );
1760
+ TRI_ASSERT (collection);
1759
1761
#else
1760
- auto collection =
1761
- std::static_pointer_cast<arangodb::LogicalCollection>(entry.second );
1762
+ auto collection =
1763
+ std::static_pointer_cast<arangodb::LogicalCollection>(entry.second );
1762
1764
#endif
1763
1765
1764
- cb (collection.get ());
1765
- }
1766
+ cb (collection.get ());
1766
1767
}
1767
1768
}
1768
1769
Original file line number Diff line number Diff line change @@ -252,8 +252,9 @@ struct TRI_vocbase_t {
252
252
// / @brief returns all known collections
253
253
std::vector<std::shared_ptr<arangodb::LogicalCollection>> collections (bool includeDeleted);
254
254
255
- void processCollections (std::function<void (arangodb::LogicalCollection*)> const & cb,
256
- bool includeDeleted);
255
+ void processCollectionsOnShutdown (std::function<void (arangodb::LogicalCollection*)> const & cb);
256
+
257
+ void processCollections (std::function<void (arangodb::LogicalCollection*)> const & cb);
257
258
258
259
// / @brief returns names of all known collections
259
260
std::vector<std::string> collectionNames ();
You can’t perform that action at this time.
0 commit comments