Skip to content

Instantly share code, notes, and snippets.

@patrobinson
Created November 30, 2025 08:34
Show Gist options
  • Select an option

  • Save patrobinson/1bc23213293247ba9fae059dc687a147 to your computer and use it in GitHub Desktop.

Select an option

Save patrobinson/1bc23213293247ba9fae059dc687a147 to your computer and use it in GitHub Desktop.
Unavailable error: object store error
use object_store::aws::{AmazonS3Builder, S3ConditionalPut};
use object_store::client::ClientOptions;
use slatedb::Db;
use slatedb::object_store::ObjectStore;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<(), object_store::Error> {
// Setup
let object_store_working = Arc::new(
match object_store::aws::AmazonS3Builder::new()
// These will be different if you are using real AWS
.with_allow_http(true)
.with_endpoint("http://localhost:9000")
.with_access_key_id("minioadmin")
.with_secret_access_key("minioadmin")
.with_bucket_name("bucket")
.with_region("us-east-1")
.with_conditional_put(S3ConditionalPut::ETagMatch)
.build()
{
Ok(s) => s,
Err(_) => panic!("Unable to build S3 configuration"),
},
);
let db = match Db::open("/tmp/slatedb_s3_compatible", object_store_working.clone()).await {
Ok(store) => store,
Err(_err) => panic!("Unable to open database"),
};
// Call db.put with a key and a 64 meg value to trigger L0 SST flush
let value: Vec<u8> = vec![0; 64 * 1024 * 1024];
db.put(b"k1", value.as_slice()).await;
db.close().await;
let client_options = ClientOptions::new();
let mut builder = AmazonS3Builder::new()
.with_allow_http(true)
.with_bucket_name("bucket")
.with_region("us-east-1")
.with_conditional_put(S3ConditionalPut::ETagMatch)
.with_client_options(client_options);
builder = builder.with_endpoint("http://localhost:9000");
builder = builder
.with_access_key_id("minioadmin")
.with_secret_access_key("minioadmin");
let store_result = match builder.build() {
Ok(store) => store,
Err(err) => return Err(err),
};
let object_store: Arc<dyn ObjectStore> = Arc::new(store_result);
let kv_store = match Db::builder("/tmp/cache", object_store).build().await {
Ok(store) => store,
Err(e) => {
println!("{}", e);
panic!("unable to open database")
}
};
// Put
let key = b"test_key";
let value = b"test_value";
kv_store.put(key, value).await;
// Call db.put with a key and a 64 meg value to trigger L0 SST flush
let value: Vec<u8> = vec![0; 64 * 1024 * 1024];
kv_store.put(b"k1", value.as_slice()).await;
kv_store.close().await;
Ok(())
}
Unavailable error: object store error (Generic S3 error: Error performing list request: Error performing GET http://localhost:9000/bucket?list-type=2&prefix=tmp%2Fcache%2Fmanifest%2F in 28.865µs - HTTP error: builder error)
thread 'main' (9499) panicked at src/main.rs:59:13:
unable to open database
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment