This repository has been archived by the owner on Jan 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
allow test feature to skip rewrites #33851
Merged
Merged
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
c2e406b
allow test feature to skip rewrites
jeffwashington d2868a5
hook up cli arg for test skip rewrites, update tests
fa36141
fix sanity checker
b6ebeb7
add account hash to abi to fix a test
238dda6
reviews
d596446
use hashmap to collect skip_rewrites. exclude skip_rewrites from dirty
1ae5737
accumulate skipped_rewrite in reduce
561b9a4
mutex
d986234
fmt
41c5fd6
skip hash verify for this test flag
b6bf790
add skipped rewrites num stat
70c1c01
skip bank hash verify not account hash verify
48c875d
reviews
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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 |
---|---|---|
|
@@ -235,7 +235,9 @@ mod serde_snapshot_tests { | |
create_test_accounts(&accounts, &mut pubkeys, 100, slot); | ||
check_accounts_local(&accounts, &pubkeys, 100); | ||
accounts.add_root(slot); | ||
let accounts_delta_hash = accounts.accounts_db.calculate_accounts_delta_hash(slot); | ||
let accounts_delta_hash = accounts | ||
.accounts_db | ||
.calculate_accounts_delta_hash(slot, Vec::default()); | ||
let accounts_hash = AccountsHash(Hash::new_unique()); | ||
accounts | ||
.accounts_db | ||
|
@@ -270,7 +272,9 @@ mod serde_snapshot_tests { | |
.unwrap(), | ||
); | ||
check_accounts_local(&daccounts, &pubkeys, 100); | ||
let daccounts_delta_hash = daccounts.accounts_db.calculate_accounts_delta_hash(slot); | ||
let daccounts_delta_hash = daccounts | ||
.accounts_db | ||
.calculate_accounts_delta_hash(slot, Vec::default()); | ||
assert_eq!(accounts_delta_hash, daccounts_delta_hash); | ||
let daccounts_hash = daccounts.accounts_db.get_accounts_hash(slot).unwrap().0; | ||
assert_eq!(accounts_hash, daccounts_hash); | ||
|
@@ -300,7 +304,7 @@ mod serde_snapshot_tests { | |
db.store_for_tests(new_root, &[(&key2, &account0)]); | ||
db.add_root_and_flush_write_cache(new_root); | ||
|
||
db.calculate_accounts_delta_hash(new_root); | ||
db.calculate_accounts_delta_hash(new_root, Vec::default()); | ||
db.update_accounts_hash_for_tests(new_root, &linear_ancestors(new_root), false, false); | ||
|
||
// Simulate reconstruction from snapshot | ||
|
@@ -339,7 +343,7 @@ mod serde_snapshot_tests { | |
accounts.add_root_and_flush_write_cache(0); | ||
accounts.check_storage(0, 100); | ||
accounts.check_accounts(&pubkeys, 0, 100, 2); | ||
accounts.calculate_accounts_delta_hash(0); | ||
accounts.calculate_accounts_delta_hash(0, Vec::default()); | ||
|
||
let mut pubkeys1: Vec<Pubkey> = vec![]; | ||
|
||
|
@@ -357,7 +361,7 @@ mod serde_snapshot_tests { | |
// accounts | ||
accounts.create_account(&mut pubkeys1, latest_slot, 10, 0, 0); | ||
|
||
accounts.calculate_accounts_delta_hash(latest_slot); | ||
accounts.calculate_accounts_delta_hash(latest_slot, Vec::default()); | ||
accounts.add_root_and_flush_write_cache(latest_slot); | ||
accounts.check_storage(1, 21); | ||
|
||
|
@@ -377,7 +381,7 @@ mod serde_snapshot_tests { | |
// 21 + 10 = 31 accounts | ||
accounts.create_account(&mut pubkeys2, latest_slot, 10, 0, 0); | ||
|
||
accounts.calculate_accounts_delta_hash(latest_slot); | ||
accounts.calculate_accounts_delta_hash(latest_slot, Vec::default()); | ||
accounts.add_root_and_flush_write_cache(latest_slot); | ||
accounts.check_storage(2, 31); | ||
|
||
|
@@ -475,7 +479,7 @@ mod serde_snapshot_tests { | |
|
||
accounts.print_accounts_stats("accounts_post_purge"); | ||
|
||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
accounts.update_accounts_hash_for_tests( | ||
current_slot, | ||
&linear_ancestors(current_slot), | ||
|
@@ -532,7 +536,7 @@ mod serde_snapshot_tests { | |
accounts.add_root_and_flush_write_cache(current_slot); | ||
|
||
accounts.print_accounts_stats("pre_f"); | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
accounts.update_accounts_hash_for_tests(4, &Ancestors::default(), false, false); | ||
|
||
let accounts = f(accounts, current_slot); | ||
|
@@ -629,7 +633,7 @@ mod serde_snapshot_tests { | |
accounts.add_root_and_flush_write_cache(current_slot); | ||
|
||
accounts.print_count_and_status("before reconstruct"); | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
accounts.update_accounts_hash_for_tests( | ||
current_slot, | ||
&linear_ancestors(current_slot), | ||
|
@@ -672,7 +676,7 @@ mod serde_snapshot_tests { | |
current_slot += 1; | ||
accounts.store_for_tests(current_slot, &[(&pubkey1, &account)]); | ||
accounts.store_for_tests(current_slot, &[(&pubkey2, &account)]); | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
accounts.add_root(current_slot); | ||
|
||
// B: Test multiple updates to pubkey1 in a single slot/storage | ||
|
@@ -687,15 +691,15 @@ mod serde_snapshot_tests { | |
// Stores to same pubkey, same slot only count once towards the | ||
// ref count | ||
assert_eq!(2, accounts.ref_count_for_pubkey(&pubkey1)); | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
|
||
// C: Yet more update to trigger lazy clean of step A | ||
current_slot += 1; | ||
assert_eq!(2, accounts.ref_count_for_pubkey(&pubkey1)); | ||
accounts.store_for_tests(current_slot, &[(&pubkey1, &account3)]); | ||
accounts.add_root_and_flush_write_cache(current_slot); | ||
assert_eq!(3, accounts.ref_count_for_pubkey(&pubkey1)); | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
accounts.add_root_and_flush_write_cache(current_slot); | ||
|
||
// D: Make pubkey1 0-lamport; also triggers clean of step B | ||
|
@@ -727,13 +731,13 @@ mod serde_snapshot_tests { | |
3, /* == 3 - 1 + 1 */ | ||
accounts.ref_count_for_pubkey(&pubkey1) | ||
); | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
accounts.add_root(current_slot); | ||
|
||
// E: Avoid missing bank hash error | ||
current_slot += 1; | ||
accounts.store_for_tests(current_slot, &[(&dummy_pubkey, &dummy_account)]); | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
accounts.add_root(current_slot); | ||
|
||
accounts.assert_load_account(current_slot, pubkey1, zero_lamport); | ||
|
@@ -764,7 +768,7 @@ mod serde_snapshot_tests { | |
// F: Finally, make Step A cleanable | ||
current_slot += 1; | ||
accounts.store_for_tests(current_slot, &[(&pubkey2, &account)]); | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems like we should probably make a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah. updated. |
||
accounts.add_root(current_slot); | ||
|
||
// Do clean | ||
|
@@ -805,7 +809,7 @@ mod serde_snapshot_tests { | |
accounts.store_for_tests(current_slot, &[(pubkey, &account)]); | ||
} | ||
let shrink_slot = current_slot; | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
accounts.add_root_and_flush_write_cache(current_slot); | ||
|
||
current_slot += 1; | ||
|
@@ -815,7 +819,7 @@ mod serde_snapshot_tests { | |
for pubkey in updated_pubkeys { | ||
accounts.store_for_tests(current_slot, &[(pubkey, &account)]); | ||
} | ||
accounts.calculate_accounts_delta_hash(current_slot); | ||
accounts.calculate_accounts_delta_hash(current_slot, Vec::default()); | ||
accounts.add_root_and_flush_write_cache(current_slot); | ||
|
||
accounts.clean_accounts_for_tests(); | ||
|
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.
I guess this is caused by the addition of the rewrites on
Bank
?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.