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

(encryption) tikv-ctl dump encryption metadata panic without data-dir in config.toml #16094

Closed
mayjiang0203 opened this issue Nov 29, 2023 · 1 comment · Fixed by #16095
Closed
Assignees
Labels
severity/minor type/bug Type: Issue - Confirmed a bug

Comments

@mayjiang0203
Copy link

mayjiang0203 commented Nov 29, 2023

Bug Report

What version of TiKV are you using?

master

What operating system and CPU are you using?

Steps to reproduce

What did you expect?

What did happened?

Without data-dir in config, add --data-dir option in command line, dump-file panic as following:

sh-5.1# /tikv-ctl --config=/etc/tikv/tikv.toml --ca-path /var/lib/tikv-tls/ca.crt --cert-path /var/lib/tikv-tls/tls.crt --key-path /var/lib/tikv-tls/tls.key --data-dir=/var/lib/tikv/data/ --host=127.0.0.1:20160 encryption-meta dump-file
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" })', cmd/tikv-ctl/src/main.rs:211:88
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After adding data-dir in config.toml as following, command succeeded.

sh-5.1# cat /tikv.toml
log-file = "/var/lib/tikv/log/tikv.log"
log-level = "info"

[security]
  ca-path = "/var/lib/tikv-tls/ca.crt"
  cert-path = "/var/lib/tikv-tls/tls.crt"
  key-path = "/var/lib/tikv-tls/tls.key"
  redact-info-log = true
  [security.encryption]
    data-encryption-method = "aes128-ctr"
    data-key-rotation-period = "1h"
    [security.encryption.master-key]
      endpoint = "https://kms.us-west-2.amazonaws.com"
      key-id = "b2e2affa-f462-4758-8abc-2e1eed17c907"
      region = "us-west-2"
      type = "kms"

[server]
  [server.labels]
    zone = "us-west-2a"

[storage]
  data-dir = "/var/lib/tikv/data"
  reserve-space = "0MB"
sh-5.1# /tikv-ctl --config=/tikv.toml --ca-path /var/lib/tikv-tls/ca.crt --cert-path /var/lib/tikv-tls/tls.crt --key-path /var/lib/tikv-tls/tls.key --host=127.0.0.1:20160 encryption-meta dump-file
/var/lib/tikv/data/raft-engine/0000000000000001.rewrite: key_id: 1459426208351074235 iv: 1C08ED0A9EB96397A714301B3CFD2DC2 method: Aes128Ctr
/var/lib/tikv/data/db/OPTIONS-000013: key_id: 1459426208351074235 iv: AD6C990A5C9DC99E9C654D8146AFF488 method: Aes128Ctr
/var/lib/tikv/data/db/OPTIONS-000011: key_id: 1459426208351074235 iv: 144B28145D499859FD277FDA9D72AED2 method: Aes128Ctr
/var/lib/tikv/data/db/MANIFEST-000004: key_id: 1459426208351074235 iv: C5D015987266ACB21B7BCD6A1B2CB8F5 method: Aes128Ctr
/var/lib/tikv/data/db/000005.log: key_id: 1459426208351074235 iv: 0169F5E82CABBA4EEE72974708FF498A method: Aes128Ctr
/var/lib/tikv/data/raft-engine/0000000000000001.raftlog: key_id: 1459426208351074235 iv: 424F67A96780A7FC21A535556E9B4B4B method: Aes128Ctr
/var/lib/tikv/data/db/IDENTITY: key_id: 1459426208351074235 iv: 46520C04ADC926AD0B18ACCFD1DD7DA1 method: Aes128Ctr
@mayjiang0203 mayjiang0203 added the type/bug Type: Issue - Confirmed a bug label Nov 29, 2023
@mayjiang0203
Copy link
Author

/severity moderate
/assign @LykxSassinator

ti-chi-bot bot pushed a commit that referenced this issue Nov 30, 2023
close #16094

In previous version, users who wanna use tikv-ctl to dump the encryption meta
might be confused with the ambiguous errors on `data-dir` configuration.

To make this tool easier to use, the hints on setting `data-dir` will be present
to users if they miss the configuration `storage.data-dir` in tikv.toml and `--data-dir`,
when using `encryption-meta` command.

Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/minor type/bug Type: Issue - Confirmed a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants