make 500K files also seedable (because they actually are) (#9077)

This commit is contained in:
Alex Sharov 2023-12-25 10:07:31 +07:00 committed by GitHub
parent ab4a00ffb9
commit bc50bd50a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,6 +164,7 @@ const Erigon3SeedableSteps = 32
// - avoiding having too much files:
// more files(shards) - means "more metadata", "more lookups for non-indexed queries", "more dictionaries", "more bittorrent connections", ...
// less files - means small files will be removed after merge (no peers for this files).
const Erigon2OldMergeLimit = 500_000
const Erigon2MergeLimit = 100_000
const Erigon2MinSegmentSize = 1_000
@ -178,9 +179,11 @@ type FileInfo struct {
}
func (f FileInfo) TorrentFileExists() bool { return dir.FileExist(f.Path + ".torrent") }
func (f FileInfo) Seedable() bool { return f.To-f.From == Erigon2MergeLimit }
func (f FileInfo) NeedTorrentFile() bool { return f.Seedable() && !f.TorrentFileExists() }
func (f FileInfo) Name() string { return filepath.Base(f.Path) }
func (f FileInfo) Seedable() bool {
return f.To-f.From == Erigon2MergeLimit || f.To-f.From == Erigon2OldMergeLimit
}
func (f FileInfo) NeedTorrentFile() bool { return f.Seedable() && !f.TorrentFileExists() }
func (f FileInfo) Name() string { return filepath.Base(f.Path) }
func IdxFiles(dir string) (res []FileInfo, err error) { return FilesWithExt(dir, ".idx") }
func Segments(dir string) (res []FileInfo, err error) { return FilesWithExt(dir, ".seg") }