Skip to content
Open
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
1,002 changes: 753 additions & 249 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions crates/ruvector-postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pg14 = ["pgrx/pg14", "pgrx-tests/pg14"]
pg15 = ["pgrx/pg15", "pgrx-tests/pg15"]
pg16 = ["pgrx/pg16", "pgrx-tests/pg16"]
pg17 = ["pgrx/pg17", "pgrx-tests/pg17"]
pg18 = ["pgrx/pg18", "pgrx-tests/pg18"]
pg_test = []

# SIMD features for compile-time selection
Expand Down Expand Up @@ -64,7 +65,7 @@ all-features = ["ai-complete", "graph-complete", "embeddings"]

[dependencies]
# PostgreSQL extension framework
pgrx = "0.12"
pgrx = "0.16"

# Pin home to avoid edition2024 issues
home = "=0.5.9"
Expand Down Expand Up @@ -123,7 +124,7 @@ fastembed = { version = "5", optional = true }
# ruvector-core = { path = "../ruvector-core", optional = true }

[dev-dependencies]
pgrx-tests = "0.12"
pgrx-tests = "0.16"
criterion = "0.5"
proptest = "1.4"
approx = "0.5"
Expand Down Expand Up @@ -173,3 +174,4 @@ pg14 = "pg14"
pg15 = "pg15"
pg16 = "pg16"
pg17 = "pg17"
pg18 = "pg18"
2 changes: 1 addition & 1 deletion crates/ruvector-postgres/src/healing/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ impl HealingWorker {

/// PostgreSQL background worker entry point
#[pgrx::pg_guard]
pub extern "C" fn healing_bgworker_main(_arg: pgrx::pg_sys::Datum) {
pub extern "C-unwind" fn healing_bgworker_main(_arg: pgrx::pg_sys::Datum) {
pgrx::log!("RuVector healing background worker starting");

let config = HealingWorkerConfig::default();
Expand Down
2 changes: 1 addition & 1 deletion crates/ruvector-postgres/src/index/bgworker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ fn get_worker_state() -> &'static Arc<BgWorkerState> {
///
/// This is registered with PostgreSQL and runs in a separate background process.
#[pg_guard]
pub extern "C" fn ruvector_bgworker_main(_arg: pg_sys::Datum) {
pub extern "C-unwind" fn ruvector_bgworker_main(_arg: pg_sys::Datum) {
// Initialize worker
pgrx::log!("RuVector background worker starting");

Expand Down
32 changes: 16 additions & 16 deletions crates/ruvector-postgres/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ static HYBRID_PREFETCH_K: GucSetting<i32> = GucSetting::<i32>::new(100);

/// Called when the extension is loaded
#[pg_guard]
pub extern "C" fn _PG_init() {
pub extern "C-unwind" fn _PG_init() {
// Initialize SIMD dispatch
distance::init_simd_dispatch();

// Register GUCs
GucRegistry::define_int_guc(
"ruvector.ef_search",
"HNSW ef_search parameter for query time",
"Higher values improve recall at the cost of speed",
c"ruvector.ef_search",
c"HNSW ef_search parameter for query time",
c"Higher values improve recall at the cost of speed",
&EF_SEARCH,
1,
1000,
Expand All @@ -83,9 +83,9 @@ pub extern "C" fn _PG_init() {
);

GucRegistry::define_int_guc(
"ruvector.probes",
"IVFFlat number of lists to probe",
"Higher values improve recall at the cost of speed",
c"ruvector.probes",
c"IVFFlat number of lists to probe",
c"Higher values improve recall at the cost of speed",
&PROBES,
1,
10000,
Expand All @@ -95,9 +95,9 @@ pub extern "C" fn _PG_init() {

// Hybrid search GUCs
GucRegistry::define_float_guc(
"ruvector.hybrid_alpha",
"Default alpha for hybrid linear fusion (0=keyword only, 1=vector only)",
"Controls the blend between vector and keyword search",
c"ruvector.hybrid_alpha",
c"Default alpha for hybrid linear fusion (0=keyword only, 1=vector only)",
c"Controls the blend between vector and keyword search",
&HYBRID_ALPHA,
0.0,
1.0,
Expand All @@ -106,9 +106,9 @@ pub extern "C" fn _PG_init() {
);

GucRegistry::define_int_guc(
"ruvector.hybrid_rrf_k",
"RRF constant for hybrid search (default 60)",
"Lower values give more weight to top-ranked results",
c"ruvector.hybrid_rrf_k",
c"RRF constant for hybrid search (default 60)",
c"Lower values give more weight to top-ranked results",
&HYBRID_RRF_K,
1,
1000,
Expand All @@ -117,9 +117,9 @@ pub extern "C" fn _PG_init() {
);

GucRegistry::define_int_guc(
"ruvector.hybrid_prefetch_k",
"Number of results to prefetch from each branch",
"Higher values improve recall but increase latency",
c"ruvector.hybrid_prefetch_k",
c"Number of results to prefetch from each branch",
c"Higher values improve recall but increase latency",
&HYBRID_PREFETCH_K,
1,
10000,
Expand Down
10 changes: 5 additions & 5 deletions crates/ruvector-postgres/src/types/vector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ pub fn ruvector_out_fn(v: RuVector) -> String {
/// This is the PostgreSQL IN function for the ruvector type.
#[pg_guard]
#[no_mangle]
pub extern "C" fn ruvector_in(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
pub extern "C-unwind" fn ruvector_in(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
unsafe {
let datum = (*fcinfo).args.as_ptr().add(0).read().value;
let input_cstr = datum.cast_mut_ptr::<std::os::raw::c_char>();
Expand Down Expand Up @@ -435,7 +435,7 @@ pub extern "C" fn pg_finfo_ruvector_in() -> &'static pg_sys::Pg_finfo_record {
/// Text output function: Convert RuVector to '[1.0, 2.0, 3.0]'
#[pg_guard]
#[no_mangle]
pub extern "C" fn ruvector_out(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
pub extern "C-unwind" fn ruvector_out(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
unsafe {
let datum = (*fcinfo).args.as_ptr().add(0).read().value;
let varlena_ptr = datum.cast_mut_ptr::<pg_sys::varlena>();
Expand Down Expand Up @@ -467,7 +467,7 @@ pub extern "C" fn pg_finfo_ruvector_out() -> &'static pg_sys::Pg_finfo_record {
/// Binary input function: Receive vector from network in binary format
#[pg_guard]
#[no_mangle]
pub extern "C" fn ruvector_recv(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
pub extern "C-unwind" fn ruvector_recv(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
unsafe {
let datum = (*fcinfo).args.as_ptr().add(0).read().value;
let buf = datum.cast_mut_ptr::<pg_sys::StringInfoData>();
Expand Down Expand Up @@ -609,7 +609,7 @@ fn ruvector_typmod_in_fn(list: pgrx::Array<&CStr>) -> i32 {
/// It uses PostgreSQL's array accessor macros for robust array element access.
#[pg_guard]
#[no_mangle]
pub extern "C" fn ruvector_typmod_in(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
pub extern "C-unwind" fn ruvector_typmod_in(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
unsafe {
// Get the cstring array argument
let array_datum = (*fcinfo).args.as_ptr().add(0).read().value;
Expand Down Expand Up @@ -703,7 +703,7 @@ pub extern "C" fn pg_finfo_ruvector_typmod_in() -> &'static pg_sys::Pg_finfo_rec
/// Typmod output function: format dimension specification for display
#[pg_guard]
#[no_mangle]
pub extern "C" fn ruvector_typmod_out(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
pub extern "C-unwind" fn ruvector_typmod_out(fcinfo: pg_sys::FunctionCallInfo) -> pg_sys::Datum {
unsafe {
let typmod = (*fcinfo).args.as_ptr().add(0).read().value.value() as i32;

Expand Down
2 changes: 1 addition & 1 deletion crates/ruvector-postgres/src/workers/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ impl EngineWorker {

/// Main background worker function for engine
#[pg_guard]
pub extern "C" fn ruvector_engine_worker_main(arg: pg_sys::Datum) {
pub extern "C-unwind" fn ruvector_engine_worker_main(arg: pg_sys::Datum) {
let worker_id = arg.value() as u64;

pgrx::log!("RuVector engine worker {} starting", worker_id);
Expand Down
2 changes: 1 addition & 1 deletion crates/ruvector-postgres/src/workers/maintenance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ impl MaintenanceWorker {

/// Main background worker function for maintenance
#[pg_guard]
pub extern "C" fn ruvector_maintenance_worker_main(arg: pg_sys::Datum) {
pub extern "C-unwind" fn ruvector_maintenance_worker_main(arg: pg_sys::Datum) {
let worker_id = arg.value() as u64;

pgrx::log!("RuVector maintenance worker {} starting", worker_id);
Expand Down
2 changes: 1 addition & 1 deletion crates/ruvector-router-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ anyhow = { workspace = true }
tracing = { workspace = true }

# Additional dependencies
ndarray = "0.15"
ndarray = { workspace = true }
rand = "0.8"
uuid = { version = "1.10", features = ["v4", "serde"] }
chrono = { version = "0.4", features = ["serde"] }
Expand Down