Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libsql-server/src/query_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ impl StmtKind {
))
}
Cmd::Stmt(Stmt::Detach(_)) => Some(Self::Detach),
Cmd::Stmt(Stmt::Reindex { .. }) => Some(Self::Write),
_ => None,
}
}
Expand Down
24 changes: 24 additions & 0 deletions libsql-server/tests/hrana/batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,3 +355,27 @@ fn stream() {

sim.run().unwrap();
}

#[test]
fn reindex_statement() {
let mut sim = turmoil::Builder::new()
.simulation_duration(Duration::from_secs(1000))
.build();
sim.host("primary", super::make_standalone_server);
sim.client("client", async {
let db = Database::open_remote_with_connector("http://primary:8080", "", TurmoilConnector)?;
let conn = db.connect()?;

conn.execute("create table t(x text)", ()).await?;
conn.execute("create index t_idx on t(x)", ()).await?;
conn.execute("insert into t(x) values(?)", params!["hello"])
.await?;
conn.execute("insert into t(x) values(?)", params!["hello"])
.await?;
conn.execute("reindex t_idx", ()).await?;

Ok(())
});

sim.run().unwrap();
}
1 change: 1 addition & 0 deletions libsql/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ impl StmtKind {
}) => Some(Self::Release),
Cmd::Stmt(Stmt::Attach { .. }) => Some(Self::Attach),
Cmd::Stmt(Stmt::Detach(_)) => Some(Self::Detach),
Cmd::Stmt(Stmt::Reindex { .. }) => Some(Self::Write),
_ => None,
}
}
Expand Down