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

UCP: Move rocksdb info log to store and rotate as tikv log #6496

Closed
3 tasks
yiwu-arbug opened this issue Jan 22, 2020 · 6 comments
Closed
3 tasks

UCP: Move rocksdb info log to store and rotate as tikv log #6496

yiwu-arbug opened this issue Jan 22, 2020 · 6 comments
Labels
component/rocksdb Component: RocksDB engine difficulty/medium Medium task. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/engine SIG: Engine

Comments

@yiwu-arbug
Copy link

yiwu-arbug commented Jan 22, 2020

Description

Currently rocksdb log are stored under rocksdb directory, and the rotation logic is different to tikv log. Rocksdb rotate the log on every restart, and purge old logs except for the last 10 files. This make rocksdb log purge away if tikv fall in a restart loop. We can implement the Logger interface of rocksdb, which reuse tikv log logic to store rocksdb log at the same directory of tikv log, and use the same rotation logic. It will also make rocksdb log easier to find.

It is to solve the problem where tikv restart make rocksdb log rotate away, making rocksdb issues hard to investigate. Related issue #6495

Task breakdown:

  • In https://github.com/tikv/rust-rocksdb repo, add interface corresponds to the Logger interface in rocksdb (https://github.com/facebook/rocksdb/blob/master/include/rocksdb/env.h#L976) to allow we implement the interface in Rust. Take src/eventlistener.rs for example to see how it able to allow implementing the EventListener c++ interface in Rust. Add set_info_log method to DBOptions in src/rocksdb_options.rs correspondingly.
  • In https://github.com/tikv/tikv repo, implement Logger in components/engine_rocks/src/logger.rs (create a new file). The implementation should reuse logic in https://github.com/tikv/tikv/blob/master/components/tikv_util/src/logger/mod.rs which is used to store and rotate tikv log. In src/config.rs, set the new logger implementation to rocksdb options.
  • Test your change manually. RocksDB log (for both raftdb and kvdb) should now appear under tikv.log's directory. Restart TiKV, and see rocksdb log is appending to the same file as last time (instead of opening a new file). The log file should rotate daily, with file name rename to corresponding date.

Difficulty

  • Medium

Score

  • 1700

Mentor(s)

Recommended Skills

  • C++
  • Rust
@yiwu-arbug yiwu-arbug added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. component/rocksdb Component: RocksDB engine difficulty/medium Medium task. sig/engine SIG: Engine labels Jan 22, 2020
@yiwu-arbug yiwu-arbug changed the title Move rocksdb info log to store and rotate as tikv log UCP: Move rocksdb info log to store and rotate as tikv log Feb 28, 2020
@sre-bot sre-bot added the PCP-S1 label Feb 29, 2020
@hawkingrei
Copy link
Member

/pick-up-challenge

@sre-bot
Copy link
Contributor

sre-bot commented Mar 14, 2020

@hawkingrei pick up issue success

yiwu-arbug pushed a commit to tikv/rust-rocksdb that referenced this issue Mar 31, 2020
Signed-off-by: Wangweizhen <[email protected]>

UCP [#6496](tikv/tikv#6496)

add interface corresponds to the Logger interface
@sre-bot
Copy link
Contributor

sre-bot commented Apr 6, 2020

This pick has been automatically canceled after more than a week.

@yiwu-arbug
Copy link
Author

@you06 the task is being worked on actively. can this task being re-picked?

@you06
Copy link
Contributor

you06 commented Apr 6, 2020

@yiwu-arbug It's an accident and the pick has been recovered.

yiwu-arbug pushed a commit to tikv/rust-rocksdb that referenced this issue Apr 11, 2020
Signed-off-by: Wangweizhen <[email protected]>

UCP tikv/tikv#6496

Fix this error from clippy.

```
this public function dereferences a raw pointer but is not marked `unsafe`
help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#not_unsafe_ptr_arg_deref

```
@yiwu-arbug
Copy link
Author

@hawkingrei thank you for the hard work to finish the task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/rocksdb Component: RocksDB engine difficulty/medium Medium task. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. sig/engine SIG: Engine
Projects
None yet
Development

No branches or pull requests

4 participants