Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat:reduce backend log level
  • Loading branch information
darthunix committed Nov 29, 2025
commit b899e6ea1236f5d03ae7201a3e40c260bcfdb023
24 changes: 12 additions & 12 deletions postgres/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ unsafe extern "C-unwind" fn begin_df_scan(
Ok(s) => s,
Err(e) => error!("Failed to map shared connection: {}", e),
};
pgrx::info!("begin_df_scan: requesting BeginScan (conn={})", id);
pgrx::debug1!("begin_df_scan: requesting BeginScan (conn={})", id);
if let Err(err) = request_begin_scan(&mut shared.recv) {
let _ = request_failure(&mut shared.recv);
let _ = shared.signal_server();
Expand Down Expand Up @@ -488,7 +488,7 @@ unsafe extern "C-unwind" fn exec_df_scan(
};
EXEC_SCAN_STARTED.with(|started| {
if !started.get() {
pgrx::info!("exec_df_scan: requesting ExecScan (conn={})", id);
pgrx::debug1!("exec_df_scan: requesting ExecScan (conn={})", id);
if let Err(err) = request_exec_scan(&mut shared.recv) {
let _ = request_failure(&mut shared.recv);
let _ = shared.signal_server();
Expand Down Expand Up @@ -526,7 +526,7 @@ unsafe extern "C-unwind" fn exec_df_scan(
}
match ControlPacket::try_from(header.tag) {
Ok(ControlPacket::ExecReady) => {
pgrx::info!("exec_df_scan: ExecReady received (conn={})", id);
pgrx::debug1!("exec_df_scan: ExecReady received (conn={})", id);
EXEC_READY_SEEN.with(|seen| seen.set(true));
break;
}
Expand Down Expand Up @@ -603,7 +603,7 @@ fn process_pending_heap_request(shared: &mut ConnectionShared) {
if let Ok((scan_id, table_oid, slot_id)) =
read_heap_block_request(&mut shared.send)
{
pgrx::info!(
pgrx::debug1!(
"process_pending_heap_request: heap request received scan_id={} table_oid={} slot_id={}",
scan_id, table_oid, slot_id
);
Expand All @@ -617,7 +617,7 @@ fn process_pending_heap_request(shared: &mut ConnectionShared) {
*e = e.saturating_add(1);
cur
};
pgrx::info!(
pgrx::debug1!(
"process_pending_heap_request: computed blkno={} for scan_id={}",
blkno,
scan_id
Expand Down Expand Up @@ -647,7 +647,7 @@ fn process_pending_heap_request(shared: &mut ConnectionShared) {
} as u32;
if blkno >= nblocks {
// End of relation reached: send EOF for this scan
pgrx::info!(
pgrx::debug1!(
"process_pending_heap_request: EOF scan_id={} slot_id={} (blkno {} >= nblocks {})",
scan_id, slot_id, blkno, nblocks
);
Expand Down Expand Up @@ -714,7 +714,7 @@ fn process_pending_heap_request(shared: &mut ConnectionShared) {
}
}
// Publish to shared memory + notify executor
pgrx::info!(
pgrx::debug1!(
"process_pending_heap_request: publishing page scan_id={} slot_id={} table_oid={} blkno={} num_offsets={} vis_bytes={}",
scan_id, slot_id, table_oid, blkno, num_offsets, vis.len()
);
Expand Down Expand Up @@ -768,10 +768,10 @@ unsafe fn try_store_wire_tuple_from_result(
let mut ring = LockFreeBuffer::from_layout(base, layout);
let avail = ring.len();
if avail == 0 {
pgrx::info!("result_ring: empty (conn={})", conn_id);
pgrx::debug1!("result_ring: empty (conn={})", conn_id);
return None;
}
pgrx::info!("result_ring: bytes available={} (conn={})", avail, conn_id);
pgrx::debug1!("result_ring: bytes available={} (conn={})", avail, conn_id);
use std::io::Read;
// Read fixed 4-byte little-endian row_len
let row_len = match protocol::result::read_frame_len(&mut ring) {
Expand All @@ -785,10 +785,10 @@ unsafe fn try_store_wire_tuple_from_result(
return None;
}
};
pgrx::info!("result_ring: frame_len={} (conn={})", row_len, conn_id);
pgrx::debug1!("result_ring: frame_len={} (conn={})", row_len, conn_id);
if row_len == 0 {
// EOF sentinel
pgrx::info!("result_ring: EOF sentinel (conn={})", conn_id);
pgrx::debug1!("result_ring: EOF sentinel (conn={})", conn_id);
RESULT_RING_EOF.with(|f| f.set(true));
return None;
}
Expand Down Expand Up @@ -1018,7 +1018,7 @@ fn wait_latch(timeout: Option<Duration>) {
check_for_interrupts!();
if rc & WL_TIMEOUT as i32 != 0 {
// Timeout is expected in non-blocking polling; do not raise ERROR.
pgrx::info!("wait_latch: timeout (non-fatal)");
pgrx::debug1!("wait_latch: timeout (non-fatal)");
} else if rc & WL_POSTMASTER_DEATH as i32 != 0 {
panic!("Postmaster is dead");
}
Expand Down
10 changes: 5 additions & 5 deletions postgres/src/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ impl ConnectionShared<'_> {
self.flag.store(true, Ordering::Release);
// Best-effort diagnostics
if let Ok(id) = crate::ipc::connection_id() {
pgrx::info!("signal_server: flag set (conn={})", id);
pgrx::debug1!("signal_server: flag set (conn={})", id);
} else {
pgrx::info!("signal_server: flag set (conn=?), pid unknown");
pgrx::debug1!("signal_server: flag set (conn=?), pid unknown");
}

// Best-effort: wait briefly for the worker to publish PID.
Expand All @@ -104,7 +104,7 @@ impl ConnectionShared<'_> {
return Err(std::io::Error::last_os_error().into());
}
if let Ok(id) = crate::ipc::connection_id() {
pgrx::info!("signal_server: SIGUSR1 sent (conn={} pid={})", id, pid);
pgrx::debug1!("signal_server: SIGUSR1 sent (conn={} pid={})", id, pid);
}
Ok(())
}
Expand Down Expand Up @@ -142,8 +142,8 @@ pub(crate) fn connection_shared(id: u32) -> AnyResult<ConnectionShared<'static>>
let client_pid_ref: &'static AtomicI32 = unsafe { &*client_ptr };
let server_pid_ref: &'static AtomicI32 = crate::worker::server_pid_atomic();

// Diagnostics: log addresses once per call (cheap and helps correlate with worker)
pgrx::info!(
// Diagnostics: lower level to avoid noisy INFO in production
pgrx::debug1!(
"connection_shared: id={} recv_base={:?} recv_buf={:?} send_base={:?}",
id,
recv_base,
Expand Down
16 changes: 8 additions & 8 deletions postgres/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub(crate) const RESULT_RING_CAP: usize = 64 * 1024; // bytes per-connection for

#[pg_guard]
pub(crate) unsafe extern "C-unwind" fn init_datafusion_worker() {
info!("Registering DataFusion background worker");
debug1!("Registering DataFusion background worker");
BackgroundWorkerBuilder::new("datafusion")
.set_function("worker_main")
.set_library("pg_fusion")
Expand All @@ -50,7 +50,7 @@ pub unsafe extern "C-unwind" fn init_shmem() {
if !found {
std::ptr::write_bytes(base, 0, shared.layout.size());
}
info!(
debug1!(
"init_shmem: flags region ready: bytes={} count={} found={}",
shared.layout.size(),
num,
Expand All @@ -76,7 +76,7 @@ pub unsafe extern "C-unwind" fn init_shmem() {
unsafe { (*client_ptr).store(i32::MAX, Ordering::Relaxed) };
}
}
info!(
debug1!(
"init_shmem: connections region ready: bytes_per_conn={} total_bytes={} recv_cap={} send_cap={} count={} found={}",
layout.layout.size(), total, RECV_CAP, SEND_CAP, num, found
);
Expand All @@ -98,7 +98,7 @@ pub unsafe extern "C-unwind" fn init_shmem() {
}
// Publish base and layout to executor module for in-process access
executor::shm::set_slot_blocks(base, layout);
info!(
debug1!(
"init_shmem: slot blocks ready: bytes_per_conn={} total_bytes={} slots_per_conn={} blocks_per_slot={} blksz={} count={} found={}",
layout.layout.size(), total, SLOTS_PER_CONN, BLOCKS_PER_SLOT, blksz, num, found
);
Expand Down Expand Up @@ -189,7 +189,7 @@ pub extern "C-unwind" fn worker_main(_arg: pg_sys::Datum) {
let num = crate::max_backends() as usize;
init_tracing_file_logger();
let pid = unsafe { libc::getpid() };
info!(
debug1!(
"worker_main: starting DataFusion worker pid={} max_backends={}",
pid, num
);
Expand All @@ -207,7 +207,7 @@ pub extern "C-unwind" fn worker_main(_arg: pg_sys::Datum) {
slice::from_raw_parts(flags_ptr, num)
};
let state = Arc::new(executor::ipc::SharedState::new(flags_slice));
info!(
debug1!(
"worker_main: SharedState ready (flags={})",
flags_slice.len()
);
Expand All @@ -224,7 +224,7 @@ pub extern "C-unwind" fn worker_main(_arg: pg_sys::Datum) {
let pid_ptr = executor::layout::server_pid_ptr(base, layout);
let pid = libc::getpid();
(*pid_ptr).store(pid as i32, Ordering::Relaxed);
info!("worker_main: published server pid={}", pid);
debug1!("worker_main: published server pid={}", pid);
}

// Build runtime
Expand All @@ -233,7 +233,7 @@ pub extern "C-unwind" fn worker_main(_arg: pg_sys::Datum) {
.enable_all()
.build()
.unwrap();
info!(
debug1!(
"worker_main: tokio runtime built, threads={}",
TOKIO_THREAD_NUMBER
);
Expand Down