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

Optimize XidtoUID map used by live and bulk loader #2998

Merged
merged 11 commits into from
Feb 11, 2019
Prev Previous commit
Next Next commit
Martin's review
manishrjain committed Feb 11, 2019
commit 071826d03514d3080fae0a7a7038e9fcec7d47a0
4 changes: 2 additions & 2 deletions xidmap/xidmap.go
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ type block struct {
start, end uint64
}

// This must already have a write lock.
// assign assumes the write lock is already acquired.
func (b *block) assign(ch <-chan *pb.AssignedIds) uint64 {
if b.end == 0 || b.start > b.end {
newRange := <-ch
@@ -195,7 +195,7 @@ func (m *XidMap) updateMaxSeen(max uint64) {
}

// BumpTo can be used to make Zero allocate UIDs up to this given number. Attempts are made to
// ensure all future allocations of UIDs be higher than this one, but result is not guaranteed.
// ensure all future allocations of UIDs be higher than this one, but results are not guaranteed.
func (m *XidMap) BumpTo(uid uint64) {
curMax := atomic.LoadUint64(&m.maxUidSeen)
if uid <= curMax {