mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
core/rawdb: several fixes
This commit is contained in:
parent
3049d138b7
commit
a33bba4773
3 changed files with 6 additions and 5 deletions
|
|
@ -210,7 +210,7 @@ func (batch *freezerTableBatch) commit() error {
|
|||
// Periodically sync the table, todo (rjl493456442) make it configurable?
|
||||
if time.Since(batch.t.lastSync) > 30*time.Second {
|
||||
batch.t.lastSync = time.Now()
|
||||
return batch.t.syncWithNoLock()
|
||||
return batch.t.Sync()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import (
|
|||
const (
|
||||
freezerTableV1 = 1 // Initial version of metadata struct
|
||||
freezerTableV2 = 2 // Add field: 'flushOffset'
|
||||
freezerVersion = freezerTableV2 // The current used version
|
||||
)
|
||||
|
||||
// freezerTableMeta is a collection of additional properties that describe the
|
||||
|
|
@ -164,7 +165,7 @@ func (m *freezerTableMeta) write(sync bool) error {
|
|||
Offset uint64
|
||||
}
|
||||
var o obj
|
||||
o.Version = freezerTableV2 // forcibly set it to v2
|
||||
o.Version = freezerVersion // forcibly use the current version
|
||||
o.Tail = m.virtualTail
|
||||
o.Offset = m.flushOffset
|
||||
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ func (t *freezerTable) repair() error {
|
|||
// offset is updated, leaving a dangling reference that points to a position
|
||||
// outside the file. If so, the offset will be reset to the new end of the
|
||||
// file during the next run.
|
||||
if t.metadata.flushOffset < uint64(newOffset) {
|
||||
if t.metadata.flushOffset > uint64(newOffset) {
|
||||
if err := t.metadata.setFlushOffset(uint64(newOffset), true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue