mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-17 17:23:00 +00:00
moar cpu efficiency
This commit is contained in:
@@ -521,6 +521,21 @@ impl InMemoryLayer {
|
||||
self.put_value_locked(&mut inner, key, lsn, buf, ctx).await
|
||||
}
|
||||
|
||||
pub(crate) async fn put_values(
|
||||
&self,
|
||||
values: Vec<(Lsn, Key, smallvec::SmallVec<[u8; 256]>)>,
|
||||
ctx: &RequestContext,
|
||||
) -> Result<()> {
|
||||
let mut inner = self.inner.write().await;
|
||||
self.assert_writable();
|
||||
for (lsn, key, buf) in values {
|
||||
self.put_value_locked(&mut inner, key, lsn, &buf, ctx)
|
||||
.await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn put_value_locked(
|
||||
&self,
|
||||
locked_inner: &mut RwLockWriteGuard<'_, InMemoryLayerInner>,
|
||||
|
||||
@@ -6018,9 +6018,7 @@ impl<'a> TimelineWriter<'a> {
|
||||
.handle_open_layer_action(first_lsn, action, ctx)
|
||||
.await?;
|
||||
|
||||
for (lsn, key, buf) in serialized {
|
||||
layer.put_value(key, lsn, &buf, ctx).await?;
|
||||
}
|
||||
layer.put_values(serialized, ctx).await?;
|
||||
|
||||
// Update the current size only when the entire write was ok.
|
||||
// In case of failures, we may have had partial writes which
|
||||
|
||||
Reference in New Issue
Block a user