Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Corruption: unknown checksum type 4 #171

Open
mbspng opened this issue Aug 15, 2024 · 2 comments
Open

[Bug] Corruption: unknown checksum type 4 #171

mbspng opened this issue Aug 15, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mbspng
Copy link

mbspng commented Aug 15, 2024

Describe the bug

Publishing data to RocksDB results in Corruption: unknown checksum type 4 when querying. I found this thread, which might be related: https://bugzilla.redhat.com/show_bug.cgi?id=2193399

To reproduce

Script to put data into DB

session = zenoh.open()
pub = session.declare_publisher("data/store")
pub.put("1")  # putting byte string results in same error.

Script to query database

import argparse
from pathlib import Path

import rocksdb


def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument("rocksdb_directory", type=Path)
    return parser.parse_args()


def main(args):
    column_families = {
        b"default": rocksdb.ColumnFamilyOptions(),
        b"data_info": rocksdb.ColumnFamilyOptions(),
    }

    options = rocksdb.Options(create_if_missing=False)
    db = rocksdb.DB(
        str(args.rocksdb_directory),
        options,
        column_families=column_families,
        read_only=True,
    )


if __name__ == "__main__":
    main(parse_args())

Error

Traceback (most recent call last):
  File "...query_rocksdb.py", line 42, in <module>
    main(parse_args())
  File ".../query_rocksdb.py", line 22, in main
    db = rocksdb.DB(
  File "rocksdb/_rocksdb.pyx", line 1636, in rocksdb._rocksdb.DB.__cinit__
  File "rocksdb/_rocksdb.pyx", line 76, in rocksdb._rocksdb.check_status
rocksdb.errors.Corruption: b'Corruption: unknown checksum type 4 in zenoh-rocksdb/example/000028.sst offset 25692519 size 35'

System info

Ubuntu 22.04

-> % dpkg -l G rocksdb
ii  librocksdb-dev                                6.11.4-3                                    amd64        persistent Key-Value Store for Flash and RAM Storage (development)
ii  librocksdb6.11                                6.11.4-3                                    amd64        persistent Key-Value Store for Flash and RAM Storage
ii  zenoh-backend-rocksdb                         0.11.0-stable                               amd64        Backend for Zenoh using RocksDB

-> % dpkg -l G zenoh  
ii  zenoh                                         0.11.0-stable                               amd64        Zenoh: Zero Overhead Pub/sub, Store/Query and Compute.
ii  zenoh-backend-rocksdb                         0.11.0-stable                               amd64        Backend for Zenoh using RocksDB
ii  zenoh-plugin-rest                             0.11.0-stable                               amd64        The zenoh REST plugin
ii  zenoh-plugin-storage-manager                  0.11.0-stable                               amd64        The zenoh storages plugin.
ii  zenohd                                        0.11.0-stable                               amd64        Zenoh: Zero Overhead Pub/sub, Store/Query and Compute.

-> % pip list G rocks 
python-rocksdb        0.7.0
@mbspng mbspng added the bug Something isn't working label Aug 15, 2024
@mbspng
Copy link
Author

mbspng commented Aug 16, 2024

The bug is that using a key expression in the storage config for RocksDB that ends in ** will cause this. Is this expected? Other storages can have ** in the key expression.

So my config was

{
  plugins: {
    rest: {                        // activate and configure the REST plugin
      http_port: 8000              // with HTTP server listening on port 8000
    },
    storage_manager: {             // activate and configure the storage_manager plugin
      volumes: {
        rocksdb: {
        }
      },
      storages: {
        rocksdb: {
          // the key expression this storage will subscribe to
          key_expr: "point_clouds/**",
          // this prefix will be stripped from the received key when converting to database key.
          // i.e.: "demo/example/a/b" will be stored as "a/b"
          //          strip_prefix: "demo/example",
          volume: {
            id: "rocksdb",
            // the RocksDB database will be stored in this directory (relative to ${ZENOH_BACKEND_ROCKSDB_ROOT})
            dir: "example",
            // create the RocksDB database if not already existing
            create_db: true
          }
        }
      }
    }
  }
}

And I changed it to

{
  plugins: {
    rest: {                        // activate and configure the REST plugin
      http_port: 8000              // with HTTP server listening on port 8000
    },
    storage_manager: {             // activate and configure the storage_manager plugin
      volumes: {
        rocksdb: {
        }
      },
      storages: {
        rocksdb: {
          // the key expression this storage will subscribe to
          key_expr: "point_clouds/store",
          // this prefix will be stripped from the received key when converting to database key.
          // i.e.: "demo/example/a/b" will be stored as "a/b"
          //          strip_prefix: "demo/example",
          volume: {
            id: "rocksdb",
            // the RocksDB database will be stored in this directory (relative to ${ZENOH_BACKEND_ROCKSDB_ROOT})
            dir: "example",
            // create the RocksDB database if not already existing
            create_db: true
          }
        }
      }
    }
  }
}

by dropping the **. Then the error went away and I could successfully query the RocksDB.

@oteffahi
Copy link
Contributor

oteffahi commented Sep 5, 2024

Hello @mbspng. Thank you for investigating and reporting this issue. I will address it asap 👍

@oteffahi oteffahi self-assigned this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants