Forgot to seek before garbage collection
This commit is contained in:
parent
f3fc67cbbc
commit
c0a3ee08b8
2 changed files with 131 additions and 63 deletions
|
|
@ -82,6 +82,20 @@ async fn append_bunch_of_entries(store: &mut Store<Data>) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn test_garbage_collection(store: &mut Store<Data>) -> Result<()> {
|
||||
let mut cursor = store.write_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// cursor.delete_entries_where_eq()
|
||||
// 1. mark a bunch of entries as deleted
|
||||
let column = 0;
|
||||
let value = 1;
|
||||
// cursor.delete_entries_where_eq(column, &value, true).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// let value = 50;
|
||||
// cursor.delete_entries_where_eq(column, &value).await.map_err(|e| e.to_io_or_panic())?;
|
||||
|
||||
// cursor.initiate_garbage_collection().await.map_err(|e| e.to_io_or_panic())?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
println!("STOOOOOOOOOOOORAAAAAAAAAAAGE");
|
||||
|
|
@ -117,65 +131,73 @@ async fn main() -> Result<()> {
|
|||
cursor.read_entries().await.map_err(|e| e.to_io_or_panic())?;
|
||||
}
|
||||
|
||||
{
|
||||
let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
}
|
||||
test_garbage_collection(&mut store).await?;
|
||||
|
||||
{
|
||||
let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
let column = 2;
|
||||
let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("{:?}", x);
|
||||
cursor.read_entries().await.map_err(|e| e.to_io_or_panic())?;
|
||||
}
|
||||
|
||||
{
|
||||
let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
let column = 0;
|
||||
let value = 1;
|
||||
let entries = cursor.select_entries_where_eq(column, &value).await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("ARE INDEXES WORKING???");
|
||||
println!("{:?}", entries);
|
||||
}
|
||||
|
||||
{
|
||||
let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
let column = 1;
|
||||
let value = 2;
|
||||
let entries = cursor.select_entries_where_eq(column, &value).await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("ARE INDEXES WORKING???");
|
||||
println!("{:?}", entries);
|
||||
}
|
||||
// {
|
||||
// let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// let x = cursor.next().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// }
|
||||
|
||||
{
|
||||
let column = 1;
|
||||
// println!("BUILDING AN INDEX");
|
||||
// store.attach_index(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("INDEX BUILT!");
|
||||
// {
|
||||
// let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// let column = 2;
|
||||
// let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// let x = cursor.next_at_column(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("{:?}", x);
|
||||
// }
|
||||
|
||||
let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
let value = 2;
|
||||
let entries = cursor.select_entries_where_eq(column, &value).await.map_err(|e| e.to_io_or_panic())?;
|
||||
println!("ARE INDEXES WORKING???");
|
||||
println!("{:?}", entries);
|
||||
}
|
||||
// {
|
||||
// let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// let column = 0;
|
||||
// let value = 1;
|
||||
// let entries = cursor.select_entries_where_eq(column, &value).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("ARE INDEXES WORKING???");
|
||||
// println!("{:?}", entries);
|
||||
// }
|
||||
|
||||
// {
|
||||
// let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// let column = 1;
|
||||
// let value = 2;
|
||||
// let entries = cursor.select_entries_where_eq(column, &value).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("ARE INDEXES WORKING???");
|
||||
// println!("{:?}", entries);
|
||||
// }
|
||||
|
||||
// {
|
||||
// let column = 1;
|
||||
// // println!("BUILDING AN INDEX");
|
||||
// // store.attach_index(column).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// // println!("INDEX BUILT!");
|
||||
|
||||
// let mut cursor = store.read_cursor().await.map_err(|e| e.to_io_or_panic())?;
|
||||
// let value = 2;
|
||||
// let entries = cursor.select_entries_where_eq(column, &value).await.map_err(|e| e.to_io_or_panic())?;
|
||||
// println!("ARE INDEXES WORKING???");
|
||||
// println!("{:?}", entries);
|
||||
// }
|
||||
|
||||
|
||||
// {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue