mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-19 10:13:08 +00:00
Seems to work
This commit is contained in:
@@ -185,6 +185,7 @@ pub struct CReadSlruSegmentRequest {
|
||||
pub request_id: u64,
|
||||
pub slru_kind: SlruKind,
|
||||
pub segment_number: u32,
|
||||
pub request_lsn: CLsn,
|
||||
|
||||
// pub spc_oid: COid,
|
||||
// pub db_oid: COid,
|
||||
|
||||
@@ -427,7 +427,7 @@ impl<'t> CommunicatorWorkerProcessStruct<'t> {
|
||||
}
|
||||
NeonIORequest::ReadSlruSegment(req) => {
|
||||
self.request_read_slru_segment_counter.inc();
|
||||
let lsn = self.cache.get_lsn();
|
||||
let lsn = Lsn(req.request_lsn);
|
||||
|
||||
match self
|
||||
.client
|
||||
@@ -447,7 +447,7 @@ impl<'t> CommunicatorWorkerProcessStruct<'t> {
|
||||
std::ptr::copy_nonoverlapping(src.as_ptr(), dest.as_mut_ptr(), len);
|
||||
};
|
||||
|
||||
let blocks_count = len / (crate::BLCKSZ * crate::SLRU_PAGES_PER_SEGMENT);
|
||||
let blocks_count = len / crate::BLCKSZ;
|
||||
|
||||
NeonIOResult::ReadSlruSegment(blocks_count as _)
|
||||
}
|
||||
|
||||
@@ -997,7 +997,6 @@ communicator_new_dbsize(Oid dbNode)
|
||||
}
|
||||
|
||||
int
|
||||
// communicator_new_read_slru_segment(SlruKind kind, uint32_t segno, void *buffer)
|
||||
communicator_new_read_slru_segment(
|
||||
SlruKind kind,
|
||||
uint32_t segno,
|
||||
@@ -1011,7 +1010,8 @@ communicator_new_read_slru_segment(
|
||||
.request_id = assign_request_id(),
|
||||
.slru_kind = kind,
|
||||
.segment_number = segno,
|
||||
.dest.ptr = buffer,
|
||||
.request_lsn = request_lsns->request_lsn,
|
||||
.dest.ptr = bounce_buf(),
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1021,9 +1021,11 @@ communicator_new_read_slru_segment(
|
||||
XLogSetAsyncXactLSN(request_lsns->request_lsn);
|
||||
|
||||
perform_request(&request, &result);
|
||||
|
||||
switch (result.tag)
|
||||
{
|
||||
case NeonIOResult_ReadSlruSegment:
|
||||
memcpy(buffer, request.read_slru_segment.dest.ptr, 8192);
|
||||
return result.read_slru_segment;
|
||||
case NeonIOResult_Error:
|
||||
ereport(ERROR,
|
||||
@@ -1035,6 +1037,8 @@ communicator_new_read_slru_segment(
|
||||
elog(ERROR, "unexpected result for read SLRU operation: %d", result.tag);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Write requests */
|
||||
|
||||
@@ -38,8 +38,6 @@ extern void communicator_new_prefetch_register_bufferv(NRelFileInfo rinfo, ForkN
|
||||
BlockNumber nblocks);
|
||||
extern bool communicator_new_cache_contains(NRelFileInfo rinfo, ForkNumber forkNum,
|
||||
BlockNumber blockno);
|
||||
// extern int communicator_new_read_slru_segment(SlruKind kind, uint32_t segno,
|
||||
// void *buffer);
|
||||
extern int communicator_new_read_slru_segment(
|
||||
SlruKind kind,
|
||||
uint32_t segno,
|
||||
|
||||
Reference in New Issue
Block a user