Skip to content

Commit 3862e7e

Browse files
authored
Merge pull request #5203 from Lezek123/colossus-move-bags
Colossus: leader:move-bags command
2 parents c169c69 + 0e6c801 commit 3862e7e

29 files changed

+2441
-223
lines changed

.github/workflows/run-network-tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,16 @@ jobs:
152152
runs-on: ubuntu-latest
153153
strategy:
154154
matrix:
155-
scenario: ['full', 'setupNewChain', 'setupNewChainMultiStorage', 'bonding', 'storageSync']
155+
scenario: ['full', 'setupNewChain', 'setupNewChainMultiStorage', 'bonding', 'storage']
156156
include:
157157
- scenario: 'full'
158158
no_storage: 'false'
159159
- scenario: 'setupNewChain'
160160
no_storage: 'true'
161161
- scenario: 'setupNewChainMultiStorage'
162162
no_storage: 'true'
163+
- scenario: 'storage'
164+
cleanup_interval: '1'
163165
steps:
164166
- uses: actions/checkout@v4
165167
- uses: actions/setup-node@v4
@@ -182,4 +184,5 @@ jobs:
182184
run: |
183185
export RUNTIME=${{ needs.build_images.outputs.runtime }}
184186
export NO_STORAGE=${{ matrix.no_storage }}
187+
export CLEANUP_INTERVAL=${{ matrix.cleanup_interval }}
185188
tests/network-tests/run-tests.sh ${{ matrix.scenario }}

docker-compose.yml

Lines changed: 46 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ services:
88
- chain-data:/data
99
environment:
1010
- CHAIN=${CHAIN}
11-
command: "--chain ${CHAIN:-dev} --alice --validator --pruning=archive --unsafe-ws-external --unsafe-rpc-external
12-
--rpc-methods Safe --rpc-cors=all --log runtime --base-path /data --no-hardware-benchmarks"
11+
command: '--chain ${CHAIN:-dev} --alice --validator --pruning=archive --unsafe-ws-external --unsafe-rpc-external
12+
--rpc-methods Safe --rpc-cors=all --log runtime --base-path /data --no-hardware-benchmarks'
1313
ports:
1414
- 9944:9944
1515
- 9933:9933
@@ -35,16 +35,25 @@ services:
3535
- ACCOUNT_URI=${COLOSSUS_1_TRANSACTOR_URI}
3636
- OTEL_EXPORTER_OTLP_ENDPOINT=${TELEMETRY_ENDPOINT}
3737
- OTEL_RESOURCE_ATTRIBUTES=service.name=colossus-1,deployment.environment=production
38+
- CLEANUP
39+
- CLEANUP_INTERVAL
40+
- CLEANUP_NEW_OBJECT_EXPIRATION_PERIOD
41+
- CLEANUP_MIN_REPLICATION_THRESHOLD
3842
entrypoint: ['/joystream/entrypoints/storage.sh']
39-
command: [
40-
'server', '--worker=${COLOSSUS_1_WORKER_ID}', '--port=3333', '--uploads=/data/uploads/',
41-
'--sync', '--syncInterval=1',
42-
'--storageSquidEndpoint=${COLOSSUS_STORAGE_SQUID_URL}',
43-
'--apiUrl=${JOYSTREAM_NODE_WS}',
44-
'--logFilePath=/logs',
45-
'--tempFolder=/data/temp/',
46-
'--pendingFolder=/data/pending/'
47-
]
43+
command:
44+
[
45+
'server',
46+
'--worker=${COLOSSUS_1_WORKER_ID}',
47+
'--port=3333',
48+
'--uploads=/data/uploads/',
49+
'--sync',
50+
'--syncInterval=1',
51+
'--storageSquidEndpoint=${COLOSSUS_STORAGE_SQUID_URL}',
52+
'--apiUrl=${JOYSTREAM_NODE_WS}',
53+
'--logFilePath=/logs',
54+
'--tempFolder=/data/temp/',
55+
'--pendingFolder=/data/pending/',
56+
]
4857

4958
distributor-1:
5059
image: node:18
@@ -68,7 +77,7 @@ services:
6877
environment:
6978
JOYSTREAM_DISTRIBUTOR__ID: distributor-1
7079
JOYSTREAM_DISTRIBUTOR__ENDPOINTS__STORAGE_SQUID: ${DISTRIBUTOR_STORAGE_SQUID_URL}
71-
JOYSTREAM_DISTRIBUTOR__KEYS: "[{\"suri\":\"${DISTRIBUTOR_1_ACCOUNT_URI}\"}]"
80+
JOYSTREAM_DISTRIBUTOR__KEYS: '[{"suri":"${DISTRIBUTOR_1_ACCOUNT_URI}"}]'
7281
JOYSTREAM_DISTRIBUTOR__WORKER_ID: ${DISTRIBUTOR_1_WORKER_ID}
7382
JOYSTREAM_DISTRIBUTOR__PUBLIC_API__PORT: 3334
7483
JOYSTREAM_DISTRIBUTOR__OPERATOR_API__PORT: 4334
@@ -105,22 +114,25 @@ services:
105114
environment:
106115
# ACCOUNT_URI overrides command line arg --accountUri
107116
- ACCOUNT_URI=${COLOSSUS_2_TRANSACTOR_URI}
108-
# Env that allows testing cleanup
109-
- CLEANUP_NEW_OBJECT_EXPIRATION_PERIOD=10
110-
- CLEANUP_MIN_REPLICATION_THRESHOLD=1
117+
- CLEANUP
118+
- CLEANUP_INTERVAL
119+
- CLEANUP_NEW_OBJECT_EXPIRATION_PERIOD
120+
- CLEANUP_MIN_REPLICATION_THRESHOLD
111121
entrypoint: ['yarn', 'storage-node']
112-
command: [
113-
'server', '--worker=${COLOSSUS_2_WORKER_ID}', '--port=3333', '--uploads=/data/uploads',
114-
'--sync', '--syncInterval=1',
115-
'--storageSquidEndpoint=${COLOSSUS_STORAGE_SQUID_URL}',
116-
'--apiUrl=${JOYSTREAM_NODE_WS}',
117-
'--logFilePath=/logs',
118-
'--tempFolder=/data/temp/',
119-
'--pendingFolder=/data/pending/',
120-
# Use cleanup on colossus-2 for testing purposes
121-
'--cleanup',
122-
'--cleanupInterval=1'
123-
]
122+
command:
123+
[
124+
'server',
125+
'--worker=${COLOSSUS_2_WORKER_ID}',
126+
'--port=3333',
127+
'--uploads=/data/uploads',
128+
'--sync',
129+
'--syncInterval=1',
130+
'--storageSquidEndpoint=${COLOSSUS_STORAGE_SQUID_URL}',
131+
'--apiUrl=${JOYSTREAM_NODE_WS}',
132+
'--logFilePath=/logs',
133+
'--tempFolder=/data/temp/',
134+
'--pendingFolder=/data/pending/',
135+
]
124136

125137
distributor-2:
126138
image: node:18
@@ -144,7 +156,7 @@ services:
144156
environment:
145157
JOYSTREAM_DISTRIBUTOR__ID: distributor-2
146158
JOYSTREAM_DISTRIBUTOR__ENDPOINTS__STORAGE_SQUID: ${DISTRIBUTOR_STORAGE_SQUID_URL}
147-
JOYSTREAM_DISTRIBUTOR__KEYS: "[{\"suri\":\"${DISTRIBUTOR_2_ACCOUNT_URI}\"}]"
159+
JOYSTREAM_DISTRIBUTOR__KEYS: '[{"suri":"${DISTRIBUTOR_2_ACCOUNT_URI}"}]'
148160
JOYSTREAM_DISTRIBUTOR__WORKER_ID: ${DISTRIBUTOR_2_WORKER_ID}
149161
JOYSTREAM_DISTRIBUTOR__PUBLIC_API__PORT: 3334
150162
JOYSTREAM_DISTRIBUTOR__OPERATOR_API__PORT: 4334
@@ -192,8 +204,8 @@ services:
192204
- OTEL_EXPORTER_OTLP_ENDPOINT=${TELEMETRY_ENDPOINT}
193205
- OTEL_RESOURCE_ATTRIBUTES=service.name=query-node,deployment.environment=production
194206
ports:
195-
- "${GRAPHQL_SERVER_PORT}:${GRAPHQL_SERVER_PORT}"
196-
- "127.0.0.1:${PROCESSOR_STATE_APP_PORT}:${PROCESSOR_STATE_APP_PORT}"
207+
- '${GRAPHQL_SERVER_PORT}:${GRAPHQL_SERVER_PORT}'
208+
- '127.0.0.1:${PROCESSOR_STATE_APP_PORT}:${PROCESSOR_STATE_APP_PORT}'
197209
depends_on:
198210
- db
199211
volumes:
@@ -275,7 +287,7 @@ services:
275287
- PORT=${HYDRA_INDEXER_GATEWAY_PORT}
276288
- PGSSLMODE=disable
277289
ports:
278-
- "${HYDRA_INDEXER_GATEWAY_PORT}:${HYDRA_INDEXER_GATEWAY_PORT}"
290+
- '${HYDRA_INDEXER_GATEWAY_PORT}:${HYDRA_INDEXER_GATEWAY_PORT}'
279291
depends_on:
280292
- db
281293
- redis
@@ -285,7 +297,7 @@ services:
285297
container_name: redis
286298
restart: unless-stopped
287299
ports:
288-
- "127.0.0.1:6379:6379"
300+
- '127.0.0.1:6379:6379'
289301

290302
faucet:
291303
image: joystream/faucet:carthage
@@ -304,7 +316,7 @@ services:
304316
- BALANCE_CREDIT=${BALANCE_CREDIT}
305317
- BALANCE_LOCKED=${BALANCE_LOCKED}
306318
ports:
307-
- "3002:3002"
319+
- '3002:3002'
308320

309321
# PostgerSQL database for Orion
310322
orion-db:
@@ -437,10 +449,7 @@ services:
437449
environment:
438450
DATABASE_MAX_CONNECTIONS: 5
439451
RUST_LOG: 'actix_web=info,actix_server=info'
440-
command: [
441-
'--database-url',
442-
'postgres://postgres:postgres@orion_archive_db:${ARCHIVE_DB_PORT}/squid-archive',
443-
]
452+
command: ['--database-url', 'postgres://postgres:postgres@orion_archive_db:${ARCHIVE_DB_PORT}/squid-archive']
444453
ports:
445454
- '127.0.0.1:${ARCHIVE_GATEWAY_PORT}:8000'
446455
- '[::1]:${ARCHIVE_GATEWAY_PORT}:8000'

storage-node/CHANGELOG.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1+
### 4.5.0
2+
3+
#### Features
4+
5+
- New commands to help storage bags / buckets management:
6+
7+
- `leader:set-replication` - allows adjusting bag-to-bucket assignments in order to achieve a target replication rate.
8+
- `leader:copy-bags` - allows copying all bags from one bucket / set of buckets to a different bucket / set of buckets.
9+
- `leader:empty-bucket` - allows removing all bags from a given bucket.
10+
11+
All of those commands support generating detailed summaries of planned / executed changes in the storage system thanks to the new `BagsUpdateCreator` and `BagsUpdateSummaryCreator` services.
12+
13+
- Adds a possibility to set `CLEANUP` and `CLEANUP_INTERVAL` via env in the `server` command.
14+
15+
#### Small / internal changes
16+
17+
- Fixes Colossus docker build by removing a deprecated [`@types/winston`](https://www.npmjs.com/package/@types/winston) package.
18+
- Adds a few new utility functions (`stringifyBagId`, `cmpBagId`, `isEvent`, `asStorageSize`, `getBatchResults`).
19+
- Updates `updateStorageBucketsForBags` to rely on the new `getBatchResults` utility function.
20+
121
### 4.4.0
222

323
- **Optimizations:** The way data objects / data object ids are queried and processed during sync and cleanup has been optimized:
4-
- Sync and cleanup services now process tasks in batches of configurable size (`--syncBatchSize`, `--cleanupBatchSize`) to avoid overflowing the memory.
5-
- Synchronous operations like `sort` or `filter` on larger arrays of data objects have been optimized (for example, by replacing `.filter(Array.includes(...))` with `.filter(Set.has(...))`).
6-
- Enforced a limit of max. results per single GraphQL query to `10,000` and max input arguments per query to `1,000`.
7-
- Added `--cleanupWorkersNumber` flag to limit the number of concurrent async requests during cleanup.
24+
- Sync and cleanup services now process tasks in batches of configurable size (`--syncBatchSize`, `--cleanupBatchSize`) to avoid overflowing the memory.
25+
- Synchronous operations like `sort` or `filter` on larger arrays of data objects have been optimized (for example, by replacing `.filter(Array.includes(...))` with `.filter(Set.has(...))`).
26+
- Enforced a limit of max. results per single GraphQL query to `10,000` and max input arguments per query to `1,000`.
27+
- Added `--cleanupWorkersNumber` flag to limit the number of concurrent async requests during cleanup.
828
- A safety mechanism was added to avoid removing "deleted" objects for which a related `DataObjectDeleted` event cannot be found in storage squid.
929
- Improved logging during sync and cleanup.
1030

0 commit comments

Comments
 (0)