fix(native): misalignment between index clock and snapshot clock (#14688)

fix #14191

#### PR Dependency Tree


* **PR #14688** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved indexer synchronization timing for clock persistence to
prevent premature completion signals
  * Enhanced document-level indexing status tracking accuracy
  * Optimized refresh behavior for better state consistency

* **Chores**
  * Updated indexer versioning system

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-03-20 02:09:11 +08:00
committed by GitHub
parent 0d2d4bb6a1
commit daf536f77a
3 changed files with 364 additions and 14 deletions
@@ -5,6 +5,10 @@ use serde::Serialize;
use sqlx::Row;
use y_octo::DocOptions;
// Increment this whenever there is a breaking change in the index format or how
// updates are applied
const NBSTORE_INDEXER_VERSION: u32 = 1;
use super::{
error::{Error, Result},
storage::SqliteDocStorage,
@@ -192,7 +196,7 @@ impl SqliteDocStorage {
}
pub fn index_version() -> u32 {
memory_indexer::InMemoryIndex::snapshot_version()
memory_indexer::InMemoryIndex::snapshot_version() + NBSTORE_INDEXER_VERSION
}
pub async fn fts_add(&self, index_name: &str, doc_id: &str, text: &str, index: bool) -> Result<()> {