static */
| 135 | } |
| 136 | |
| 137 | /* static */ void redisDbPersistentDataSnapshot::gcDisposeSnapshot(redisDbPersistentDataSnapshot *psnapshot) |
| 138 | { |
| 139 | psnapshot->m_refCount--; |
| 140 | if (psnapshot->m_refCount <= 0) |
| 141 | { |
| 142 | serverAssert(psnapshot->m_refCount == 0); |
| 143 | // Remove our ref from any children and dispose them too |
| 144 | redisDbPersistentDataSnapshot *psnapshotChild = psnapshot; |
| 145 | std::vector<redisDbPersistentDataSnapshot*> vecClean; |
| 146 | while ((psnapshotChild = psnapshotChild->m_spdbSnapshotHOLDER.get()) != nullptr) |
| 147 | vecClean.push_back(psnapshotChild); |
| 148 | |
| 149 | for (auto psnapshotChild : vecClean) |
| 150 | gcDisposeSnapshot(psnapshotChild); |
| 151 | |
| 152 | //psnapshot->m_pdict->iterators--; |
| 153 | psnapshot->m_spdbSnapshotHOLDER.release(); |
| 154 | psnapshot->m_pdbSnapshot = nullptr; |
| 155 | g_pserver->garbageCollector.enqueue(serverTL->gcEpoch, std::unique_ptr<redisDbPersistentDataSnapshot>(psnapshot)); |
| 156 | serverLog(LL_VERBOSE, "Garbage collected snapshot"); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | void redisDbPersistentData::restoreSnapshot(const redisDbPersistentDataSnapshot *psnapshot) |
| 161 | { |