-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Splitstore Enhanchements #6474
Merged
Merged
Splitstore Enhanchements #6474
Changes from 166 commits
Commits
Show all changes
197 commits
Select commit
Hold shift + click to select a range
4d3c73f
noop blockstore
vyzo 5cca29d
hook noop blockstore for splitstore in DI
vyzo 04f2e10
kill full splitstore compaction, simplify splitstore configuration
vyzo e3cbeec
implement chain walking
vyzo d7ceef1
decrease CompactionThreshold to 3 finalities
vyzo 3a9b7c5
mark from current epoch to boundary epoch when necessary
vyzo b2b7eb2
metrics: increment misses in View().
raulk e9f531b
don't open bolt tracking store with NoSync, it might get corrupted
vyzo 7cf75e6
keep genesis-linked state hot
vyzo bdb97d6
more robust handling of sync gap walks
vyzo d33a44e
first visit the cid, then short-circuit non dagcbor objects
vyzo fda291b
fix test
vyzo fa64814
reduce SyncGapTime to 1 minute
vyzo 41573f1
also walk parent message receipts when including messages in the walk
vyzo 7c814cd
refactor genesis state loading code into its own method
vyzo 997f2c0
keep headers hot when running with a noop splitstore
vyzo 7b02673
don't try to visit genesis parent blocks
vyzo 3fe4261
don't attempt compaction while still syncing
vyzo 9b64485
refactor warmup to trigger at startup and not wait for sync
vyzo 421f05e
save the warm up epoch only if successful in warming up
vyzo bb17608
track writeEpoch relative to current wall clock time
vyzo 66f1630
fix lint issue
vyzo 933c786
update write epoch in the background every second
vyzo b789759
augment current epoch by +1
vyzo c4d95de
coalesce back-to-back compactions
vyzo a178c1f
fix test
vyzo a25ac80
reintroduce compaction slack
vyzo 79d2148
fix test
vyzo a21f559
CompactionThreshold should be 4 finalities
vyzo 30dbe49
adjust compaction range
vyzo 0390285
always do full walks, not only when there is a sync gap
vyzo fc247e4
add debug log skeleton
vyzo fce7b8d
flush move log when cold collection is done
vyzo a53c4e1
implement debug log
vyzo b187b5c
fix lint
vyzo 375a179
reset counters after flush
vyzo 50ebaf2
don't log read misses before warmup
vyzo 649b7dd
add config option for hot headers
vyzo cb665d0
fix transactional race during compaction
vyzo 65ccc99
minor tweaks in purge
vyzo 6af3a23
use a map for txn protection mark set
vyzo 31497f4
use internal get during walk to avoid blowing the compaction txn
vyzo 4a71c68
move code around for better readability
vyzo 9fda61a
fix error check for unreachable cids
vyzo 40ff5bf
log put errors in splitstore log
vyzo 7ebef6d
better log message
vyzo dec61fa
deduplicate stack logs and optionally trace write stacks
vyzo 0b315e9
fix index out of range
vyzo b2b13bb
fix debug panic
vyzo 57e25ae
use succint timetamp in debug logs
vyzo 7307eb5
cache stack repr computation
vyzo 4bed316
fix broken purge count log
vyzo e29b64c
check both markset and txn liveset before declaring an object cold
vyzo 7de0771
count txn live objects explicitly for logging
vyzo 09efed5
check for lookback references to block headers in walk
vyzo 40f42db
walk tweaks
vyzo 90dc274
better logging for chain walk
vyzo f97535d
store the hash in map markset
vyzo 6a3cbea
treat Has as an implicit Write
vyzo e472cac
add missing return
vyzo be6cc2c
batch implicit write tracking
vyzo a29947d
flush implicit writes in all paths in updateWriteEpoch
vyzo 7f473f5
flush implicit writes before starting compaction
vyzo d0bfe42
flush implicit writes at the right time before starting compaction to…
vyzo 3e8e927
track all writes using async batching, not just implicit ones
vyzo aeaa59d
move comments about tracking perf issues into a more pertinent place
vyzo 2faa4aa
debug log writes at track so that we get correct stack traces
vyzo b3ddaa5
fix panic at startup
vyzo 4de0cd9
move write log back to flush so that we don't crawl to a halt
vyzo 9828673
transitively track dags from implicit writes in Has
vyzo 13a6743
add pending write check before tracking the object in Has
vyzo a98a062
do the dag walk for deep write tracking during flush
vyzo bd92c23
refactor txn reference tracking, do deep marking of DAGs
vyzo 4071488
first write, then track
vyzo da00fc6
downgrade a couple of logs to warnings
vyzo 1d41e15
optimize transitive write tracking a bit
vyzo 484dfae
reused cidset across all walks when flushing pending writes
vyzo 9d6bcd7
avoid clown shoes: only walk links for tracking in implicit writes/refs
vyzo 637fbf6
fix faulty if/else logic for implicit txn protection
vyzo b87295d
bubble up dependent txn ref errors
vyzo 68bc5d2
skip moving cold blocks when running with a noop coldstore
vyzo e4bb4be
fix some residual purge races
vyzo 5834231
create the transactional protect filter before walking
vyzo 39723bb
use a single map for tracking pending writes, properly track implicits
vyzo 736d6a3
only treat Has as an implicit write within vm.Copy context
vyzo 8157f88
short-circuit marking walks when encountering a block and more effici…
vyzo 9d6cabd
if it's not a dag, it's not a block
vyzo 228a435
rework tracking logic; do it lazily and far more efficiently
vyzo 184d380
remove dead code
vyzo 2b03316
fix log message
vyzo 6f58fdc
remove vm copy context detection hack
vyzo d79e4da
more accurate stats about mark set updates
vyzo c5cf8e2
remove unnecessary code
vyzo 642f0e4
deal with memory pressure, don't walk under the boundary
vyzo 00fcf6d
add staging cache to bolt tracking store
vyzo 68a8350
fix bug that turned candidate filtering to dead code
vyzo d476a3d
BlockstoreIterator trait with implementation for badger
vyzo 1f2b604
RIP tracking store
vyzo 5f7ae1f
update splistore DI constructor
vyzo 6fa2cd2
simplify compaction model
vyzo 36f9364
fix panic from concurrent map writes in txnRefs
vyzo eafffc1
more efficient trackTxnRefMany
vyzo 08cad30
reuse key buffer in badger ForEachKey
vyzo 0a1d7b3
fix log
vyzo 19d1b1f
deal with partially written objects
vyzo 190cb18
housekeeping
vyzo 95c3aae
fix test
vyzo 8e56fff
walkChain should visit the genesis state root
vyzo 028a5c4
make test do something useful again
vyzo 2c7a89a
short-circuit rescanning on block headers
vyzo 1f02428
fix lint
vyzo 680af8e
use deep object walking for more robust handling of transactional ref…
vyzo 4d286da
fix error message
vyzo f124389
recursively protect all references
vyzo 13d612f
smarter trackTxnRefMany
vyzo 40c271c
sort cold objects before deleting
vyzo f33d4e7
simplify transactional protection logic
vyzo 94efae4
reduce length of critical section
vyzo b08e0b7
fix lint
vyzo db53859
reduce CompactionThreshold to 5 finalities
vyzo 1726eb9
deal with incomplete objects that need to be marked and protected
vyzo 3597192
remove the sleeps and busy loop more times when waiting for missing o…
vyzo 4c41f52
add warning for missing objects for marking for debug purposes
vyzo c81ae5f
add some comments about the missing business and anothre log
vyzo 839f7bd
only occur check for DAGs
vyzo 2ea2abc
short-circuit fil commitments
vyzo 918a7ec
a bit more fil commitment short-circuiting
vyzo 3ec834b
improve logs and error messages
vyzo d7709de
reduce memory pressure from marksets when the size is decreased
vyzo d8b8d75
readd minute delay before trying for missing objects
vyzo 0b7153b
use internal version of has for occurs checks
vyzo 59936ef
fix log
vyzo fa195be
get rid of ugly missing reference handling code
vyzo 59639a0
reinstate some better code for handling missing references.
vyzo 5a099b7
more commentary on the missing refs situation
vyzo af8cf71
handle all missing refs together
vyzo 73d0799
dont needlessly wait 1 min in first retry for missing refs
vyzo 3477d26
unify the two marksets
vyzo e859942
code cleanup: refactor txn state code into their own functions
vyzo bd436ab
make endTxnProtect idempotent
vyzo 51ab891
quiet linter
vyzo 2cbd3fa
make sure to nil everything in txnEndProtect
vyzo c6ad8fd
use walkObjectRaw for computing object weights
vyzo 525a2c7
use hashes as keys in weight map to avoid duplicate work
vyzo 0659235
cache cid strings in sort
vyzo bf7aeb3
optimize sort a tad
vyzo 55a9e0c
short-circuit block headers on sort weight computation
vyzo 169ab26
really optimize computing object weights
vyzo c4ae3e0
minor tweak
vyzo dc8139a
add some comments for debug only code
vyzo 5c51450
remove unused GetGenesis method from ChainAccessor interface
vyzo fdff1be
move map markset implementation to its own file
vyzo c1c2586
improve comments
vyzo f2f4af6
clean up: simplify debug log, get rid of ugly debug log
vyzo 0e2af11
prepare the transaction before launching the compaction goroutine
vyzo 90da622
transactional protect incoming tipsets
vyzo 05dbbe9
rename som Txn methods for better readability
vyzo 6cc2112
remove the curTs state variable; we don't need it
vyzo 83c30dc
protect assignment of warmup epoch with the mutex
vyzo 9dbb2e0
don't leak tracking errors through the API
vyzo 451ddf5
RIP bbolt-backed markset
vyzo ec586a8
remove bbolt dependency from go.mod
vyzo aec2ba2
nil map/bf on markset close
vyzo c6421f8
don't nil the mark sets on close, it's dangerous.
vyzo fee50b1
check the closing state on each batch during the purge.
vyzo 4f80836
fix lint
vyzo f5c45bd
check the closing state variable often
vyzo 48f13a4
intelligently close marksets and signal errors in concurrent operations
vyzo e6eacbd
use RW mutexes in marksets
vyzo 9aa4f3b
add README for documentation
vyzo 5cf1e09
README: add instructions for how to enable
vyzo 00d7772
move check for closure in walkChain
vyzo fa30ac8
fix typo
vyzo c053784
fix typo
vyzo 60dd97c
fix potential deadlock in View
vyzo b661112
add environment variables to turn on the debug log without recompiling
vyzo abdf4a1
explicitly switch marksets for concurrent marking
vyzo 909f703
make badger Close-safe
vyzo de5e21b
correctly handle identity cids
vyzo 4f89d26
kill isOldBlockHeader; it's dangerous.
vyzo 565faff
fix test
vyzo acc4c37
properly handle protecting long-running views
vyzo da0feb3
dont mark references inline; instad rely on the main compaction threa…
vyzo 095d742
make view protection optimistic again, as there is a race window
vyzo 18161fe
remove unused lookback constructs
vyzo c0a1cff
rename noopstore to discardstore
vyzo b9a5ea8
update wording around discard store
vyzo 4129038
fix test
vyzo f5ae10e
refactor debug log code to eliminate duplication
vyzo 870a47f
handle id cids in internal versions of view/get
vyzo 0c5e336
address review comments
vyzo df9670c
fix lint
vyzo 759594d
always return the waitgroup in protectView
vyzo 60212c8
put a mutex around HeadChange
vyzo 04abd19
nit: remove useless goto
Stebalien 257423e
fix view waiting issues with the WaitGroup
vyzo af39952
finetune view waiting
vyzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package blockstore | ||
|
||
import ( | ||
"context" | ||
"io" | ||
|
||
blocks "github.com/ipfs/go-block-format" | ||
cid "github.com/ipfs/go-cid" | ||
) | ||
|
||
var _ Blockstore = (*noopstore)(nil) | ||
|
||
type noopstore struct { | ||
vyzo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
bs Blockstore | ||
} | ||
|
||
func NewNoopStore(bs Blockstore) Blockstore { | ||
vyzo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return &noopstore{bs: bs} | ||
} | ||
|
||
func (b *noopstore) Has(cid cid.Cid) (bool, error) { | ||
return b.bs.Has(cid) | ||
} | ||
|
||
func (b *noopstore) HashOnRead(hor bool) { | ||
b.bs.HashOnRead(hor) | ||
} | ||
|
||
func (b *noopstore) Get(cid cid.Cid) (blocks.Block, error) { | ||
return b.bs.Get(cid) | ||
} | ||
|
||
func (b *noopstore) GetSize(cid cid.Cid) (int, error) { | ||
return b.bs.GetSize(cid) | ||
} | ||
|
||
func (b *noopstore) View(cid cid.Cid, f func([]byte) error) error { | ||
return b.bs.View(cid, f) | ||
} | ||
|
||
func (b *noopstore) Put(blk blocks.Block) error { | ||
return nil | ||
} | ||
|
||
func (b *noopstore) PutMany(blks []blocks.Block) error { | ||
return nil | ||
} | ||
|
||
func (b *noopstore) DeleteBlock(cid cid.Cid) error { | ||
return nil | ||
} | ||
|
||
func (b *noopstore) DeleteMany(cids []cid.Cid) error { | ||
return nil | ||
} | ||
|
||
func (b *noopstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) { | ||
return b.bs.AllKeysChan(ctx) | ||
} | ||
|
||
func (b *noopstore) Close() error { | ||
if c, ok := b.bs.(io.Closer); ok { | ||
return c.Close() | ||
} | ||
return nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note to self: it's OK to have end-to-end transactionality here because Badger implements concurrent transactions through MVCC and does not stop the world while this iterator is open AFAIK. (even if it were STW, it was OK in
AllKeysChan
because that method was never used in a production codepath; however,ForEachKey
is used in a production codepath, so it wouldn't be).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it doesn't seem to block anything from happening.