Commit Graph

139 Commits

Author SHA1 Message Date
Aarsh Shah
d7076778e2
integrate DAG store and CARv2 in deal-making (#6671)
This commit removes badger from the deal-making processes, and
moves to a new architecture with the dagstore as the cental
component on the miner-side, and CARv2s on the client-side.

Every deal that has been handed off to the sealing subsystem becomes
a shard in the dagstore. Shards are mounted via the LotusMount, which
teaches the dagstore how to load the related piece when serving
retrievals.

When the miner starts the Lotus for the first time with this patch,
we will perform a one-time migration of all active deals into the
dagstore. This is a lightweight process, and it consists simply
of registering the shards in the dagstore.

Shards are backed by the unsealed copy of the piece. This is currently
a CARv1. However, the dagstore keeps CARv2 indices for all pieces, so
when it's time to acquire a shard to serve a retrieval, the unsealed
CARv1 is joined with its index (safeguarded by the dagstore), to form
a read-only blockstore, thus taking the place of the monolithic
badger.

Data transfers have been adjusted to interface directly with CARv2 files.
On inbound transfers (client retrievals, miner storage deals), we stream
the received data into a CARv2 ReadWrite blockstore. On outbound transfers
(client storage deals, miner retrievals), we serve the data off a CARv2
ReadOnly blockstore.

Client-side imports are managed by the refactored *imports.Manager
component (when not using IPFS integration). Just like it before, we use
the go-filestore library to avoid duplicating the data from the original
file in the resulting UnixFS DAG (concretely the leaves). However, the
target of those imports are what we call "ref-CARv2s": CARv2 files placed
under the `$LOTUS_PATH/imports` directory, containing the intermediate
nodes in full, and the leaves as positional references to the original file
on disk.

Client-side retrievals are placed into CARv2 files in the location:
`$LOTUS_PATH/retrievals`.

A new set of `Dagstore*` JSON-RPC operations and `lotus-miner dagstore`
subcommands have been introduced on the miner-side to inspect and manage
the dagstore.

Despite moving to a CARv2-backed system, the IPFS integration has been
respected, and it continues to be possible to make storage deals with data
held in an IPFS node, and to perform retrievals directly into an IPFS node.

NOTE: because the "staging" and "client" Badger blockstores are no longer
used, existing imports on the client will be rendered useless. On startup,
Lotus will enumerate all imports and print WARN statements on the log for
each import that needs to be reimported. These log lines contain these
messages:

- import lacks carv2 path; import will not work; please reimport
- import has missing/broken carv2; please reimport

At the end, we will print a "sanity check completed" message indicating
the count of imports found, and how many were deemed broken.

Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>

Co-authored-by: Raúl Kripalani <raul@protocol.ai>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>
2021-08-16 23:34:32 +01:00
frrist
ca697c9aa2 feat(miner deals): create subdir to miner repo for staged deals 2021-07-29 21:08:38 -07:00
Raúl Kripalani
3144da86f3 add RepoType#String; adjust repo parsing logic. 2021-07-29 13:49:51 +01:00
Raúl Kripalani
4e19d8d562 support MARKETS_API_INFO env var; support markets-repo, markets-api-url flags. 2021-07-29 10:55:37 +01:00
Peter Rabbitson
4830a3406b Introduce the LOTUS_CHAIN_BADGERSTORE_DISABLE_FSYNC envvar
Allows the user to control the opts.SyncWrites option of BadgerDs
2021-07-21 22:38:14 +02:00
Łukasz Magiera
260ddacc47 Fix wallet import cycle, better trash key backup 2021-03-09 16:52:51 +01:00
jennijuju
49c44b70c2 Aftering importing a previously deleted key, be able to delete it again.
Co-authored-by: Aayush Rajasekaran <arajasek94@gmail.com>
2021-03-09 16:43:01 +01:00
vyzo
0fc2f3a26f fix post-rebase compilation errors 2021-03-05 14:46:18 +02:00
vyzo
a586d42c3b make hot store DI injectable in the split store, default to badger. 2021-03-05 14:46:17 +02:00
vyzo
622b4f7d9d hook splitstore into DI 2021-03-05 14:46:17 +02:00
Raúl Kripalani
3795cc2bd2 segregate chain and state blockstores.
This paves the way for better object lifetime management.

Concretely, it makes it possible to:
- have different stores backing chain and state data.
- having the same datastore library, but using different parameters.
- attach different caching layers/policies to each class of data, e.g.
  sizing caches differently.
- specifying different retention policies for chain and state data.

This separation is important because:
- access patterns/frequency of chain and state data are different.
- state is derivable from chain, so one could never expunge the chain
  store, and only retain state objects reachable from the last finality
  in the state store.
2021-02-28 22:49:44 +00:00
Raúl Kripalani
7f0f7d0b36 Merge branch 'master' into refactor/lib/blockstore 2021-02-28 19:55:23 +00:00
Raúl Kripalani
d1104fec4c rename blockstores for consistency. 2021-01-29 23:17:25 +00:00
Raúl Kripalani
b0cbc932bd consolidate all blockstores in blockstore package. 2021-01-29 20:01:00 +00:00
Raúl Kripalani
a1da1dab85 add context to LockedRepo#Datastore(). 2021-01-26 11:01:43 +00:00
Peter Rabbitson
47141042b6
Add comment
Co-authored-by: raulk <raul@protocol.ai>
2021-01-12 18:11:18 +01:00
Peter Rabbitson
9334e73396 Snake a context through the Chain-blockstore creation 2021-01-04 15:27:52 +01:00
Raúl Kripalani
2ef8acdfc8 back out index cache usage in badger blockstore. 2020-12-02 21:35:13 +00:00
Raúl Kripalani
e8a5e0d2fe integrate memory watchdog; impose limits on badger caches. 2020-12-02 16:40:28 +00:00
Raúl Kripalani
44040f0f3f badger options: enable IndexCache and CompactL0OnClose. 2020-11-20 00:33:43 +00:00
Raúl Kripalani
55061ae6fb fix blockstore directory not created automatically. 2020-11-19 15:55:02 +00:00
Peter Rabbitson
7be7a9b5e3 Stop referring to github.com/ipfs/go-ipfs-blockstore outside of lib 2020-11-12 06:01:35 +01:00
Raúl Kripalani
3577300aee Merge branch 'master' into badger-viewable 2020-11-06 19:34:25 +00:00
Raúl Kripalani
0b2a02c8ea remove redundant import. 2020-11-06 18:57:04 +00:00
Raúl Kripalani
85e37e4b70 make the value log loading mode mmap, to leverage zero-copy access. 2020-11-06 18:39:08 +00:00
Raúl Kripalani
0b8a21ee16 badger: restore prev. max table size (64MiB; default). 2020-11-01 17:26:37 +00:00
Raúl Kripalani
72e573d98d fix lint. 2020-11-01 17:09:14 +00:00
Raúl Kripalani
5a98660d1b make repo.Blockstore() idempotent; wrap in IDStore. 2020-11-01 16:56:20 +00:00
Raúl Kripalani
d8d85373f5 fix lotus-shed datastore commands. 2020-11-01 13:50:41 +00:00
Raúl Kripalani
a16d7f221e Merge branch 'master' into badger-viewable 2020-11-01 13:10:56 +00:00
Raúl Kripalani
d2e2322fd2 make the lotus node use the new native badger blockstore. 2020-11-01 13:01:26 +00:00
Jakub Sztandera
0297be4b9a
Add lotus-shed datastore rewrite command
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-28 23:24:45 +01:00
Jakub Sztandera
ecc1d94b3a
Reduce badger ValueTreshold to 128
It should significntly size of the LSM index, and thus increase the
performance with bigger datastores

Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-10-28 22:17:01 +01:00
Łukasz Magiera
8783c7434e Merge remote-tracking branch 'origin/master' into feat/signing-backends 2020-10-09 00:50:41 +02:00
Łukasz Magiera
9b5a0815fc backup: open datastores in readonly in offline mode 2020-10-01 17:55:47 +02:00
Aayush Rajasekaran
6abccc4d5e Add an option to set config 2020-09-30 03:19:04 -04:00
Frank
dcae513487 make nested dir 2020-09-14 16:49:35 +08:00
Łukasz Magiera
780f6dba34 Remote wallet backends 2020-09-05 21:39:09 +02:00
Jakub Sztandera
997d49b63f
Disable GC on chain badger datastore
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-09-01 20:39:58 +02:00
Raúl Kripalani
efdc428d5d keep storage-fsm (renamed to storage-sealing) and sector-storage in extern. 2020-08-17 14:26:18 +01:00
Raúl Kripalani
3c17cd655e integrate extern/sector-storage into lotus proper. 2020-08-16 11:09:58 +01:00
Łukasz Magiera
73b8868046 gofmt 2020-08-06 03:32:59 +02:00
Łukasz Magiera
f8b8ecc0c3 Consensus filter 2020-08-06 03:16:39 +02:00
hannahhoward
8e6862f7ca fix(lint): fix lint errors 2020-07-31 14:19:40 -07:00
hannahhoward
3cac1080cc feat(retrievalstoremgr): add retrievalstoremgr
add manager for retrievals to handle different cases for IPFS/non-ipfs
2020-07-31 14:16:18 -07:00
Łukasz Magiera
1fd23248ff gofmt 2020-07-28 16:38:26 +02:00
Łukasz Magiera
09b90773d8 Merge remote-tracking branch 'origin/next' into feat/cid-builder 2020-07-28 16:06:06 +02:00
hannahhoward
5a623cccb5 feat(markets): update markets mulitple deal stores 2020-07-27 23:13:28 -07:00
hannahhoward
dd885b7302 feat(multistore): extract multistore code to repo
Extract multistore + multiread blockstore to a seperate repo
2020-07-24 14:47:22 -07:00
Steven Allen
b7a4dbb07f Support inline CIDs
And use the new CidBuilder from the spec actors.

This patch does not switch over to inline CIDs by default, but paves the way.
2020-07-23 23:12:32 -07:00