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

reader/cloudtrail: improve sync process #698

Merged
merged 1 commit into from
Aug 8, 2018
Merged

reader/cloudtrail: improve sync process #698

merged 1 commit into from
Aug 8, 2018

Conversation

unknwon
Copy link
Contributor

@unknwon unknwon commented Aug 7, 2018

JIRA: https://jira.qiniu.io/browse/PDR-7022

1. 检查判断非法的 interval 和 concurrent 选项值
2. 优化日志打印
3. 修复 syncSingleFile 的 doneChan 消费者线程无法退出,每次 sync 就会泄露一个
4. sync 之后准确地返回哪些文件是真正完成 sync 了的,然后再写进入到 metastore 里
+5. 每当同步到一定数量的文件之后就写入到 metastore,降低丢失的概率

@unknwon
Copy link
Contributor Author

unknwon commented Aug 8, 2018

已实测:

  1. 正常完成读取
  2. sync 途中停止 runner

return nil
}

f, err := os.OpenFile(s.metastore, os.O_WRONLY|os.O_APPEND, 0644)
if err != nil {
return err
return fmt.Errorf("open metastore: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmt.Errorf("open metastore: %v, failed to sync files", err)

这里要不要打印一下没有syncd文件?考虑到文件可能会很多

doneChan := make(chan struct{})
go func() {
for file := range syncedChan {
syncedFiles[file] = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里改成拿到比如10个文件就同步写磁盘一次吧

@wonderflow
Copy link
Contributor

LGTM

@wonderflow
Copy link
Contributor

把Close() 方法里的2个Debug日志级别改成Info

@wonderflow wonderflow merged commit 27a1492 into qiniu:master Aug 8, 2018
@unknwon unknwon deleted the PDR-7022-cloudtrail-improve branch August 8, 2018 07:31
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

Successfully merging this pull request may close these issues.

2 participants