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

Add volatile_nonatomic_schedule_immediate #1612

Merged
merged 4 commits into from
Aug 23, 2024

Conversation

coolreader18
Copy link
Collaborator

@coolreader18 coolreader18 commented Aug 19, 2024

Implements Tyler's proposal - for bitcraft to get error handling working until nested transactions are a thing.

@coolreader18 coolreader18 force-pushed the noa/volatile_nonatomic_schedule_immediate branch 4 times, most recently from 4d58b6a to 1e77ec5 Compare August 20, 2024 19:13
@coolreader18 coolreader18 requested a review from Centril August 21, 2024 17:51
@coolreader18 coolreader18 force-pushed the noa/volatile_nonatomic_schedule_immediate branch 4 times, most recently from d287bbb to 8a912a9 Compare August 21, 2024 20:29
Copy link
Contributor

@Centril Centril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a PR description, otherwise, approved with some requested changes.

/// - `name` does not point to valid UTF-8
/// - `name + name_len` or `args + args_len` overflow a 64-bit integer
pub fn _schedule_reducer(
pub fn _volatile_nonatomic_schedule_immediate(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's gate this under feature = "unstable_abi".

@@ -197,32 +197,22 @@ pub mod raw {
message_len: usize,
);

/// Schedules a reducer to be called asynchronously at `time`.
/// Schedules a reducer to be called asynchronously, nonatomically,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs here are not fully updated and fully true, but its unstable, so we don't need to care in the interest of time.

Comment on lines 577 to 604
($($args:tt)*) => {
$crate::__volatile_nonatomic_schedule_immediate_impl!([] [$($args)*])
};
}

#[doc(hidden)]
#[macro_export]
macro_rules! __volatile_nonatomic_schedule_immediate_impl {
([$repeater:path] [($($args:tt)*)]) => {
$crate::__volatile_nonatomic_schedule_immediate_impl!(@process_args $repeater, ($($args)*))
};
([$($cur:tt)*] [$next:tt $($rest:tt)*]) => {
$crate::__volatile_nonatomic_schedule_immediate_impl!([$($cur)* $next] [$($rest)*])
};
(@process_args $repeater:path, (_$(, $args:expr)* $(,)?)) => {
$crate::__volatile_nonatomic_schedule_immediate_impl!(@call $repeater, ($crate::ReducerContext::__dummy(), $($args),*))
};
(@process_args $repeater:path, ($($args:expr),* $(,)?)) => {
$crate::__volatile_nonatomic_schedule_immediate_impl!(@call $repeater, ($($args),*))
};
(@call $repeater:path, ($($args:expr),*)) => {
if false {
let _ = $repeater($($args,)*);
} else {
$crate::rt::volatile_nonatomic_schedule_immediate::<_, _, $repeater, _>($repeater, ($($args,)*))
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a whole lot of complication just to support reducer(args) when reducer, args would have worked, but oh well, it's been written already :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just copied it from the old schedule macro

};
(@call $repeater:path, ($($args:expr),*)) => {
if false {
let _ = $repeater($($args,)*);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume this is for type-checking purposes.

Comment on lines +239 to +244
init_update = proc.stdout.readline()
code = proc.poll()
if code:
raise subprocess.CalledProcessError(code, fake_args)
print("initial update:", init_update)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add commentary for this change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was giving me an annoying error because I had named the table in the new smoketest "Table", and I was so confused why SELECT * FROM Table was failing with a parse error (sql is case-insensitive and TABLE is a keyword). This was part of my debugging that - it makes self.subscribe() raise the error earlier instead of delaying it til you call sub().

Copy link
Collaborator

@bfops bfops Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW this was removed in #1536. The errors were being raised inconsistently and causing smoketest flakes.

By forcing all errors into one codepath we removed the surface area for a test to get its error "at the wrong time".

bfops added a commit that referenced this pull request Aug 23, 2024
@coolreader18 coolreader18 force-pushed the noa/volatile_nonatomic_schedule_immediate branch from 341e906 to 41847eb Compare August 23, 2024 17:58
@coolreader18 coolreader18 enabled auto-merge August 23, 2024 17:58
@coolreader18 coolreader18 force-pushed the noa/volatile_nonatomic_schedule_immediate branch from 41847eb to ecd2fd6 Compare August 23, 2024 18:26
@coolreader18 coolreader18 added this pull request to the merge queue Aug 23, 2024
bfops added a commit that referenced this pull request Aug 23, 2024
Merged via the queue into master with commit c577d50 Aug 23, 2024
8 checks passed
bfops added a commit that referenced this pull request Aug 23, 2024
@coolreader18 coolreader18 deleted the noa/volatile_nonatomic_schedule_immediate branch September 23, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants