-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
allow test feature to skip rewrites #33851
Changes from 4 commits
c2e406b
d2868a5
fa36141
b6ebeb7
238dda6
d596446
1ae5737
561b9a4
d986234
41c5fd6
b6bf790
70c1c01
48c875d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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(); | ||
|
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.