mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Revert "core/rawdb: add logging and fix comments around AncientRange function. (#28379)"
This reverts commit f81a9f3eda.
This commit is contained in:
parent
a674f74e80
commit
701f6aecbd
2 changed files with 10 additions and 16 deletions
|
|
@ -334,19 +334,14 @@ func ReadHeaderRange(db ethdb.Reader, number uint64, count uint64) []rlp.RawValu
|
||||||
return rlpHeaders
|
return rlpHeaders
|
||||||
}
|
}
|
||||||
// read remaining from ancients
|
// read remaining from ancients
|
||||||
data, err := db.AncientRange(ChainFreezerHeaderTable, i+1-count, count, 0)
|
max := count * 700
|
||||||
if err != nil {
|
data, err := db.AncientRange(ChainFreezerHeaderTable, i+1-count, count, max)
|
||||||
log.Error("Failed to read headers from freezer", "err", err)
|
if err == nil && uint64(len(data)) == count {
|
||||||
return rlpHeaders
|
// the data is on the order [h, h+1, .., n] -- reordering needed
|
||||||
}
|
|
||||||
if uint64(len(data)) != count {
|
|
||||||
log.Warn("Incomplete read of headers from freezer", "wanted", count, "read", len(data))
|
|
||||||
return rlpHeaders
|
|
||||||
}
|
|
||||||
// The data is on the order [h, h+1, .., n] -- reordering needed
|
|
||||||
for i := range data {
|
for i := range data {
|
||||||
rlpHeaders = append(rlpHeaders, data[len(data)-1-i])
|
rlpHeaders = append(rlpHeaders, data[len(data)-1-i])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return rlpHeaders
|
return rlpHeaders
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,10 +119,9 @@ func (f *ResettableFreezer) Ancient(kind string, number uint64) ([]byte, error)
|
||||||
|
|
||||||
// AncientRange retrieves multiple items in sequence, starting from the index 'start'.
|
// AncientRange retrieves multiple items in sequence, starting from the index 'start'.
|
||||||
// It will return
|
// It will return
|
||||||
// - at most 'count' items,
|
// - at most 'max' items,
|
||||||
// - if maxBytes is specified: at least 1 item (even if exceeding the maxByteSize),
|
// - at least 1 item (even if exceeding the maxByteSize), but will otherwise
|
||||||
// but will otherwise return as many items as fit into maxByteSize.
|
// return as many items as fit into maxByteSize
|
||||||
// - if maxBytes is not specified, 'count' items will be returned if they are present.
|
|
||||||
func (f *ResettableFreezer) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error) {
|
func (f *ResettableFreezer) AncientRange(kind string, start, count, maxBytes uint64) ([][]byte, error) {
|
||||||
f.lock.RLock()
|
f.lock.RLock()
|
||||||
defer f.lock.RUnlock()
|
defer f.lock.RUnlock()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue