mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-31 20:10:38 +00:00
Replace Arc<Bytes> with BYtes because Bytes maintains its own reference counter
This commit is contained in:
@@ -282,7 +282,7 @@ pub struct PagestreamNblocksResponse {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PagestreamGetPageResponse {
|
||||
pub page: std::sync::Arc<Bytes>,
|
||||
pub page: Bytes,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -25,7 +25,7 @@ const TEST_PAGE_CACHE_SIZE: usize = 50;
|
||||
|
||||
enum PageImageState {
|
||||
Vacant, // entry is not used
|
||||
Loaded(Arc<Bytes>), // page is loaded
|
||||
Loaded(Bytes), // page is loaded
|
||||
Loading(Option<Arc<Condvar>>), // page in process of loading, Condvar is created on demand when some thread need to wait load completion
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ pub fn lookup(
|
||||
rel: RelTag,
|
||||
blkno: BlockNumber,
|
||||
lsn: Lsn,
|
||||
) -> Result<Arc<Bytes>> {
|
||||
) -> Result<Bytes> {
|
||||
let key = MaterializedPageHashKey {
|
||||
key: rel_block_to_key(rel, blkno),
|
||||
tenant_id: timeline.tenant_id,
|
||||
@@ -278,7 +278,7 @@ pub fn lookup(
|
||||
drop(cache); //release lock
|
||||
|
||||
// Load page
|
||||
let page = Arc::new(timeline.get_rel_page_at_lsn(rel, blkno, lsn, true)?);
|
||||
let page = timeline.get_rel_page_at_lsn(rel, blkno, lsn, true)?;
|
||||
|
||||
cache = this.lock().unwrap();
|
||||
if let PageImageState::Loading(event) = &cache.pages[index].state {
|
||||
|
||||
Reference in New Issue
Block a user