Skip to content

Commit

Permalink
make 500K files also seedable (because they actually are) (#9077)
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored Dec 25, 2023
1 parent ab4a00f commit bc50bd5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions erigon-lib/downloader/snaptype/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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") }
Expand Down

0 comments on commit bc50bd5

Please sign in to comment.