From 22904a69ef022834b7ebae8955b6452942f81bc5 Mon Sep 17 00:00:00 2001 From: usamoi Date: Mon, 23 Sep 2024 09:57:51 +0800 Subject: [PATCH] fix: reduce length of directory name (#588) Signed-off-by: usamoi --- crates/base/src/search.rs | 12 ++---------- src/index/utils.rs | 9 +-------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/crates/base/src/search.rs b/crates/base/src/search.rs index 86b6f3d83..8a0c24391 100644 --- a/crates/base/src/search.rs +++ b/crates/base/src/search.rs @@ -9,17 +9,13 @@ use std::fmt::Display; #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] pub struct Handle { - tenant_id: u128, - cluster_id: u64, database_id: u32, index_id: u32, } impl Handle { - pub fn new(tenant_id: u128, cluster_id: u64, database_id: u32, index_id: u32) -> Self { + pub fn new(database_id: u32, index_id: u32) -> Self { Self { - tenant_id, - cluster_id, database_id, index_id, } @@ -28,11 +24,7 @@ impl Handle { impl Display for Handle { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!( - f, - "{:032x}{:016x}{:08x}{:08x}", - self.tenant_id, self.cluster_id, self.database_id, self.index_id - ) + write!(f, "{:08x}{:08x}", self.database_id, self.index_id) } } diff --git a/src/index/utils.rs b/src/index/utils.rs index d55d7cb00..47f9887ee 100644 --- a/src/index/utils.rs +++ b/src/index/utils.rs @@ -1,16 +1,9 @@ -use crate::utils::cells::PgCell; use base::search::*; pub fn from_oid_to_handle(oid: pgrx::pg_sys::Oid) -> Handle { - static SYSTEM_IDENTIFIER: PgCell = unsafe { PgCell::new(0) }; - if SYSTEM_IDENTIFIER.get() == 0 { - SYSTEM_IDENTIFIER.set(unsafe { pgrx::pg_sys::GetSystemIdentifier() }); - } - let tenant_id = 0_u128; - let cluster_id = SYSTEM_IDENTIFIER.get(); let database_id = unsafe { pgrx::pg_sys::MyDatabaseId.as_u32() }; let index_id = oid.as_u32(); - Handle::new(tenant_id, cluster_id, database_id, index_id) + Handle::new(database_id, index_id) } pub fn pointer_to_ctid(pointer: Pointer) -> pgrx::pg_sys::ItemPointerData {