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

fix leveldb mount bug #642

Merged
merged 2 commits into from
May 3, 2018
Merged

fix leveldb mount bug #642

merged 2 commits into from
May 3, 2018

Conversation

whynotAC
Copy link
Contributor

@whynotAC whynotAC commented May 3, 2018

index--->leveldb

operation:

unmount volume(vid=3)
mount volume(vid=3)
error:
I0502 16:02:19 03815 disk_location.go:59] new volume 3.dat error resource temporarily unavailable

fix:

add l.volumes[vid].close() in file storage/disk_location.go line 171 before delete(l.volumes, vid);

@@ -168,6 +168,7 @@ func (l *DiskLocation) UnloadVolume(vid VolumeId) error {
if !ok {
return fmt.Errorf("Volume not loaded, VolumeId: %d", vid)
}
l.volumes[vid].Close()
Copy link
Collaborator

Choose a reason for hiding this comment

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

use the volume variable ignored at line 167.

fix leveldb mount bug
@chrislusf chrislusf merged commit 63c4884 into seaweedfs:master May 3, 2018
@chrislusf
Copy link
Collaborator

thanks!

@whynotAC
Copy link
Contributor Author

whynotAC commented May 3, 2018

use leveldb index. but after loading leveldb database, you use Btree statistics zhe deleted file size,wo don't think this is a good way.

when I loading 100 million index,Btree will use 3.6G memory,and GC don't work well。

but in my filesystem, don't care the deleted file size, so I ingore the Btree Code.

I know the deleted file size will influences Compact.

@chrislusf
Copy link
Collaborator

Not very clear about what you mean. Maybe let me see what you have changed in code.

@whynotAC
Copy link
Contributor Author

whynotAC commented May 9, 2018

func doLoading(file *os.File, nm NeedleMap, flag bool) (NeedleMap, error) {
e := WalkIndexFile(file, func(key uint64, offset, size uint32) error {
if key > nm.MaximumFileKey {
nm.MaximumFileKey = key
}
if offset > 0 && size != TombstoneFileSize {
nm.FileCounter++
nm.FileByteCounter = nm.FileByteCounter + uint64(size)
if flag {
oldOffset, oldSize := nm.m.Set(needle.Key(key), offset, size)
glog.V(3).Infoln("reading key", key, "offset", offset
NeedlePaddingSize, "size", size, "oldSize", oldSize)
if oldOffset > 0 && oldSize != TombstoneFileSize {
nm.DeletionCounter++
nm.DeletionByteCounter = nm.DeletionByteCounter + uint64(oldSize)
}
}
} else {
oldSize := nm.m.Delete(needle.Key(key))
glog.V(3).Infoln("removing key", key, "offset", offset
NeedlePaddingSize, "size", size, "oldSize", oldSize)
nm.DeletionCounter++
nm.DeletionByteCounter = nm.DeletionByteCounter + uint64(oldSize)
}
return nil
})
glog.V(1).Infof("max file key: %d for file: %s", nm.MaximumFileKey, file.Name())
return nm, e
}

add parameter flag in function doLoading,if index--->leveldb/boltdb,flag--->flase;other, flag-->true

chrislusf added a commit that referenced this pull request May 9, 2018
@chrislusf
Copy link
Collaborator

right. need a way to do metrics better.

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