From e0322689f1950e62c9b0cd7434e65130643d7943 Mon Sep 17 00:00:00 2001 From: Cuong Nguyen Date: Tue, 31 Oct 2023 17:42:47 -0400 Subject: [PATCH] Revert "Pick latest available lsn. Add more metrics" This reverts commit 1ecb9086b0efd8926c769d8d5296cdb6d731e6fd. --- pageserver/src/http/routes.rs | 2 +- pageserver/src/tenant/timeline.rs | 4 ++-- .../src/tenant/timeline/walreceiver/walreceiver_connection.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pageserver/src/http/routes.rs b/pageserver/src/http/routes.rs index 226ec03f96d7..f45e5a276a72 100644 --- a/pageserver/src/http/routes.rs +++ b/pageserver/src/http/routes.rs @@ -254,7 +254,7 @@ async fn build_timeline_info_common( crate::tenant::debug_assert_current_span_has_tenant_and_timeline_id(); let last_record_lsn = timeline.get_last_record_lsn(); let (wal_source_connstr, last_received_msg_lsn, last_received_msg_ts) = { - let guard = timeline.last_received_wal.read().unwrap(); + let guard = timeline.last_received_wal.lock().unwrap(); if let Some(info) = guard.as_ref() { ( Some(format!("{:?}", info.wal_source_connconf)), // Password is hidden, but it's for statistics only. diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index 10e6ed66b754..9965356d2dbd 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -275,7 +275,7 @@ pub struct Timeline { /// Information about the last processed message by the WAL receiver, /// or None if WAL receiver has not received anything for this timeline /// yet. - pub last_received_wal: RwLock>, + pub last_received_wal: Mutex>, pub walreceiver: Mutex>, /// Relation size cache @@ -1467,7 +1467,7 @@ impl Timeline { partitioning: Mutex::new((KeyPartitioning::new(), Lsn(0))), repartition_threshold: 0, - last_received_wal: RwLock::new(None), + last_received_wal: Mutex::new(None), rel_size_cache: RwLock::new(HashMap::new()), download_all_remote_layers_task_info: RwLock::new(None), diff --git a/pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs b/pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs index 7499c8c3782f..e22f7a1a7361 100644 --- a/pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs +++ b/pageserver/src/tenant/timeline/walreceiver/walreceiver_connection.rs @@ -408,7 +408,7 @@ pub(super) async fn handle_walreceiver_connection( .expect("Received message time should be before UNIX EPOCH!") .as_micros(), }; - *timeline.last_received_wal.write().unwrap() = Some(last_received_wal); + *timeline.last_received_wal.lock().unwrap() = Some(last_received_wal); // Send the replication feedback message. // Regular standby_status_update fields are put into this message.