File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,12 @@ const (
6666// reserving it for go-ethereum. This would also reduce the memory requirements
6767// of Geth, and thus also GC overhead.
6868type freezer struct {
69+ // WARNING: The `frozen` field is accessed atomically. On 32 bit platforms, only
70+ // 64-bit aligned fields can be atomic. The struct is guaranteed to be so aligned,
71+ // so take advantage of that (https://golang.org/pkg/sync/atomic/#pkg-note-BUG).
72+ frozen uint64 // Number of blocks already frozen
73+
6974 tables map [string ]* freezerTable // Data tables for storing everything
70- frozen uint64 // Number of blocks already frozen
7175 instanceLock fileutil.Releaser // File-system lock to prevent double opens
7276}
7377
Original file line number Diff line number Diff line change @@ -73,6 +73,11 @@ func (i *indexEntry) marshallBinary() []byte {
7373// It consists of a data file (snappy encoded arbitrary data blobs) and an indexEntry
7474// file (uncompressed 64 bit indices into the data file).
7575type freezerTable struct {
76+ // WARNING: The `items` field is accessed atomically. On 32 bit platforms, only
77+ // 64-bit aligned fields can be atomic. The struct is guaranteed to be so aligned,
78+ // so take advantage of that (https://golang.org/pkg/sync/atomic/#pkg-note-BUG).
79+ items uint64 // Number of items stored in the table (including items removed from tail)
80+
7681 noCompression bool // if true, disables snappy compression. Note: does not work retroactively
7782 maxFileSize uint32 // Max file size for data-files
7883 name string
@@ -86,7 +91,6 @@ type freezerTable struct {
8691
8792 // In the case that old items are deleted (from the tail), we use itemOffset
8893 // to count how many historic items have gone missing.
89- items uint64 // Number of items stored in the table (including items removed from tail)
9094 itemOffset uint32 // Offset (number of discarded items)
9195
9296 headBytes uint32 // Number of bytes written to the head file
Original file line number Diff line number Diff line change 9898)
9999
100100type Downloader struct {
101+ // WARNING: The `rttEstimate` and `rttConfidence` fields are accessed atomically.
102+ // On 32 bit platforms, only 64-bit aligned fields can be atomic. The struct is
103+ // guaranteed to be so aligned, so take advantage of that. For more information,
104+ // see https://golang.org/pkg/sync/atomic/#pkg-note-BUG.
105+ rttEstimate uint64 // Round trip time to target for download requests
106+ rttConfidence uint64 // Confidence in the estimated RTT (unit: millionths to allow atomic ops)
107+
101108 mode SyncMode // Synchronisation mode defining the strategy used (per sync cycle)
102109 mux * event.TypeMux // Event multiplexer to announce sync operation events
103110
@@ -109,9 +116,6 @@ type Downloader struct {
109116 stateDB ethdb.Database // Database to state sync into (and deduplicate via)
110117 stateBloom * trie.SyncBloom // Bloom filter for fast trie node existence checks
111118
112- rttEstimate uint64 // Round trip time to target for download requests
113- rttConfidence uint64 // Confidence in the estimated RTT (unit: millionths to allow atomic ops)
114-
115119 // Statistics
116120 syncStatsChainOrigin uint64 // Origin block number where syncing started at
117121 syncStatsChainHeight uint64 // Highest block number known when syncing started
You can’t perform that action at this time.
0 commit comments