mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add capability to assign a batch of file ids
git-svn-id: https://weed-fs.googlecode.com/svn/trunk@51 282b0af5-e82d-9cf1-ede4-77906d7719d0
This commit is contained in:
parent
68a216586f
commit
bcffffbc5e
|
@ -92,12 +92,12 @@ func (m *Mapper) NextFileId(c string) (uint64,int) {
|
||||||
}
|
}
|
||||||
count = 1
|
count = 1
|
||||||
}
|
}
|
||||||
|
m.sequenceLock.Lock()
|
||||||
|
defer m.sequenceLock.Unlock()
|
||||||
if m.fileIdCounter < count {
|
if m.fileIdCounter < count {
|
||||||
m.sequenceLock.Lock();
|
|
||||||
m.fileIdCounter = FileIdSaveInterval
|
m.fileIdCounter = FileIdSaveInterval
|
||||||
m.FileIdSequence += FileIdSaveInterval
|
m.FileIdSequence += FileIdSaveInterval
|
||||||
m.saveSequence()
|
m.saveSequence()
|
||||||
m.sequenceLock.Unlock();
|
|
||||||
}
|
}
|
||||||
m.fileIdCounter = m.fileIdCounter - count
|
m.fileIdCounter = m.fileIdCounter - count
|
||||||
return m.FileIdSequence - m.fileIdCounter, int(count)
|
return m.FileIdSequence - m.fileIdCounter, int(count)
|
||||||
|
|
Loading…
Reference in a new issue