def test_repair_db(db_dir): db = plyvel.DB(db_dir, create_if_missing=True) db.put(b'foo', b'bar') db.close() del db plyvel.repair_db(db_dir) db = plyvel.DB(db_dir) assert db.get(b'foo') == b'bar'
def test_repair_db(): with tmp_db('repair', create=False) as name: db = DB(name, create_if_missing=True) db.put(b'foo', b'bar') db.close() del db plyvel.repair_db(name) db = DB(name) assert_equal(b'bar', db.get(b'foo'))
def __init__(self: "Bot", **kwargs: Any) -> None: # Initialize database db_path = self.config["bot"]["db_path"] try: self._init_db(db_path) except plyvel.IOError as e: if "Resource temporarily unavailable" in str(e): raise OSError( f"Database '{db_path}' is in use by another process! Make sure no other bot instances are running before starting this again." ) except plyvel.CorruptionError: self.log.warning("Database is corrupted, attempting to repair") plyvel.repair_db(db_path) self._init_db(db_path) self.db = self.get_db("bot") # Propagate initialization to other mixins super().__init__(**kwargs)
def repair(self): plyvel.repair_db()#paranoid_checks=None, write_buffer_size=None, max_open_files=None, lru_cache_size=None, block_size=None, block_restart_interval=None, compression='snappy', bloom_filter_bits=0 )
def repair(self): plyvel.repair_db( ) #paranoid_checks=None, write_buffer_size=None, max_open_files=None, lru_cache_size=None, block_size=None, block_restart_interval=None, compression='snappy', bloom_filter_bits=0 )