Skip to content

reader/cloudtrail: improve sync process - #698

Merged
wonderflow merged 1 commit into
qiniu:masterfrom
unknwon:PDR-7022-cloudtrail-improve
Aug 8, 2018
Merged

wonderflow merged 1 commit into
qiniu:masterfrom
unknwon:PDR-7022-cloudtrail-improve

Conversation

@unknwon

@unknwon unknwon commented Aug 7, 2018 •

Copy link
Copy Markdown
Contributor

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

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

@unknwon

unknwon commented Aug 8, 2018 •

Copy link
Copy Markdown
Contributor Author

已实测:

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

Comment thread reader/cloudtrail/cloudtrail.go Outdated
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
Copy Markdown
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文件?考虑到文件可能会很多

Comment thread reader/cloudtrail/cloudtrail.go Outdated
doneChan := make(chan struct{})
go func() {
for file := range syncedChan {
syncedFiles[file] = true

Copy link
Copy Markdown
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
Copy Markdown
Contributor

LGTM

@wonderflow

Copy link
Copy Markdown
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