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

xlog回写时关闭进程可能会丢日志 #1328

Open
ircc opened this issue Feb 12, 2025 · 0 comments
Open

xlog回写时关闭进程可能会丢日志 #1328

ircc opened this issue Feb 12, 2025 · 0 comments

Comments

@ircc
Copy link

ircc commented Feb 12, 2025

Image
对应代码:

从代码看,xlog回写日志逻辑:

  1. 先从mmap读到内存(Flush)
  2. 然后清空mmap(Flush->__Clear)
  3. 再写到xlog日志文件中(__Log2File)

在进行到第3步时实际数据只在内存中有,而且__Log2File内是有锁的,如果在等待过程中进程crash或者被杀掉了,日志就会丢失

Image

void XloggerAppender::__Log2File(const void* _data, size_t _len, bool _move_file) {

@ircc ircc changed the title xlog回写时结进程可能会丢日志 xlog回写时关闭进程可能会丢日志 Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant