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
New exec code path rebased #33070
Closed
+4,865
−357
Closed
New exec code path rebased #33070
Changes from 1 commit
Commits
Show all changes
5455 commits
Select commit
Hold shift + click to select a range
67de56f
save
ryoqun 8afe4e3
save
ryoqun 3188b39
save
ryoqun 61b3d15
save
ryoqun 2f748b5
save
ryoqun 7485349
save
ryoqun 867eb2f
save
ryoqun 51e4527
save
ryoqun 6ea71be
save
ryoqun 1882ca7
save
ryoqun 1a07a4b
save
ryoqun 6fd7edf
save
ryoqun a29d750
save
ryoqun cecfb63
save
ryoqun 5c70a69
save
ryoqun 11e76bc
save
ryoqun 8867965
save
ryoqun b2c65de
save
ryoqun d7e9f87
save
ryoqun b4626c1
save
ryoqun 110e7cc
save
ryoqun 1ca49d3
save
ryoqun de976a6
save
ryoqun 9ed6fdd
save
ryoqun c7b7505
save
ryoqun 4376d5d
save
ryoqun 99d3a69
save
ryoqun 349dd7e
save
ryoqun 87d17f4
save
ryoqun 347fb3b
save
ryoqun 9e5eb88
save
ryoqun 0ef0a45
save
ryoqun 7b45a17
save
ryoqun 795a09d
save
ryoqun e184747
save
ryoqun c419fa0
save
ryoqun 55a5df7
save
ryoqun 1b56b65
save
ryoqun fb754b5
save
ryoqun 0bb6f76
save
ryoqun 44e9e8c
save
ryoqun 76edf2b
save
ryoqun 506746f
save
ryoqun f417e91
save
ryoqun ff9480a
save
ryoqun bbb4e12
save
ryoqun ca31559
save
ryoqun 96bddf1
save
ryoqun 3c65141
save
ryoqun 6659a3b
save
ryoqun 238e889
save
ryoqun 5078419
save
ryoqun 784639d
save
ryoqun 0bbdeb2
save
ryoqun 0fcbc26
save
ryoqun e219321
save
ryoqun 5381389
save
ryoqun 0fb4968
save
ryoqun 9f6d7f6
save
ryoqun f6df800
save
ryoqun f2c57d4
save
ryoqun f033a72
save
ryoqun cfb52e1
save
ryoqun 11b95b5
save
ryoqun 2712908
save
ryoqun 965b21e
save
ryoqun a4cca9c
save
ryoqun 22800d3
save
ryoqun f8b9fec
save
ryoqun d5941d2
save
ryoqun 69a2698
save
ryoqun 0923738
save
ryoqun 9fa53be
save
ryoqun 9dd7e22
save
ryoqun 8bc2aba
save
ryoqun f12b38c
save
ryoqun af6e86c
save
ryoqun 0119429
save
ryoqun acf9c28
save
ryoqun 1f3fb78
save
ryoqun 0d726a5
save
ryoqun 73bcc8a
save
ryoqun 330b621
save
ryoqun 5dc30ba
save
ryoqun 5a72062
save
ryoqun 9ec299f
save
ryoqun 1a079eb
save
ryoqun 59c1c5c
save
ryoqun 6d19992
save
ryoqun d93ea2c
save
ryoqun 7ab076d
save
ryoqun 1f872cb
save
ryoqun 4d0b8b4
save
ryoqun 82d95c7
save
ryoqun ff38944
save
ryoqun 1a43235
save
ryoqun 4ae107b
save
ryoqun 06990bf
save
ryoqun c1ed040
save
ryoqun bc9835e
save
ryoqun 8b558f1
save
ryoqun d96f1e1
save
ryoqun 877a1a6
save
ryoqun 8b15a7b
save
ryoqun 2b00a70
save
ryoqun 156a6e8
save
ryoqun 5f40172
save
ryoqun 509ce44
save
ryoqun 369f1be
save
ryoqun 95f0b46
save
ryoqun 28ca6f7
save
ryoqun 4aa134e
save
ryoqun 4d25815
save
ryoqun c5d426d
save
ryoqun fd8954c
save
ryoqun 48a56eb
save
ryoqun d574b32
save
ryoqun 85b0a83
save
ryoqun aa028f1
save
ryoqun 9fc35f4
save
ryoqun 3b160e7
save
ryoqun 1bfbbf7
save
ryoqun ae8138a
save
ryoqun ff8b936
save
ryoqun ecfd83a
save
ryoqun af39166
save
ryoqun d8c0882
save
ryoqun d018023
save
ryoqun 21e9927
save
ryoqun 4e60470
save
ryoqun 3f441c7
save
ryoqun f7cb08d
save
ryoqun a2adba1
save
ryoqun 2145be6
save
ryoqun 327ac74
save
ryoqun 32ae5f3
save
ryoqun 75efc23
save
ryoqun 58f2a40
save
ryoqun 14e641c
save
ryoqun 2c52888
save
ryoqun 09470f9
save
ryoqun 6c543a3
save
ryoqun 06743cf
save
ryoqun 6f79278
save
ryoqun ed2658a
save
ryoqun b262a14
save
ryoqun 99bded0
save
ryoqun 26f411d
save
ryoqun 25a4159
save
ryoqun e82c82a
save
ryoqun ab8cf30
save
ryoqun 9e852d4
save
ryoqun 161c963
save
ryoqun 44d2b31
save
ryoqun dd0795f
save
ryoqun 9a9fe97
save
ryoqun 4c01ab3
save
ryoqun 123d0dd
save
ryoqun 433f799
save
ryoqun ec16178
save
ryoqun 94e8a68
save
ryoqun 67121c1
save
ryoqun 55c754e
save
ryoqun 022a15a
save
ryoqun efcd0cf
save
ryoqun 927a4a7
save
ryoqun ea3c372
save
ryoqun f141cba
save
ryoqun 8d3a2d6
save
ryoqun b8b8fcf
save
ryoqun 1f0d6d1
save
ryoqun b231ae8
save
ryoqun de3c41e
save
ryoqun f5c3bf4
save
ryoqun 987a16c
save
ryoqun a89a515
save
ryoqun 86d9e01
save
ryoqun be5abf6
save
ryoqun f35f22e
save
ryoqun 32c0cb2
save
ryoqun 08d486e
save
ryoqun 9bdd412
save
ryoqun 48b392a
save
ryoqun 1f4afbe
save
ryoqun ab66b6c
save
ryoqun 9a900bc
save
ryoqun 096d204
save
ryoqun 51cb52c
save
ryoqun 0b48dbd
save
ryoqun 7ee39f1
save
ryoqun 5fd146e
save
ryoqun 523d0d5
save
ryoqun 5af8ae2
save
ryoqun 6da148c
save
ryoqun 3711ca6
save
ryoqun 04a0655
save
ryoqun 8e6c4e7
save
ryoqun 66315a5
save
ryoqun 0525d15
save
ryoqun 0915e27
save
ryoqun 11cf831
save
ryoqun b503091
save
ryoqun 1498044
save
ryoqun 02d3ca4
save
ryoqun 5c30282
save
ryoqun a14422c
save
ryoqun cdec813
save
ryoqun 0e9c3c5
save
ryoqun cd72fd9
save
ryoqun 950b259
save
ryoqun 77d824c
save
ryoqun 743c9ed
save
ryoqun 9b8ff30
save
ryoqun 8eb4e4a
save
ryoqun 866aa33
save
ryoqun 7a380cd
save
ryoqun 496e139
save
ryoqun 4ed0b4f
save
ryoqun 32735ff
save
ryoqun 679b26d
save
ryoqun dd3178c
save
ryoqun 5488e79
save
ryoqun 58879a2
save
ryoqun eb12b82
save
ryoqun 8a8830a
save
ryoqun efcf3cb
save
ryoqun 9c23870
save
ryoqun fd2b074
save
ryoqun 805f1d2
save
ryoqun e2a3ff4
save
ryoqun 3a91944
save
ryoqun 5fc1775
save
ryoqun 2412099
save
ryoqun 808fa6f
save
ryoqun 87d6847
save
ryoqun b1edd36
save
ryoqun 0dca9f3
save
ryoqun 70f2e5e
save
ryoqun 20a0d67
save
ryoqun 5759892
save
ryoqun 021b791
save
ryoqun 34a6c61
save
ryoqun 41c98ea
save
ryoqun c843522
save
ryoqun 0440535
save
ryoqun 317fb97
save
ryoqun 6893f49
Merge remote-tracking branch 'origin/master' into HEAD
ryoqun 1c8b2d8
save
ryoqun 95774a6
save
ryoqun ffb457f
save
ryoqun 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
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 |
---|---|---|
|
@@ -47,7 +47,7 @@ pub struct SchedulerPool< | |
transaction_status_sender: Option<TransactionStatusSender>, | ||
replay_vote_sender: Option<ReplayVoteSender>, | ||
prioritization_fee_cache: Arc<PrioritizationFeeCache>, | ||
// weak_self could be elided by changing InstalledScheduler::take_from_pool()'s receiver to | ||
// weak_self could be elided by changing InstalledScheduler::take_scheduler()'s receiver to | ||
// Arc<Self> from &Self, because SchedulerPool is used as in the form of Arc<SchedulerPool> | ||
// almost always. But, this would cause wasted and noisy Arc::clone()'s at every call sites. | ||
// | ||
|
@@ -110,6 +110,15 @@ impl< | |
.upgrade() | ||
.expect("self-referencing Arc-ed pool") | ||
} | ||
|
||
pub fn return_scheduler(&self, scheduler: Box<dyn InstalledScheduler<SEA>>) { | ||
assert!(scheduler.context().is_none()); | ||
|
||
self.schedulers | ||
.lock() | ||
.expect("not poisoned") | ||
.push(scheduler); | ||
} | ||
} | ||
|
||
impl< | ||
|
@@ -118,7 +127,7 @@ impl< | |
SEA: ScheduleExecutionArg, | ||
> InstalledSchedulerPool<SEA> for SchedulerPool<T, TH, SEA> | ||
{ | ||
fn take_from_pool(&self, context: SchedulingContext) -> Box<dyn InstalledScheduler<SEA>> { | ||
fn take_scheduler(&self, context: SchedulingContext) -> Box<dyn InstalledScheduler<SEA>> { | ||
// pop is intentional for filo, expecting relatively warmed-up scheduler due to having been | ||
// returned recently | ||
if let Some(mut scheduler) = self.schedulers.lock().expect("not poisoned").pop() { | ||
|
@@ -128,15 +137,6 @@ impl< | |
T::spawn_boxed(self.self_arc(), context, TH::create(self)) | ||
} | ||
} | ||
|
||
fn return_to_pool(&self, scheduler: Box<dyn InstalledScheduler<SEA>>) { | ||
assert!(scheduler.context().is_none()); | ||
|
||
self.schedulers | ||
.lock() | ||
.expect("not poisoned") | ||
.push(scheduler); | ||
} | ||
} | ||
|
||
pub trait ScheduledTransactionHandler<SEA: ScheduleExecutionArg>: | ||
|
@@ -253,8 +253,8 @@ impl<TH: ScheduledTransactionHandler<SEA>, SEA: ScheduleExecutionArg> InstalledS | |
self.id | ||
} | ||
|
||
fn pool(&self) -> InstalledSchedulerPoolArc<SEA> { | ||
self.pool.clone() | ||
fn return_to_pool(self: Box<Self>) { | ||
self.pool.clone().return_scheduler(self) | ||
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. here 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. oh, the 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. well, never mind. i can't. borrow checker would complain... |
||
} | ||
|
||
fn schedule_execution(&self, transaction_with_index: SEA::TransactionWithIndex<'_>) { | ||
|
@@ -361,7 +361,7 @@ mod tests { | |
DefaultSchedulerPool::new_dyn(None, None, None, ignored_prioritization_fee_cache); | ||
let bank = Arc::new(Bank::default_for_tests()); | ||
let context = SchedulingContext::new(SchedulingMode::BlockVerification, bank); | ||
let scheduler = pool.take_from_pool(context); | ||
let scheduler = pool.take_scheduler(context); | ||
|
||
let debug = format!("{scheduler:#?}"); | ||
assert!(!debug.is_empty()); | ||
|
@@ -372,31 +372,30 @@ mod tests { | |
solana_logger::setup(); | ||
|
||
let ignored_prioritization_fee_cache = Arc::new(PrioritizationFeeCache::new(0u64)); | ||
let pool = | ||
DefaultSchedulerPool::new_dyn(None, None, None, ignored_prioritization_fee_cache); | ||
let pool = DefaultSchedulerPool::new(None, None, None, ignored_prioritization_fee_cache); | ||
let bank = Arc::new(Bank::default_for_tests()); | ||
let context = &SchedulingContext::new(SchedulingMode::BlockVerification, bank); | ||
|
||
let mut scheduler1 = pool.take_from_pool(context.clone()); | ||
let mut scheduler1 = pool.take_scheduler(context.clone()); | ||
let scheduler_id1 = scheduler1.id(); | ||
let mut scheduler2 = pool.take_from_pool(context.clone()); | ||
let mut scheduler2 = pool.take_scheduler(context.clone()); | ||
let scheduler_id2 = scheduler2.id(); | ||
assert_ne!(scheduler_id1, scheduler_id2); | ||
|
||
assert_matches!( | ||
scheduler1.wait_for_termination(&WaitReason::TerminatedToFreeze), | ||
None | ||
); | ||
pool.return_to_pool(scheduler1); | ||
pool.return_scheduler(scheduler1); | ||
assert_matches!( | ||
scheduler2.wait_for_termination(&WaitReason::TerminatedToFreeze), | ||
None | ||
); | ||
pool.return_to_pool(scheduler2); | ||
pool.return_scheduler(scheduler2); | ||
|
||
let scheduler3 = pool.take_from_pool(context.clone()); | ||
let scheduler3 = pool.take_scheduler(context.clone()); | ||
assert_eq!(scheduler_id2, scheduler3.id()); | ||
let scheduler4 = pool.take_from_pool(context.clone()); | ||
let scheduler4 = pool.take_scheduler(context.clone()); | ||
assert_eq!(scheduler_id1, scheduler4.id()); | ||
} | ||
|
||
|
@@ -410,7 +409,7 @@ mod tests { | |
let bank = Arc::new(Bank::default_for_tests()); | ||
let context = &SchedulingContext::new(SchedulingMode::BlockVerification, bank); | ||
|
||
let mut scheduler = pool.take_from_pool(context.clone()); | ||
let mut scheduler = pool.take_scheduler(context.clone()); | ||
|
||
assert!(scheduler.context().is_some()); | ||
assert_matches!( | ||
|
@@ -430,8 +429,7 @@ mod tests { | |
solana_logger::setup(); | ||
|
||
let ignored_prioritization_fee_cache = Arc::new(PrioritizationFeeCache::new(0u64)); | ||
let pool = | ||
DefaultSchedulerPool::new_dyn(None, None, None, ignored_prioritization_fee_cache); | ||
let pool = DefaultSchedulerPool::new(None, None, None, ignored_prioritization_fee_cache); | ||
let old_bank = &Arc::new(Bank::default_for_tests()); | ||
let new_bank = &Arc::new(Bank::default_for_tests()); | ||
assert!(!Arc::ptr_eq(old_bank, new_bank)); | ||
|
@@ -441,15 +439,15 @@ mod tests { | |
let new_context = | ||
&SchedulingContext::new(SchedulingMode::BlockVerification, new_bank.clone()); | ||
|
||
let mut scheduler = pool.take_from_pool(old_context.clone()); | ||
let mut scheduler = pool.take_scheduler(old_context.clone()); | ||
let scheduler_id = scheduler.id(); | ||
assert_matches!( | ||
scheduler.wait_for_termination(&WaitReason::TerminatedToFreeze), | ||
None | ||
); | ||
pool.return_to_pool(scheduler); | ||
pool.return_scheduler(scheduler); | ||
|
||
let scheduler = pool.take_from_pool(new_context.clone()); | ||
let scheduler = pool.take_scheduler(new_context.clone()); | ||
assert_eq!(scheduler_id, scheduler.id()); | ||
assert!(Arc::ptr_eq(scheduler.context().unwrap().bank(), new_bank)); | ||
} | ||
|
@@ -522,7 +520,7 @@ mod tests { | |
let context = SchedulingContext::new(SchedulingMode::BlockVerification, bank.clone()); | ||
|
||
assert_eq!(bank.transaction_count(), 0); | ||
let scheduler = pool.take_from_pool(context); | ||
let scheduler = pool.take_scheduler(context); | ||
scheduler.schedule_execution(&(tx0, 0)); | ||
let bank = BankWithScheduler::new(bank, Some(scheduler)); | ||
assert_matches!(bank.wait_for_completed_scheduler(), Some((Ok(()), _))); | ||
|
@@ -552,7 +550,7 @@ mod tests { | |
let context = SchedulingContext::new(SchedulingMode::BlockVerification, bank.clone()); | ||
|
||
assert_eq!(bank.transaction_count(), 0); | ||
let scheduler = pool.take_from_pool(context); | ||
let scheduler = pool.take_scheduler(context); | ||
scheduler.schedule_execution(&(tx0, 0)); | ||
assert_eq!(bank.transaction_count(), 0); | ||
|
||
|
@@ -593,8 +591,8 @@ mod tests { | |
self.0.id() | ||
} | ||
|
||
fn pool(&self) -> InstalledSchedulerPoolArc<DefaultScheduleExecutionArg> { | ||
self.0.pool() | ||
fn return_to_pool(self: Box<Self>) { | ||
self.0.pool.clone().return_scheduler(self) | ||
} | ||
|
||
fn context(&self) -> Option<&SchedulingContext> { | ||
|
@@ -722,7 +720,7 @@ mod tests { | |
DefaultTransactionHandler, | ||
DefaultScheduleExecutionArg, | ||
>::new_dyn(None, None, None, ignored_prioritization_fee_cache); | ||
let scheduler = pool.take_from_pool(context); | ||
let scheduler = pool.take_scheduler(context); | ||
|
||
let bank = BankWithScheduler::new(bank, Some(scheduler)); | ||
assert_eq!(bank.transaction_count(), 0); | ||
|
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.
here 2