gluesql / gluesql

GlueSQL is quite sticky. It attaches to anywhere.

Home Page:https://gluesql.org/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to recover from ConflictOnIndexDataDeleteSync?

Carterj3 opened this issue · comments

I've been using GlueSQL w/ Sled and whenever I try to do stuff w/ map_id=67433 in the map table I get a ConflictOnIndexDataDeleteSync error. I've tried to do a DROP INDEX for all the indices but that also gives a ConflictOnIndexDataDeleteSync.

I've stuck the 2.7 GB db (compressed down to ~814MB) here (https://cards.lesuorac.com/archive.db.gz) but it'll probably only be there for a couple weeks.

Below is also how I configured the db using GlueSQL.

pub const REPLAYS_TABLE: &'static str = "replays";
pub const MAPS_TABLE: &'static str = "map";

pub const SYSTEM_VALUES_TABLE: &'static str = "system_values";
pub const SYSTEM_VALUES_VERSION_DATABASE: &'static str = "version-database";

 let mut storage = SledStorage::try_from(
            Config::new()
                .path(args.database_path)
                .mode(sled::Mode::HighThroughput)
                .cache_capacity(8 * 1024 * 1024 * 1024 /* 8 GB */)
                .flush_every_ms(Some(5000)),
        )
        .expect("Failed to create database.");

glue.execute(format!(
            "   CREATE TABLE IF NOT EXISTS {REPLAYS_TABLE} (
                                id UUID PRIMARY KEY,
                                game_id UINT64 UNIQUE NOT NULL,
                                game_name Text NOT NULL,
                                map_id UINT64 NOT NULL
                    );
                CREATE INDEX index__replays__id ON {REPLAYS_TABLE} (id);
                CREATE INDEX index__replays__game_id ON {REPLAYS_TABLE} (game_id);
                CREATE INDEX index__replays__map_id ON {REPLAYS_TABLE} (map_id);

                CREATE TABLE IF NOT EXISTS {MAPS_TABLE} (
                                id UUID PRIMARY KEY,
                                map_id UINT64 UNIQUE NOT NULL,
                                map_author Text NOT NULL,
                                last_updated Timestamp NOT NULL,
                                last_checked Timestamp NOT NULL
                    );
                CREATE INDEX index__maps__id ON {MAPS_TABLE} (id);
                CREATE INDEX index__maps__map_id ON {MAPS_TABLE} (map_id);
                CREATE INDEX index__maps__map_author ON {MAPS_TABLE} (map_author);

                CREATE TABLE IF NOT EXISTS {SYSTEM_VALUES_TABLE} (
                    key TEXT PRIMARY KEY,
                    value BYTEA NOT NULL
                );
                CREATE INDEX index__system_values__key ON {SYSTEM_VALUES_TABLE} (key);
                        
                         ",
        ))
        .await?;