mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 08:52:56 +00:00
minor cleanup
This commit is contained in:
@@ -9,7 +9,6 @@ use crate::algorithm::node_ptr::MAX_PREFIX_LEN;
|
||||
use crate::algorithm::node_ref::{NewNodeRef, NodeRef, ReadLockedNodeRef, WriteLockedNodeRef};
|
||||
use crate::allocator::OutOfMemoryError;
|
||||
|
||||
use crate::GarbageQueueFullError;
|
||||
use crate::TreeWriteGuard;
|
||||
use crate::UpdateAction;
|
||||
use crate::allocator::ArtAllocator;
|
||||
@@ -21,7 +20,6 @@ pub(crate) type RootPtr<V> = node_ptr::NodePtr<V>;
|
||||
pub enum ArtError {
|
||||
ConcurrentUpdate, // need to retry
|
||||
OutOfMemory,
|
||||
GarbageQueueFull,
|
||||
}
|
||||
|
||||
impl From<ConcurrentUpdateError> for ArtError {
|
||||
@@ -36,12 +34,6 @@ impl From<OutOfMemoryError> for ArtError {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<GarbageQueueFullError> for ArtError {
|
||||
fn from(_: GarbageQueueFullError) -> ArtError {
|
||||
ArtError::GarbageQueueFull
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_root<V: Value>(allocator: &impl ArtAllocator<V>) -> RootPtr<V> {
|
||||
node_ptr::new_root(allocator)
|
||||
}
|
||||
@@ -114,11 +106,6 @@ pub(crate) fn update_fn<'e, 'g, K: Key, V: Value, A: ArtAllocator<V>, F>(
|
||||
Err(ArtError::OutOfMemory) => {
|
||||
panic!("todo: OOM: try to GC, propagate to caller");
|
||||
}
|
||||
Err(ArtError::GarbageQueueFull) => {
|
||||
// FIXME: This can happen if someone is holding back the epoch. We should
|
||||
// wait for the epoch to advance
|
||||
panic!("todo: GC queue is full");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
//! Each node in the tree has contains one atomic word that stores three things:
|
||||
//!
|
||||
//! Bit 0: set if the node is "obsolete". An obsolete node has been removed from the tree,
|
||||
//! but might still be accessed by concurrent readers until the epoch expires.
|
||||
//! Bit 1: set if the node is currently write-locked. Used as a spinlock.
|
||||
//! Bits 2-63: Version number, incremented every time the node is modified.
|
||||
//!
|
||||
//! AtomicLockAndVersion represents that.
|
||||
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
|
||||
pub(crate) struct ConcurrentUpdateError();
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
//! This file contains the implementations of all the different node variants.
|
||||
//! These implementations use pointers, see node_ref.rs for slightly safer
|
||||
//! wrappers that deal with references instead.
|
||||
use std::marker::PhantomData;
|
||||
use std::ptr::NonNull;
|
||||
|
||||
|
||||
@@ -169,8 +169,6 @@ pub struct Tree<V: Value> {
|
||||
unsafe impl<V: Value + Sync> Sync for Tree<V> {}
|
||||
unsafe impl<V: Value + Send> Send for Tree<V> {}
|
||||
|
||||
struct GarbageQueueFullError();
|
||||
|
||||
struct GarbageQueue<V>(VecDeque<(NodePtr<V>, u64)>);
|
||||
|
||||
unsafe impl<V: Value + Sync> Sync for GarbageQueue<V> {}
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
//! It tracks:
|
||||
//! - Relation sizes and existence
|
||||
//! - Last-written LSN
|
||||
//! - TODO: Block cache (also known as LFC)
|
||||
//! - Block cache (also known as LFC)
|
||||
//!
|
||||
//! TODO: limit the size
|
||||
//! TODO: concurrency
|
||||
//!
|
||||
//! Note: This deals with "relations", which is really just one "relation fork" in Postgres
|
||||
//! Note: This deals with "relations" which is really just one "relation fork" in Postgres
|
||||
//! terms. RelFileLocator + ForkNumber is the key.
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user