Skip to content

Commit f2a4b40

Browse files
authored
Fix Shutdown for Archive (#301)
* use actorpool, custom smol executor * cleanup * migrations * simplify type arguments for all structs * finish cleaning up type arguments * use coil master * migrations for coil changes * dont continue on empty * some tweaks/cleanup * troubleshooting shutdown * adding test for missing_storage query * paginate storage restoration * update substrate/polkadot * create function for converting hex to integer in sql * add runtime features for polkadot-archive * use coil from crates * add offline sql * make tests pass * cancel storage restoration on Ctrl-C * cleanup * cleanup * query format * sqlx-data for offline compilation * troubleshoot shutdown * lints & paginate query * offline sqlx * fix shutdown * make pagination a stream * cleanup * update locked dependencies * remove tasks vector in Actors struct * bump xtra to 0.5 * fix comment on tick_interval * spacing * update lockfiles * fix lint * use coil on crates * fix changes during merge * fix spawn & kill listener in Drop * add back deny dead_code * remove debug log * fix tests * clippy lints * moar clippy lints
1 parent 36d955d commit f2a4b40

File tree

20 files changed

+189
-420
lines changed

20 files changed

+189
-420
lines changed

CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,25 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
10+
### Changed
11+
- Use `async-std` instead of `smol` for async tasks. ([#301](https://github.com/paritytech/substrate-archive/pull/301))
12+
13+
### Removed
14+
- **BREAKING** `max_tasks` from builder. Max tasks will always be the number of CPUS on the system. ([#301](https://github.com/paritytech/substrate-archive/pull/301))
15+
- **BREAKING** `task_workers` from builder. Task workers will always be number of CPUS on the system.([#301](https://github.com/paritytech/substrate-archive/pull/301))
16+
17+
### Fixed
18+
- archive no longer hangs on Ctrl-C. ([#301](https://github.com/paritytech/substrate-archive/pull/301))
19+
920
## [v0.5.2] - 2021-06-02
1021
### Added
1122
- Test for tracing enabled wasm-blobs `v0.9.0`, `v0.9.1`, `v0.9.2`, `v0.9.3` ([#284](https://github.com/paritytech/substrate-archive/pull/284)) ([cd6a446](https://github.com/paritytech/substrate-archive/commit/cd6a446bc66002d1945cbdf0c1b39957218f90fd))
1223
- Unit testing CI workflow ([#288](https://github.com/paritytech/substrate-archive/pull/288)) ([482af68](https://github.com/paritytech/substrate-archive/commit/482af68fff515a7e3a34ee0c512d735790193cd6))
1324

1425
### Changed
1526
- Clarify release checklist ([#279](https://github.com/paritytech/substrate-archive/pull/279)) ([9abef6e](https://github.com/paritytech/substrate-archive/commit/9abef6e2bdda4c1492b6e232ec38c8c0d59a3749)) && ([#288](https://github.com/paritytech/substrate-archive/pull/288)) ([482af68](https://github.com/paritytech/substrate-archive/commit/482af68fff515a7e3a34ee0c512d735790193cd6))
16-
- Update dependencies to match runtime `0.9.3`.
27+
- Update dependencies to match runtime `0.9.3`.
1728
- Refactor tracing to work with the latest tracing changes in substrate ([#273](https://github.com/paritytech/substrate-archive/pull/273)) ([b322ded](https://github.com/paritytech/substrate-archive/commit/b322ded5cf683270da6d21478e80c9f4dba706dc))
1829

1930
### Fixed

Cargo.lock

Lines changed: 3 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/node-template-archive/archive.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ task_workers = 8
5757
# Optional, default: 20 seconds
5858
task_timeout = 20
5959

60-
# Maximum number of tasks to queue in the threadpool.
61-
# Optional, default: 64
62-
max_tasks = 64
63-
6460
# Maximium number of blocks to load and insert into database at a time.
6561
# Useful for controlling memory usage.
6662
# Optional, defaults: 100,000

bin/polkadot-archive/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
### Removed
10+
- `max_tasks` from toml configuration file. ([#301](https://github.com/paritytech/substrate-archive/pull/301))
11+
- `task_workers` from toml configuration file. ([#301](https://github.com/paritytech/substrate-archive/pull/301))
912

1013
## [0.2.4]
1114
### Changed

bin/polkadot-archive/Cargo.lock

Lines changed: 3 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/polkadot-archive/archive.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,10 @@ std = "DEBUG"
5353
#
5454
# Changing these may lead to unexpected results.
5555
[control]
56-
# Number of threads to dedicate for executing tasks
57-
# Optional, default: the number of logical system threads
58-
task_workers = 8
59-
6056
# Timeout to wait for a task to start execution.
6157
# Optional, default: 20 seconds
6258
task_timeout = 20
6359

64-
# Maximum number of tasks to queue in the threadpool.
65-
# Optional, default: 64
66-
max_tasks = 64
67-
6860
# Maximium number of blocks to load and insert into database at a time.
6961
# Useful for controlling memory usage.
7062
# Optional, defaults: 100,000

substrate-archive-backend/src/frontend.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ where
148148
}
149149

150150
pub fn runtime_api<Block, Runtime, Dispatch, D: ReadOnlyDb + 'static>(
151-
db: Arc<D>,
152151
config: RuntimeConfig,
152+
backend: Arc<ReadOnlyBackend<Block, D>>,
153153
) -> Result<TArchiveClient<Block, Runtime, Dispatch, D>, BackendError>
154154
where
155155
Block: BlockT,
@@ -162,8 +162,6 @@ where
162162
Dispatch: NativeExecutionDispatch + 'static,
163163
<Runtime::RuntimeApi as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
164164
{
165-
let backend = Arc::new(ReadOnlyBackend::new(db, true, config.storage_mode));
166-
167165
let executor = NativeExecutor::<Dispatch>::new(config.exec_method.into(), config.wasm_pages, config.block_workers);
168166
let executor =
169167
LocalCallExecutor::new(backend.clone(), executor, Box::new(TaskExecutor::new()), config.try_into()?)?;

0 commit comments

Comments
 (0)