pageserver: return correct LSN for interpreted proto keep alive responses (#9928)

## Problem

For the interpreted proto the pageserver is not returning the correct
LSN
in replies to keep alive requests. This is because the interpreted
protocol arm
was not updating `last_rec_lsn`.

## Summary of changes

* Return correct LSN in keep-alive responses
* Fix shard field in wal sender traces
This commit is contained in:
Vlad Lazar
2024-11-28 17:38:47 +00:00
committed by GitHub
parent eb5d832e6f
commit eb520a14ce
3 changed files with 8 additions and 3 deletions

View File

@@ -454,6 +454,10 @@ pub(super) async fn handle_walreceiver_connection(
timeline.get_last_record_lsn()
);
if let Some(lsn) = next_record_lsn {
last_rec_lsn = lsn;
}
Some(streaming_lsn)
}

View File

@@ -212,8 +212,9 @@ impl<IO: AsyncRead + AsyncWrite + Unpin + Send> postgres_backend::Handler<IO>
);
if let Some(shard) = self.shard.as_ref() {
tracing::Span::current()
.record("shard", tracing::field::display(shard.shard_slug()));
if let Some(slug) = shard.shard_slug().strip_prefix("-") {
tracing::Span::current().record("shard", tracing::field::display(slug));
}
}
Ok(())

View File

@@ -44,7 +44,7 @@ pub async fn task_main(
error!("connection handler exited: {}", err);
}
}
.instrument(info_span!("", cid = %conn_id, ttid = field::Empty, application_name = field::Empty)),
.instrument(info_span!("", cid = %conn_id, ttid = field::Empty, application_name = field::Empty, shard = field::Empty)),
);
}
}