Skip to content

fix bug when sync meta data in mysql - #599

Merged
wonderflow merged 2 commits into
qiniu:masterfrom
redHJ:sqlmetabug
Jul 12, 2018
Merged

wonderflow merged 2 commits into
qiniu:masterfrom
redHJ:sqlmetabug

Conversation

@redHJ

@redHJ redHJ commented Jul 11, 2018

Copy link
Copy Markdown
Collaborator

@redHJ
redHJ force-pushed the sqlmetabug branch 14 times, most recently from 4d0e2bf to ad5965c Compare July 12, 2018 07:17
Comment thread reader/sql/sql.go Outdated
recordTablesDone.restoreTableDone(r.meta, curDB, tables)
r.muxSyncRecords.Lock()
r.syncRecords.SetTableRecords(curDB, recordTablesDone)
r.muxSyncRecords.Unlock()

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.

这个锁放在syncRecords里面

Comment thread reader/sql/sql.go Outdated
//SyncMeta 从队列取数据时同步队列,作用在于保证数据不重复。
func (r *Reader) SyncMeta() {
r.muxSyncRecords.Lock()
defer r.muxSyncRecords.Unlock()

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.

需要这么大粒度吗?

锁的范围越小越好,因为有锁就代表性能可能会有问题

@wonderflow

Copy link
Copy Markdown
Contributor

LGTM

@wonderflow
wonderflow merged commit a88b397 into qiniu:master Jul 12, 2018
@redHJ
redHJ deleted the sqlmetabug branch January 10, 2019 06:12
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