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

bug: Delete the tianmu.log file, it cannot be created automatically #1571

Open
2 of 3 tasks
davidshiz opened this issue Apr 17, 2023 · 6 comments
Open
2 of 3 tasks

bug: Delete the tianmu.log file, it cannot be created automatically #1571

davidshiz opened this issue Apr 17, 2023 · 6 comments
Assignees
Labels
A-bug Something isn't working good first issue Good for newcomers

Comments

@davidshiz
Copy link
Collaborator

davidshiz commented Apr 17, 2023

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

  • I confirm there is no existing issue for this

Describe the problem

../install/log/tianmu.log

Expected behavior

should automatically create log file

How To Reproduce

No response

Environment

No response

Are you interested in submitting a PR to solve the problem?

  • Yes, I will!
@davidshiz davidshiz added the A-bug Something isn't working label Apr 17, 2023
@davidshiz davidshiz added this to the StoneDB_5.7_v1.0.4 milestone Apr 17, 2023
@davidshiz davidshiz added the good first issue Good for newcomers label Apr 17, 2023
@chenshengjiang
Copy link
Collaborator

ACK

@duanjr
Copy link
Contributor

duanjr commented May 11, 2023

Is this feature is wanted?
And is anyone working on this?

@davidshiz
Copy link
Collaborator Author

davidshiz commented May 29, 2023

When deleted mysqld.log it will be created automatically
tianmu.log should created automatically when deleted.

@adofsauron
Copy link
Collaborator

这个功能无论谁做,有以下几个点需要注意:

  1. 不要在每次写日志操作前做日志文件是否存在的检测,这样会导致当日志文件存在时大量的对文件状态的检测函数的调用
  2. 正确的做法是每次写日志操作后, 检测系统调用的返回码errno,当errno给出的错误信息是文件不存在时, 创建日志文件, 并重写日志
  3. 当创建日志文件出错时,考虑重试策略并考虑重试几次才合理
  4. 当写日志失败, 内核给出的errno为文件不存在,则创建文件,为其他错误,则做详细上下文信息记录用来追踪问题

@chenshengjiang
Copy link
Collaborator

chenshengjiang commented May 31, 2023

If delete tianmu.log while mysqld is running, it will create tianmu.log automatically after restarting mysqld, same sa mysqld.log.
When mysqld is running, mysqld always keeps the log files open, it will not detect if the log files exist or not until it start next time.
So we think it is not a bug.

@chenshengjiang
Copy link
Collaborator

Tianmu uses std::ofstream to write logs, when mysqld starts, if no log file, the object of std::ofstream will create one automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-bug Something isn't working good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

6 participants