|
|
@@ -149,6 +149,17 @@ bool PersistenceManager::recover(MemoryStore& store) {
|
|
|
(*entry.data)["member"].get<std::string>());
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+ case WalOpType::VEC_PUT:
|
|
|
+ if (entry.vectorData.has_value()) {
|
|
|
+ store.loadVector(entry.collection, entry.documentId, *entry.vectorData);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case WalOpType::VEC_DELETE:
|
|
|
+ // Vector deletion is handled when the document is deleted
|
|
|
+ // during normal recovery (DELETE entries). No separate action needed.
|
|
|
+ break;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
@@ -211,6 +222,23 @@ void PersistenceManager::logDropCollection(const std::string& collection) {
|
|
|
collectionSequences_.erase(collection);
|
|
|
}
|
|
|
|
|
|
+uint64_t PersistenceManager::logVecPut(const std::string& collection, const std::string& docId,
|
|
|
+ const std::vector<float>& vec) {
|
|
|
+ if (!running_.load()) return 0;
|
|
|
+ auto entry = WriteAheadLog::makeVecPutEntry(collection, docId, vec);
|
|
|
+ uint64_t seq = wal_->append(entry);
|
|
|
+ updateCollectionSequence(collection, seq);
|
|
|
+ return seq;
|
|
|
+}
|
|
|
+
|
|
|
+uint64_t PersistenceManager::logVecDelete(const std::string& collection, const std::string& docId) {
|
|
|
+ if (!running_.load()) return 0;
|
|
|
+ auto entry = WriteAheadLog::makeVecDeleteEntry(collection, docId);
|
|
|
+ uint64_t seq = wal_->append(entry);
|
|
|
+ updateCollectionSequence(collection, seq);
|
|
|
+ return seq;
|
|
|
+}
|
|
|
+
|
|
|
void PersistenceManager::forceSnapshot(const MemoryStore& store) {
|
|
|
{
|
|
|
std::lock_guard<std::mutex> lock(storeMutex_);
|