yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
9.05k stars 1.08k forks source link

[DocDB] log-dump utility fails to print encrypted WAL file #17816

Open yusong-yan opened 1 year ago

yusong-yan commented 1 year ago

Jira Link: DB-6905

Description

Our log-dump utility currently can only print unencrypted WAL files. For encrypted WAL files, it will show corruption error such as: Error: Corruption (yb/consensus/log_util.cc:517): Unable to initialize segment: Invalid log segment file /mnt/d0/yb-data/tserver/wals/table-000033f6000030008000000000004000/tablet-b694e9d591414442b368741369195930/wal-000000001: Bad magic. 656E63727970742100000128

The reason is log-dump is using plaintext env, Env::Default(), rather than encrypted env. Currently, encrypted env object is created through NewEncryptedEnv(DefaultHeaderManager(universe_key_manager_.get())) in TabletServer::Init()

Warning: Please confirm that this issue does not contain any sensitive information

yusong-yan commented 10 months ago

Same issue was found from sst_dump tool:

Not able to read table properties
Sst file format: block-based(old version)
/mnt/d0/yb-data/tserver/data/rocksdb/table-000033f3000030008000000000004002/tablet-14c0f61ca6294ca18fb3563253e25799/000172.sst: Corruption (yb/rocksdb/table/format.cc:278): Bad table magic number: 0x9203d5694161232c, expected: 0x88e241b785f4cff7

Both sst_dump and log-dump return corruption error when reading encrypted file, which can confuse the user. We should make the tool return error message that can cleanly callout it’s actually an EAR problem

luoteresa commented 1 month ago

Hi,

My name is Teresa Luo and I'm a student at UT Austin taking a graduate distributed systems course. I'd like to work on this issue with @Akl35 as a part of a group project.

Will be sure to use Slack as correspondence if any questions arise.