Skip to content
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

Jp/perf 2.9 2025013 #689

Merged
merged 39 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9c20678
fix: introduce ar_device_lock to manage IO by system device
JamesPiechota Jan 9, 2025
b38d6ff
fix: entropy preparation performance improvements
JamesPiechota Jan 18, 2025
ecb4b7e
feature: expose the packing_worker and replica_2_9_workers flags
JamesPiechota Jan 19, 2025
7d68570
fix: add delete_async, clean up some metrics, cache StoreIDLabel
JamesPiechota Jan 20, 2025
a9b556e
fixup parse packing_workers and replica_2_9_workers in ar_config
Jan 20, 2025
1d4589a
fixup collect repacked modules in ar_device_lock
Jan 20, 2025
b20e169
fixup handle timed out entropy generated replies
Jan 20, 2025
a3a835b
fixup report all read_range tasks as localhost
Jan 20, 2025
a07fd19
test: add some more logging to tests
JamesPiechota Jan 20, 2025
444faa9
Record invalid mining solution data
Jan 20, 2025
afb3d56
test: fix ar_device_lock test
JamesPiechota Jan 20, 2025
f49a8b6
fix: revert delete_async
JamesPiechota Jan 20, 2025
401b371
fix: handle an extra case statement in GET /chunk
JamesPiechota Jan 20, 2025
19f20c6
refactor: remove some debugging output
JamesPiechota Jan 20, 2025
383e3c3
misc: fix case clause errors, better logs
JamesPiechota Jan 20, 2025
17644d6
fix: make sure device lock status is printed at least once
JamesPiechota Jan 20, 2025
0bd0231
fix: spawn ar_entropy_storage workers for repack_in_place modules
JamesPiechota Jan 20, 2025
6d5403e
fixup chunk byte from bucket end
Jan 20, 2025
dc86270
fix: handle an error condition without crashing
JamesPiechota Jan 20, 2025
a5f99ee
logging: add some logs to help diagnose the invalid padding error
JamesPiechota Jan 20, 2025
5611fef
test: add some more logging to diagnose e2e test failures
JamesPiechota Jan 21, 2025
72b9384
Handle invalid_padding gracefully in GET /chunk
Jan 21, 2025
82741da
fix: miscellaneaous fixes for replica.2.9 packing
Jan 21, 2025
13c98ef
fix: fix offset handling in invalidate_data_record
Jan 21, 2025
d1ea011
test: fix test flakiness in ar_post_block_tests
Jan 21, 2025
dab0d53
refactor: refactor some of the offset code, add tests
JamesPiechota Jan 21, 2025
beca994
fix: block repacking in place to any format other than replica.2.9
JamesPiechota Jan 21, 2025
25bdf6c
Add some debug logs tracking stored 2.9 chunk data
Jan 22, 2025
94c8f63
Fix 2.9 corruption recovery
Jan 22, 2025
f701427
Check chunk packing during mining early
Jan 22, 2025
52bfacc
Fix flaky reject_block_invalid_double_signing_proof_test
Jan 22, 2025
001ae74
fix: fix some data corruption during packing
JamesPiechota Jan 23, 2025
cc5cfb0
fix: edge case crash during tests
JamesPiechota Jan 23, 2025
850ea01
Revert "Add some debug logs tracking stored 2.9 chunk data"
JamesPiechota Jan 23, 2025
4066145
fix: cleanup logs, remove unnecessary wait
JamesPiechota Jan 23, 2025
4696720
Revert "Check chunk packing during mining early"
JamesPiechota Jan 23, 2025
111cfaa
cleanup: remove some dead code, add some logs
JamesPiechota Jan 23, 2025
e43f861
fix: handle read_range tasks in one worker per storage_module
JamesPiechota Jan 24, 2025
42890af
Improve invalidate bad data record interface
Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,13 @@ jobs:
ar_block,
ar_block_cache,
ar_chain_stats,
ar_chunk_copy,
ar_chunk_storage,
ar_data_sync_worker_master,
ar_deep_hash,
ar_device_lock,
ar_diff_dag,
ar_entropy_storage,
ar_ets_intervals,
ar_events,
ar_inflation,
Expand Down
189 changes: 0 additions & 189 deletions .github/workflows/test.yml.bak

This file was deleted.

64 changes: 43 additions & 21 deletions apps/arweave/e2e/ar_e2e.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
-export([delayed_print/2, packing_type_to_packing/2,
start_source_node/3, source_node_storage_modules/3, max_chunk_offset/1,
assert_block/2, assert_syncs_range/3, assert_does_not_sync_range/3,
assert_chunks/3, assert_no_chunks/2, assert_partition_size/4, assert_empty_partition/3]).
assert_chunks/3, assert_no_chunks/2, assert_partition_size/3, assert_empty_partition/3]).

-include_lib("arweave/include/ar.hrl").
-include_lib("arweave/include/ar_config.hrl").
Expand Down Expand Up @@ -70,6 +70,8 @@ packing_type_to_packing(PackingType, Address) ->
end.

start_source_node(Node, unpacked, _WalletFixture) ->
?LOG_INFO("Starting source node ~p with packing type ~p and wallet fixture ~p",
[Node, unpacked, _WalletFixture]),
TempNode = case Node of
peer1 -> peer2;
peer2 -> peer1
Expand All @@ -85,11 +87,16 @@ start_source_node(Node, unpacked, _WalletFixture) ->
auto_join = true
}, true),

ar_e2e:assert_partition_size(Node, 0, unpacked, ?PARTITION_SIZE),
ar_e2e:assert_partition_size(Node, 1, unpacked, ?PARTITION_SIZE),
?LOG_INFO("Source node ~p started.", [Node]),

ar_e2e:assert_partition_size(Node, 0, unpacked),
ar_e2e:assert_partition_size(Node, 1, unpacked),

ar_e2e:assert_syncs_range(Node, ?PARTITION_SIZE, 2*?PARTITION_SIZE),
ar_e2e:assert_chunks(Node, unpacked, Chunks),

?LOG_INFO("Source node ~p assertions passed.", [Node]),

ar_test_node:stop(TempNode),
{Blocks, undefined, Chunks};
start_source_node(Node, PackingType, WalletFixture) ->
Expand All @@ -110,6 +117,8 @@ start_source_node(Node, PackingType, WalletFixture) ->
}, true)
),

?LOG_INFO("Source node ~p started.", [Node]),

%% Note: small chunks will be padded to 256 KiB. So B1 actually contains 3 chunks of data
%% and B2 starts at a chunk boundary and contains 1 chunk of data.
B1 = mine_block(Node, Wallet, floor(2.5 * ?DATA_CHUNK_SIZE)),
Expand All @@ -130,14 +139,16 @@ start_source_node(Node, PackingType, WalletFixture) ->
{B3, ?PARTITION_SIZE + (8*?DATA_CHUNK_SIZE), ?DATA_CHUNK_SIZE}
],

?LOG_INFO("Source node ~p started.", [Node]),
?LOG_INFO("Source node ~p blocks mined.", [Node]),

SourcePacking = ar_e2e:packing_type_to_packing(PackingType, RewardAddr),

ar_e2e:assert_partition_size(Node, 0, SourcePacking, ?PARTITION_SIZE),
ar_e2e:assert_partition_size(Node, 1, SourcePacking, ?PARTITION_SIZE),
ar_e2e:assert_partition_size(Node, 0, SourcePacking),
ar_e2e:assert_partition_size(Node, 1, SourcePacking),

ar_e2e:assert_syncs_range(Node, ?PARTITION_SIZE, 2*?PARTITION_SIZE),
ar_e2e:assert_syncs_range(Node,
?PARTITION_SIZE,
2*?PARTITION_SIZE + ar_storage_module:get_overlap(SourcePacking)),
ar_e2e:assert_chunks(Node, SourcePacking, Chunks),

?LOG_INFO("Source node ~p assertions passed.", [Node]),
Expand Down Expand Up @@ -211,14 +222,21 @@ assert_block({replica_2_9, Address}, MinedBlock) ->


assert_syncs_range(Node, StartOffset, EndOffset) ->
?assert(
ar_util:do_until(
fun() -> has_range(Node, StartOffset, EndOffset) end,
100,
60_000
),
iolist_to_binary(io_lib:format(
"~s Failed to sync range ~p - ~p", [Node, StartOffset, EndOffset]))).
HasRange = ar_util:do_until(
fun() -> has_range(Node, StartOffset, EndOffset) end,
100,
60_000
),
case HasRange of
true ->
ok;
false ->
SyncRecord = ar_http_iface_client:get_sync_record(Node, json),
?assert(false,
iolist_to_binary(io_lib:format(
"~s failed to sync range ~p - ~p. Sync record: ~p",
[Node, StartOffset, EndOffset, SyncRecord])))
end.

assert_does_not_sync_range(Node, StartOffset, EndOffset) ->
ar_util:do_until(
Expand All @@ -231,7 +249,10 @@ assert_does_not_sync_range(Node, StartOffset, EndOffset) ->
"~s synced range when it should not have: ~p - ~p",
[Node, StartOffset, EndOffset]))).

assert_partition_size(Node, PartitionNumber, Packing, Size) ->
assert_partition_size(Node, PartitionNumber, Packing) ->
Size = ?PARTITION_SIZE,
?LOG_INFO("~p: Asserting partition ~p,~p is size ~p",
[Node, PartitionNumber, ar_serialize:encode_packing(Packing, true), Size]),
?assert(
ar_util:do_until(
fun() ->
Expand Down Expand Up @@ -330,17 +351,18 @@ assert_chunk(Node, Packing, Block, EndOffset, ChunkSize) ->
{ok, ExpectedPackedChunk} = ar_e2e:load_chunk_fixture(Packing, EndOffset),
?assertEqual(ExpectedPackedChunk, Chunk,
iolist_to_binary(io_lib:format(
"Chunk at offset ~p, size ~p does not match previously packed chunk",
[EndOffset, ChunkSize]))),
"~p: Chunk at offset ~p, size ~p does not match previously packed chunk",
[Node, EndOffset, ChunkSize]))),

{ok, UnpackedChunk} = ar_packing_server:unpack(
Packing, EndOffset, Block#block.tx_root, Chunk, ?DATA_CHUNK_SIZE),
UnpaddedChunk = ar_packing_server:unpad_chunk(Packing, UnpackedChunk, ChunkSize, byte_size(Chunk)),
UnpaddedChunk = ar_packing_server:unpad_chunk(
Packing, UnpackedChunk, ChunkSize, byte_size(Chunk)),
ExpectedUnpackedChunk = ar_test_node:get_genesis_chunk(EndOffset),
?assertEqual(ExpectedUnpackedChunk, UnpaddedChunk,
iolist_to_binary(io_lib:format(
"Chunk at offset ~p, size ~p does not match unpacked chunk",
[EndOffset, ChunkSize]))).
"~p: Chunk at offset ~p, size ~p does not match unpacked chunk",
[Node, EndOffset, ChunkSize]))).

assert_no_chunks(Node, Chunks) ->
lists:foreach(fun({_Block, EndOffset, _ChunkSize}) ->
Expand Down
24 changes: 4 additions & 20 deletions apps/arweave/e2e/ar_repack_in_place_mine_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,9 @@
repack_in_place_mine_test_() ->
Timeout = ?REPACK_IN_PLACE_MINE_TEST_TIMEOUT,
[
% XXX {timeout, Timeout, {with, {unpacked, replica_2_9}, [fun test_repack_in_place_mine/1]}},
% XXX {timeout, Timeout, {with, {unpacked, spora_2_6}, [fun test_repack_in_place_mine/1]}},
% XXX {timeout, Timeout, {with, {unpacked, composite_1}, [fun test_repack_in_place_mine/1]}},
% XXX {timeout, Timeout, {with, {unpacked, composite_2}, [fun test_repack_in_place_mine/1]}},
% {timeout, Timeout, {with, {unpacked, replica_2_9}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {spora_2_6, replica_2_9}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {spora_2_6, spora_2_6}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {spora_2_6, composite_1}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {spora_2_6, composite_2}, [fun test_repack_in_place_mine/1]}},
% % % % % XXX {timeout, Timeout, {with, {spora_2_6, unpacked}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {composite_1, replica_2_9}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {composite_1, spora_2_6}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {composite_1, composite_1}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {composite_1, composite_2}, [fun test_repack_in_place_mine/1]}},
% % % % % XXX {timeout, Timeout, {with, {composite_1, unpacked}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {composite_2, replica_2_9}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {composite_2, spora_2_6}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {composite_2, composite_1}, [fun test_repack_in_place_mine/1]}},
{timeout, Timeout, {with, {composite_2, composite_2}, [fun test_repack_in_place_mine/1]}}
% % % % % XXX {timeout, Timeout, {with, {composite_2, unpacked}, [fun test_repack_in_place_mine/1]}}
{timeout, Timeout, {with, {composite_1, replica_2_9}, [fun test_repack_in_place_mine/1]}}
].

%% --------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -69,8 +53,8 @@ test_repack_in_place_mine({FromPackingType, ToPackingType}) ->
}),
ar_test_node:restart(RepackerNode),

ar_e2e:assert_partition_size(RepackerNode, 0, ToPacking, ?PARTITION_SIZE),
ar_e2e:assert_partition_size(RepackerNode, 1, ToPacking, ?PARTITION_SIZE),
ar_e2e:assert_partition_size(RepackerNode, 0, ToPacking),
ar_e2e:assert_partition_size(RepackerNode, 1, ToPacking),

ar_test_node:stop(RepackerNode),

Expand Down
Loading
Loading