review: create follow-up issue for changing BlockBuf::blocks

https://github.com/neondatabase/neon/pull/10063/files#r1880401785

Signed-off-by: Yuchen Liang <yuchen@neon.tech>
This commit is contained in:
Yuchen Liang
2024-12-11 19:13:08 +00:00
parent 3d4052f253
commit daf214e2e9
2 changed files with 5 additions and 1 deletions

View File

@@ -117,6 +117,8 @@ impl From<&DeltaLayer> for Summary {
impl Summary {
/// Serializes the summary header into an aligned buffer of lenth `PAGE_SZ`.
pub fn ser_into_page(&self) -> Result<IoBuffer, SerializeError> {
let mut buf = bytes::BytesMut::with_capacity(PAGE_SZ);
Self::ser_into(&self, &mut buf);
let mut buf = IoBufferMut::with_capacity(PAGE_SZ);
Self::ser_into(&self, &mut buf)?;
// Pad zeroes to the buffer so the length is a multiple of the alignment.

View File

@@ -887,9 +887,11 @@ impl ImageLayerWriterInner {
let file = self.blob_writer.into_inner(ctx).await?;
// Write out the index
// TODO(yuchen): should we just replace BlockBuf::blocks with one big buffer?
let mut offset = index_start_blk as u64 * PAGE_SZ as u64;
let (index_root_blk, block_buf) = self.tree.finish()?;
// TODO(yuchen): https://github.com/neondatabase/neon/issues/10092
// Should we just replace BlockBuf::blocks with one big buffer?
for buf in block_buf.blocks {
let (_buf, res) = file.write_all_at(buf.slice_len(), offset, ctx).await;
res?;