Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ pub struct ChConn {
instance: Option<String>,
selected: Option<Arc<EmitterConfig>>,
active: Connection,
parked: std::collections::HashMap<Option<String>, Connection>,
parked: ahash::HashMap<Option<String>, Connection>,
dest: Arc<DestEmitter>,
dials: u64,
}
Expand Down
30 changes: 20 additions & 10 deletions src/xact/spill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,16 @@ use ahash::{HashMap, HashMapExt};
#[derive(Debug, Clone, PartialEq)]
pub enum SpillEntry {
Heap(Box<DescribedHeap>),
Chunk(ToastChunk),
ToastDelete(ToastDelete),
Chunk(Box<ToastChunk>),
ToastDelete(Box<ToastDelete>),
/// Undecoded record on a filenode invisible at record time (same-xact
/// CREATE / TRUNCATE / rewrite generation); decoded at commit once
/// `relation_at(rfn, commit_lsn)` resolves the survivor
Raw(Box<RawRecord>),
}

const _: () = assert!(std::mem::size_of::<SpillEntry>() <= 16);

/// Raw decode inputs for one WAL record, enough to re-run
/// [`crate::decode::heap_decoder::decode_heap_record`] after commit-time
/// resolution. Block images survive so an insert whose tuple lives only
Expand Down Expand Up @@ -752,8 +754,10 @@ impl SpillReader {
descriptor_valid_from: valid_from,
}))
}
TAG_CHUNK => SpillEntry::Chunk(decode_chunk(&mut cur)?),
TAG_TOAST_DELETE => SpillEntry::ToastDelete(decode_toast_delete(&mut cur)?),
TAG_CHUNK => SpillEntry::Chunk(Box::new(decode_chunk(&mut cur)?)),
TAG_TOAST_DELETE => {
SpillEntry::ToastDelete(Box::new(decode_toast_delete(&mut cur)?))
}
TAG_RAW => SpillEntry::Raw(Box::new(decode_raw(&mut cur)?)),
TAG_DESCRIPTOR => {
let valid_from = cur.u64()?;
Expand Down Expand Up @@ -1531,12 +1535,12 @@ mod tests {
for remaining in [1, 3, 5, 31] {
let mut writer = store.writer(42, remaining).await.unwrap();
writer
.write_batch(vec![SpillEntry::Chunk(sample_chunk(
.write_batch(vec![SpillEntry::Chunk(Box::new(sample_chunk(
99,
0,
0x2000,
&vec![7; IO_CHUNK + 1],
))])
)))])
.await
.unwrap();
let mut reader = writer.finish().await.unwrap();
Expand Down Expand Up @@ -1564,7 +1568,7 @@ mod tests {
w.write_batch(vec![SpillEntry::Heap(Box::new(h.clone()))])
.await
.unwrap();
w.write_batch(vec![SpillEntry::Chunk(c.clone())])
w.write_batch(vec![SpillEntry::Chunk(Box::new(c.clone()))])
.await
.unwrap();
let bc = w.byte_count();
Expand All @@ -1574,7 +1578,10 @@ mod tests {
r.next().await.unwrap().unwrap(),
SpillEntry::Heap(Box::new(h))
);
assert_eq!(r.next().await.unwrap().unwrap(), SpillEntry::Chunk(c));
assert_eq!(
r.next().await.unwrap().unwrap(),
SpillEntry::Chunk(Box::new(c))
);
assert!(r.next().await.unwrap().is_none(), "EOF expected");
r.unlink().await.unwrap();
}
Expand All @@ -1591,11 +1598,14 @@ mod tests {
offnum: 9,
source_lsn: 0x2200,
};
w.write_batch(vec![SpillEntry::ToastDelete(d)])
w.write_batch(vec![SpillEntry::ToastDelete(Box::new(d))])
.await
.unwrap();
let mut r = w.finish().await.unwrap();
assert_eq!(r.next().await.unwrap().unwrap(), SpillEntry::ToastDelete(d));
assert_eq!(
r.next().await.unwrap().unwrap(),
SpillEntry::ToastDelete(Box::new(d))
);
assert!(r.next().await.unwrap().is_none());
r.unlink().await.unwrap();
}
Expand Down
8 changes: 4 additions & 4 deletions src/xact/xact_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ impl XactBuffer {
xid: u32,
) -> std::result::Result<(), XactBufferError> {
let first_lsn = chunk.source_lsn;
let entry = SpillEntry::Chunk(chunk);
let entry = SpillEntry::Chunk(Box::new(chunk));
self.absorb(xid, first_lsn, entry).await
}

Expand All @@ -979,7 +979,7 @@ impl XactBuffer {
xid: u32,
) -> std::result::Result<(), XactBufferError> {
let first_lsn = delete.source_lsn;
self.absorb(xid, first_lsn, SpillEntry::ToastDelete(delete))
self.absorb(xid, first_lsn, SpillEntry::ToastDelete(Box::new(delete)))
.await
}

Expand Down Expand Up @@ -1795,8 +1795,8 @@ impl MergedDrain {
self.check_owned(h.decoded.xid)?;
return Ok(Some(MergeItem::Heap(h)));
}
SpillEntry::Chunk(c) => self.fold_chunk(c)?,
SpillEntry::ToastDelete(d) => self.fold_delete(d)?,
SpillEntry::Chunk(c) => self.fold_chunk(*c)?,
SpillEntry::ToastDelete(d) => self.fold_delete(*d)?,
SpillEntry::Raw(raw) => self.fold_raw(&raw)?,
}
}
Expand Down
Loading