Revert "CAUTION: disable synchronous commit"
This reverts commit 4e0a8211ac
.
This commit is contained in:
parent
4e0a8211ac
commit
36845d7c81
|
@ -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);
|
||||
|
|
|
@ -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 }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue