Revert "CAUTION: disable synchronous commit"

This reverts commit 4e0a8211ac.
This commit is contained in:
GroovieGermanikus 2024-02-27 20:48:09 +01:00
parent 4e0a8211ac
commit 36845d7c81
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
2 changed files with 3 additions and 13 deletions

View File

@ -347,7 +347,7 @@ async fn main() -> anyhow::Result<()> {
// maintain a global serial version for deterministic transaction ordering
let error_plugin_write_version = Arc::new(AtomicU64::new(0));
let postgres1 = postgres::Postgres::new_for_write(0).await;
let postgres1 = postgres::Postgres::new_with_workmem(0).await;
let slot = Arc::new(AtomicU64::new(0));
let no_block_subscription = grpc_block_addr.is_none();
let alts = args.alts;
@ -365,7 +365,7 @@ async fn main() -> anyhow::Result<()> {
let mut block_senders = vec![];
for i in 1..=4 {
let s = postgres::Postgres::new_for_write(i)
let s = postgres::Postgres::new_with_workmem(i)
.await
.spawn_block_saver();
block_senders.push(s);

View File

@ -184,14 +184,6 @@ impl PostgresSession {
info!("Configured work_mem={}", work_mem);
}
pub async fn disable_synchronous_commit(&self) {
self.client
.execute("SET synchronous_commit=off", &[])
.await
.unwrap();
info!("Turn synchronous_commit off!");
}
pub async fn drop_temp_table(&self, table: String) -> anyhow::Result<()> {
self.client
.execute(format!("drop table if exists {};", table).as_str(), &[])
@ -1273,12 +1265,10 @@ pub struct Postgres {
}
impl Postgres {
/// Connection optimized for write operations
pub async fn new_for_write(nb: usize) -> Self {
pub async fn new_with_workmem(nb: usize) -> Self {
let session = PostgresSession::new(nb).await.unwrap();
let session = Arc::new(session);
session.configure_work_mem().await;
session.disable_synchronous_commit().await;
Self { session }
}