| 122 | |
| 123 | |
| 124 | PageBitmap* GarbageCollector::getPages(const TraNumber oldest_snapshot, USHORT &relID) |
| 125 | { |
| 126 | SyncLockGuard shGuard(&m_sync, SYNC_SHARED, "GarbageCollector::getPages"); |
| 127 | |
| 128 | if (m_relations.isEmpty()) |
| 129 | { |
| 130 | m_nextRelID = 0; |
| 131 | return NULL; |
| 132 | } |
| 133 | |
| 134 | FB_SIZE_T pos; |
| 135 | if (!m_relations.find(m_nextRelID, pos) && (pos == m_relations.getCount())) |
| 136 | pos = 0; |
| 137 | |
| 138 | for (; pos < m_relations.getCount(); pos++) |
| 139 | { |
| 140 | RelationData* relData = m_relations[pos]; |
| 141 | SyncLockGuard syncData(&relData->m_sync, SYNC_EXCLUSIVE, "GarbageCollector::getPages"); |
| 142 | |
| 143 | PageBitmap* bm = NULL; |
| 144 | relData->swept(oldest_snapshot, &bm); |
| 145 | |
| 146 | if (bm) |
| 147 | { |
| 148 | relID = relData->getRelID(); |
| 149 | m_nextRelID = relID + 1; |
| 150 | return bm; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | m_nextRelID = 0; |
| 155 | return NULL; |
| 156 | } |
| 157 | |
| 158 | |
| 159 | void GarbageCollector::removeRelation(const USHORT relID) |