Skip to content

Commit

Permalink
fix: reduce length of directory name (#588)
Browse files Browse the repository at this point in the history
Signed-off-by: usamoi <[email protected]>
  • Loading branch information
usamoi authored Sep 23, 2024
1 parent b4f5870 commit 22904a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
12 changes: 2 additions & 10 deletions crates/base/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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)
}
}

Expand Down
9 changes: 1 addition & 8 deletions src/index/utils.rs
Original file line number Diff line number Diff line change
@@ -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<u64> = 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 {
Expand Down

0 comments on commit 22904a6

Please sign in to comment.