| 133 | } |
| 134 | |
| 135 | static void wipeBlockServicePorts(rocksdb::WriteBatch& batch, rocksdb::DB* db, |
| 136 | rocksdb::ColumnFamilyHandle* blockServiceCf, rocksdb::ColumnFamilyHandle* writableBlockServiceCf, rocksdb::ColumnFamilyHandle* lastHeartBeatCf) |
| 137 | { |
| 138 | auto* it = db->NewIterator(rocksdb::ReadOptions(), blockServiceCf); |
| 139 | auto now = ternNow(); |
| 140 | for (it->SeekToFirst(); it->Valid(); it->Next()) { |
| 141 | FullBlockServiceInfo info; |
| 142 | readBlockServiceInfo(it->key(), it->value(), info); |
| 143 | if (info.flags == BlockServiceFlags::DECOMMISSIONED) { |
| 144 | continue; |
| 145 | } |
| 146 | for (auto& addr : info.addrs.addrs) { |
| 147 | addr.port = 0; |
| 148 | } |
| 149 | StaticValue<WritableBlockServiceKey> writableKey; |
| 150 | StaticValue<LastHeartBeatKey> lastHeartBeat; |
| 151 | bool wasWritable = false; |
| 152 | if (blockServiceFlagsWritable(info.flags) && info.availableBytes > 0) { |
| 153 | blockServiceToWritableBlockServiceKey(info, writableKey()); |
| 154 | batch.Delete(writableBlockServiceCf, writableKey.toSlice()); |
| 155 | } |
| 156 | blockServiceToLastHeartBeat(info, lastHeartBeat()); |
| 157 | batch.Delete(lastHeartBeatCf, lastHeartBeat.toSlice()); |
| 158 | info.flags = info.flags | BlockServiceFlags::STALE; |
| 159 | info.lastInfoChange = now; |
| 160 | writeBlockServiceInfo(batch, blockServiceCf, info); |
| 161 | } |
| 162 | ROCKS_DB_CHECKED(it->status()); |
| 163 | delete it; |
| 164 | } |
| 165 | |
| 166 | void RegistryDB::processLogEntries(std::vector<LogsDBLogEntry>& logEntries, std::vector<RegistryDBWriteResult>& writeResults) { |
| 167 | auto expectedLogEntry = lastAppliedLogEntry(); |
no test coverage detected