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

Consider choosing block strategy for slog-async #3695

Closed
overvenus opened this issue Oct 20, 2018 · 5 comments
Closed

Consider choosing block strategy for slog-async #3695

overvenus opened this issue Oct 20, 2018 · 5 comments
Assignees
Labels
type/bug Type: Issue - Confirmed a bug

Comments

@overvenus
Copy link
Member

Question

There are lot of slog-async: logger dropped messages due to channel overflow, count: 7 in tikv's log file. The count: 7 means 7 logs have been drop due to slogger channel full. There is no way to recover dropped logs, which is not helpful for debugging. The behaviour is controlled by slog_async::OverflowStrategy. Instead of OverflowStrategy::DropAndReport(current strategy), please consider choosing OverflowStrategy::Block, so tikv prints all logs.

@ice1000 ice1000 added the type/question Type: Issue - Question label Oct 20, 2018
@Hoverbear
Copy link
Contributor

Already fixed in master quite some time ago:

const SLOG_CHANNEL_OVERFLOW_STRATEGY: OverflowStrategy = OverflowStrategy::Block;
macro_rules! fatal {
($lvl:expr, $($arg:tt)+) => ({
if LOG_INITIALIZED.load(Ordering::SeqCst) {
error!($lvl, $($arg)+);
} else {
eprintln!($lvl, $($arg)+);
}
process::exit(1)
})
}
#[allow(dead_code)]
pub fn init_log(config: &TiKvConfig) -> GlobalLoggerGuard {
let log_rotation_timespan = chrono::Duration::from_std(
config.log_rotation_timespan.clone().into(),
).expect("config.log_rotation_timespan is an invalid duration.");
let guard = if config.log_file.is_empty() {
let decorator = TermDecorator::new().build();
let drain = logger::TikvFormat::new(decorator).fuse();
let drain = Async::new(drain)
.chan_size(SLOG_CHANNEL_SIZE)
.overflow_strategy(SLOG_CHANNEL_OVERFLOW_STRATEGY)

@overvenus
Copy link
Member Author

overvenus commented Nov 6, 2018

Block strategy only appiles to term-slogger. file-slogger still uses OverflowStrategy::DropAndReport.

@overvenus overvenus reopened this Nov 6, 2018
@Hoverbear
Copy link
Contributor

Ah, of course!

@hicqu
Copy link
Contributor

hicqu commented Nov 8, 2018

Why not remove redudant logs? For example, CompactLog is print too frequently.

@Hoverbear
Copy link
Contributor

@hicqu We don't ever want to drop logs (this is a bug). Removing redundant logs is a feature request, and can have it's own issue. :)

@Hoverbear Hoverbear added type/bug Type: Issue - Confirmed a bug and removed type/question Type: Issue - Question labels Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Type: Issue - Confirmed a bug
Projects
None yet
Development

No branches or pull requests

4 participants