combine UploadedQueueStopped fields

This commit is contained in:
Dmitry Rodionov
2023-04-12 20:36:19 +03:00
parent 23b3c66abf
commit 3ffdb196bf
2 changed files with 6 additions and 10 deletions

View File

@@ -342,7 +342,7 @@ impl RemoteTimelineClient {
match &*self.upload_queue.lock().unwrap() {
UploadQueue::Uninitialized => None,
UploadQueue::Initialized(q) => Some(q.last_uploaded_consistent_lsn),
UploadQueue::Stopped(q) => Some(q.last_uploaded_consistent_lsn),
UploadQueue::Stopped(q) => Some(q.last_uploaded_index_part.disk_consistent_lsn),
}
}
@@ -643,9 +643,8 @@ impl RemoteTimelineClient {
UploadQueue::Stopped(stopped) => stopped,
};
stopped.index_part.is_deleted = true;
stopped.index_part.clone()
stopped.last_uploaded_index_part.is_deleted = true;
stopped.last_uploaded_index_part.clone()
};
upload::upload_index_part(
@@ -990,12 +989,10 @@ impl RemoteTimelineClient {
// Replace the queue with the Stopped state, taking ownership of the old
// Initialized queue. We will do some checks on it, and then drop it.
let qi = {
let last_uploaded_consistent_lsn = qi.last_uploaded_consistent_lsn;
let upload_queue = std::mem::replace(
&mut *guard,
UploadQueue::Stopped(UploadQueueStopped {
last_uploaded_consistent_lsn,
index_part,
last_uploaded_index_part: index_part,
}),
);
if let UploadQueue::Initialized(qi) = upload_queue {

View File

@@ -76,9 +76,8 @@ pub(crate) struct UploadQueueInitialized {
}
pub(crate) struct UploadQueueStopped {
pub(crate) last_uploaded_consistent_lsn: Lsn,
// Index part is needed here so timeline_delete can access it
pub(super) index_part: IndexPart,
/// Index part is needed here so timeline_delete can access it
pub(super) last_uploaded_index_part: IndexPart,
}
impl UploadQueue {