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

fix: remove actor system for transactions, refactor iTX and tracing #5001

Merged
merged 48 commits into from
Nov 5, 2024

Conversation

aqrln
Copy link
Member

@aqrln aqrln commented Sep 21, 2024

@aqrln aqrln added this to the 5.20.0 milestone Sep 21, 2024
@aqrln aqrln self-assigned this Sep 21, 2024
@aqrln aqrln changed the title fix: remove actor system for transactions fix: remove actor system for transactions, refactor iTX and tracing Sep 21, 2024
Copy link
Contributor

github-actions bot commented Sep 21, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.032MiB 2.046MiB -14.468KiB
Postgres (gzip) 816.875KiB 823.439KiB -6.564KiB
Mysql 1.995MiB 2.012MiB -17.084KiB
Mysql (gzip) 802.579KiB 809.921KiB -7.343KiB
Sqlite 1.895MiB 1.907MiB -12.944KiB
Sqlite (gzip) 763.334KiB 769.225KiB -5.891KiB

Copy link

codspeed-hq bot commented Sep 21, 2024

CodSpeed Performance Report

Merging #5001 will not alter performance

Comparing integration/itx-refactor (89ad5dc) with main (387bb64)

Summary

✅ 11 untouched benchmarks

@jkomyno jkomyno assigned jkomyno and unassigned jkomyno Sep 23, 2024
@jkomyno
Copy link
Contributor

jkomyno commented Sep 23, 2024

I'm waiting for #5003 before being able to release a new integration version.

@aqrln aqrln force-pushed the integration/itx-refactor branch 4 times, most recently from 21703fd to 0014c6b Compare September 26, 2024 14:47
@aqrln aqrln modified the milestones: 5.20.0, 5.21.0 Sep 26, 2024
@aqrln aqrln force-pushed the integration/itx-refactor branch 2 times, most recently from d9c03d9 to ff4016d Compare October 10, 2024 12:23
@aqrln aqrln marked this pull request as ready for review October 24, 2024 15:38
@aqrln aqrln requested a review from a team as a code owner October 24, 2024 15:38
@aqrln aqrln requested review from jkomyno and removed request for a team October 24, 2024 15:38
@aqrln aqrln modified the milestones: 5.22.0, 6.0.0 Nov 4, 2024
@aqrln aqrln modified the milestones: 6.0.0, 5.22.0 Nov 4, 2024
/// immediately removed by the background task from the common hashmap. In this case, either
/// our operation will be first or the background cleanup task will be first. Both cases are
/// an acceptable outcome.
transactions: Arc<RwLock<HashMap<TxId, Arc<Mutex<InteractiveTransaction>>>>>,
Copy link
Member Author

@aqrln aqrln Nov 4, 2024

Choose a reason for hiding this comment

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

I was thinking about using DashMap here btw but I'm not sure if it's worth adding a new dependency. As Nikita wrote above, even though we use coarse-grained locking on the hash map, the lock is only held for a tiny fraction of time. I'm actually thinking even RwLock might not be worth it here and a regular Mutex would be just fine while having lower overhead. All of this is moot without benchmarks of course, just thinking out loud.

crosstarget_utils::time::sleep(timeout).await;
timeout_sender.send(tx_id).expect("receiver must exist");
}
});
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't add with_subscriber().with_recorder() here because neither is used in the task and it's fairly small

Comment on lines +71 to +73
// Note: This method creates a self-referential struct, which is why we need unsafe. Field
// `tx` is referencing field `conn` in the `Self::Open` variant.
let mut conn = Box::into_pin(conn);
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO: experiment with a dedicate Rust crate that removes unsafe, e.g.:

Copy link
Contributor

@jkomyno jkomyno left a comment

Choose a reason for hiding this comment

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

Lot of changes, but good job @aqrln!
I've left a couple of nit comments.

Co-authored-by: Alberto Schiabel <jkomyno@users.noreply.github.com>
@aqrln aqrln merged commit 531ffed into main Nov 5, 2024
385 of 386 checks passed
@aqrln aqrln deleted the integration/itx-refactor branch November 5, 2024 09:30
LucianBuzzo added a commit to LucianBuzzo/prisma-engines that referenced this pull request Nov 12, 2024
This file is unused, as the actors system was removed in prisma#5001
aqrln pushed a commit that referenced this pull request Nov 12, 2024
This file is unused, as the actors system was removed in #5001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment