Skip to content

Commit

Permalink
PgXactCallbackEvent shouldn't have been renamed
Browse files Browse the repository at this point in the history
* update bindings too
  • Loading branch information
eeeebbbbrrrr authored Apr 17, 2023
1 parent 8726d4f commit eda32f7
Show file tree
Hide file tree
Showing 9 changed files with 821 additions and 107 deletions.
4 changes: 2 additions & 2 deletions pgrx-examples/bad_ideas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ All rights reserved.
Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
use pgrx::prelude::*;
use pgrx::{check_for_interrupts, info, register_xact_callback, PgRelation, PgrxactCallbackEvent};
use pgrx::{check_for_interrupts, info, register_xact_callback, PgRelation, PgXactCallbackEvent};
use std::fs::File;
use std::io::Write;
use std::process::Command;
Expand Down Expand Up @@ -62,7 +62,7 @@ fn loop_forever() {

#[pg_extern]
fn random_abort() {
register_xact_callback(PgrxactCallbackEvent::PreCommit, || {
register_xact_callback(PgXactCallbackEvent::PreCommit, || {
info!("in xact callback pre-commit");

if rand::random::<bool>() {
Expand Down
279 changes: 268 additions & 11 deletions pgrx-pg-sys/src/pg11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,15 @@ pub const MAXIMUM_ALIGNOF: u32 = 8;
pub const MEMSET_LOOP_LIMIT: u32 = 1024;
pub const PACKAGE_BUGREPORT: &[u8; 26usize] = b"[email protected]\0";
pub const PACKAGE_NAME: &[u8; 11usize] = b"PostgreSQL\0";
pub const PACKAGE_STRING: &[u8; 17usize] = b"PostgreSQL 11.18\0";
pub const PACKAGE_STRING: &[u8; 17usize] = b"PostgreSQL 11.19\0";
pub const PACKAGE_TARNAME: &[u8; 11usize] = b"postgresql\0";
pub const PACKAGE_URL: &[u8; 1usize] = b"\0";
pub const PACKAGE_VERSION: &[u8; 6usize] = b"11.18\0";
pub const PACKAGE_VERSION: &[u8; 6usize] = b"11.19\0";
pub const PG_KRB_SRVNAM: &[u8; 9usize] = b"postgres\0";
pub const PG_MAJORVERSION: &[u8; 3usize] = b"11\0";
pub const PG_VERSION: &[u8; 6usize] = b"11.18\0";
pub const PG_VERSION_NUM: u32 = 110018;
pub const PG_VERSION_STR : & [u8 ; 103usize] = b"PostgreSQL 11.18 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, 64-bit\0" ;
pub const PG_VERSION: &[u8; 6usize] = b"11.19\0";
pub const PG_VERSION_NUM: u32 = 110019;
pub const PG_VERSION_STR : & [u8 ; 103usize] = b"PostgreSQL 11.19 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0, 64-bit\0" ;
pub const RELSEG_SIZE: u32 = 131072;
pub const SIZEOF_BOOL: u32 = 1;
pub const SIZEOF_LONG: u32 = 8;
Expand Down Expand Up @@ -726,6 +726,7 @@ pub const LC_MEASUREMENT_MASK: u32 = 2048;
pub const LC_IDENTIFICATION_MASK: u32 = 4096;
pub const LC_ALL_MASK: u32 = 8127;
pub const HAVE_PG_ATTRIBUTE_NORETURN: u32 = 1;
pub const HAVE_PRAGMA_GCC_SYSTEM_HEADER: u32 = 1;
pub const true_: u32 = 1;
pub const false_: u32 = 0;
pub const __bool_true_false_are_defined: u32 = 1;
Expand Down Expand Up @@ -1164,7 +1165,7 @@ pub const NI_DGRAM: u32 = 16;
pub const _PWD_H: u32 = 1;
pub const NSS_BUFLEN_PASSWD: u32 = 1024;
pub const PGINVALID_SOCKET: i32 = -1;
pub const PG_BACKEND_VERSIONSTR: &[u8; 29usize] = b"postgres (PostgreSQL) 11.18\n\0";
pub const PG_BACKEND_VERSIONSTR: &[u8; 29usize] = b"postgres (PostgreSQL) 11.19\n\0";
pub const EXE: &[u8; 1usize] = b"\0";
pub const DEVNULL: &[u8; 10usize] = b"/dev/null\0";
pub const PG_IOLBF: u32 = 1;
Expand Down Expand Up @@ -2174,6 +2175,7 @@ pub const XACT_FLAGS_ACCESSEDTEMPREL: u32 = 1;
pub const XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK: u32 = 2;
pub const XACT_FLAGS_ACCESSEDTEMPNAMESPACE: u32 = 4;
pub const XACT_FLAGS_NEEDIMMEDIATECOMMIT: u32 = 8;
pub const XACT_FLAGS_PIPELINING: u32 = 16;
pub const XLOG_XACT_COMMIT: u32 = 0;
pub const XLOG_XACT_PREPARE: u32 = 16;
pub const XLOG_XACT_ABORT: u32 = 32;
Expand Down Expand Up @@ -24453,11 +24455,11 @@ extern "C" {
pub static mut MyProc: *mut PGPROC;
}
extern "C" {
pub static mut MyPgrxact: *mut PGRXACT;
pub static mut MyPgXact: *mut PGXACT;
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct PGRXACT {
pub struct PGXACT {
pub xid: TransactionId,
pub xmin: TransactionId,
pub vacuumFlags: uint8,
Expand All @@ -24469,7 +24471,7 @@ pub struct PGRXACT {
#[derive(Debug, Copy, Clone)]
pub struct PROC_HDR {
pub allProcs: *mut PGPROC,
pub allPgrxact: *mut PGRXACT,
pub allPgXact: *mut PGXACT,
pub allProcCount: uint32,
pub freeProcs: *mut PGPROC,
pub autovacFreeProcs: *mut PGPROC,
Expand Down Expand Up @@ -40635,6 +40637,10 @@ extern "C" {
pub fn ExpireOldKnownAssignedTransactionIds(xid: TransactionId);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn KnownAssignedTransactionIdsIdleMaintenance();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn GetMaxSnapshotXidCount() -> ::std::os::raw::c_int;
}
Expand Down Expand Up @@ -53937,6 +53943,257 @@ impl Default for RuleLock {
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct SMgrRelationData {
pub smgr_rnode: RelFileNodeBackend,
pub smgr_owner: *mut *mut SMgrRelationData,
pub smgr_targblock: BlockNumber,
pub smgr_fsm_nblocks: BlockNumber,
pub smgr_vm_nblocks: BlockNumber,
pub smgr_which: ::std::os::raw::c_int,
pub md_num_open_segs: [::std::os::raw::c_int; 4usize],
pub md_seg_fds: [*mut _MdfdVec; 4usize],
pub node: dlist_node,
}
impl Default for SMgrRelationData {
fn default() -> Self {
let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
unsafe {
::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
pub type SMgrRelation = *mut SMgrRelationData;
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrinit();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgropen(rnode: RelFileNode, backend: BackendId) -> SMgrRelation;
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrexists(reln: SMgrRelation, forknum: ForkNumber) -> bool;
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrsetowner(owner: *mut SMgrRelation, reln: SMgrRelation);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrclearowner(owner: *mut SMgrRelation, reln: SMgrRelation);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrclose(reln: SMgrRelation);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrcloseall();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrclosenode(rnode: RelFileNodeBackend);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrcreate(reln: SMgrRelation, forknum: ForkNumber, isRedo: bool);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrdounlink(reln: SMgrRelation, isRedo: bool);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrdounlinkall(rels: *mut SMgrRelation, nrels: ::std::os::raw::c_int, isRedo: bool);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrdounlinkfork(reln: SMgrRelation, forknum: ForkNumber, isRedo: bool);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrextend(
reln: SMgrRelation,
forknum: ForkNumber,
blocknum: BlockNumber,
buffer: *mut ::std::os::raw::c_char,
skipFsync: bool,
);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrprefetch(reln: SMgrRelation, forknum: ForkNumber, blocknum: BlockNumber);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrread(
reln: SMgrRelation,
forknum: ForkNumber,
blocknum: BlockNumber,
buffer: *mut ::std::os::raw::c_char,
);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrwrite(
reln: SMgrRelation,
forknum: ForkNumber,
blocknum: BlockNumber,
buffer: *mut ::std::os::raw::c_char,
skipFsync: bool,
);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrwriteback(
reln: SMgrRelation,
forknum: ForkNumber,
blocknum: BlockNumber,
nblocks: BlockNumber,
);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrnblocks(reln: SMgrRelation, forknum: ForkNumber) -> BlockNumber;
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrtruncate(reln: SMgrRelation, forknum: ForkNumber, nblocks: BlockNumber);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrimmedsync(reln: SMgrRelation, forknum: ForkNumber);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrpreckpt();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrsync();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn smgrpostckpt();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn AtEOXact_SMgr();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdinit();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdclose(reln: SMgrRelation, forknum: ForkNumber);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdcreate(reln: SMgrRelation, forknum: ForkNumber, isRedo: bool);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdexists(reln: SMgrRelation, forknum: ForkNumber) -> bool;
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdunlink(rnode: RelFileNodeBackend, forknum: ForkNumber, isRedo: bool);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdextend(
reln: SMgrRelation,
forknum: ForkNumber,
blocknum: BlockNumber,
buffer: *mut ::std::os::raw::c_char,
skipFsync: bool,
);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdprefetch(reln: SMgrRelation, forknum: ForkNumber, blocknum: BlockNumber);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdread(
reln: SMgrRelation,
forknum: ForkNumber,
blocknum: BlockNumber,
buffer: *mut ::std::os::raw::c_char,
);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdwrite(
reln: SMgrRelation,
forknum: ForkNumber,
blocknum: BlockNumber,
buffer: *mut ::std::os::raw::c_char,
skipFsync: bool,
);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdwriteback(
reln: SMgrRelation,
forknum: ForkNumber,
blocknum: BlockNumber,
nblocks: BlockNumber,
);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdnblocks(reln: SMgrRelation, forknum: ForkNumber) -> BlockNumber;
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdtruncate(reln: SMgrRelation, forknum: ForkNumber, nblocks: BlockNumber);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdimmedsync(reln: SMgrRelation, forknum: ForkNumber);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdpreckpt();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdsync();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn mdpostckpt();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn SetForwardFsyncRequests();
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn RememberFsyncRequest(rnode: RelFileNode, forknum: ForkNumber, segno: BlockNumber);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn ForgetRelationFsyncRequests(rnode: RelFileNode, forknum: ForkNumber);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn ForgetDatabaseFsyncRequests(dbid: Oid);
}
#[pgrx_macros::pg_guard]
extern "C" {
pub fn DropRelationFiles(
delrels: *mut RelFileNode,
ndelrels: ::std::os::raw::c_int,
isRedo: bool,
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct LockRelId {
pub relId: Oid,
pub dbId: Oid,
Expand Down Expand Up @@ -53969,7 +54226,7 @@ pub type LockInfo = *mut LockInfoData;
#[derive(Debug, Copy, Clone)]
pub struct RelationData {
pub rd_node: RelFileNode,
pub rd_smgr: *mut SMgrRelationData,
pub rd_smgr: SMgrRelation,
pub rd_refcnt: ::std::os::raw::c_int,
pub rd_backend: BackendId,
pub rd_islocaltemp: bool,
Expand Down Expand Up @@ -55094,7 +55351,7 @@ pub struct SnapBuild {
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct SMgrRelationData {
pub struct _MdfdVec {
pub _address: u8,
}
#[repr(C)]
Expand Down
Loading

0 comments on commit eda32f7

Please sign in to comment.