@@ -518,14 +518,14 @@ pub trait RocksTable: BaseRocksTable + Debug + Send + Sync {
518
518
let inserted_row = self . insert_row_kv ( row_id, serialized_row) ?;
519
519
520
520
batch_pipe. add_event ( MetaStoreEvent :: Insert ( Self :: table_id ( ) , row_id) ) ;
521
- if self . snapshot ( ) . get ( & inserted_row. key ) ?. is_some ( ) {
521
+ if self . snapshot ( ) . get_pinned ( & inserted_row. key ) ?. is_some ( ) {
522
522
return Err ( CubeError :: internal ( format ! ( "Primary key constraint violation. Primary key already exists for a row id {}: {:?}" , row_id, & row) ) ) ;
523
523
}
524
524
batch_pipe. batch ( ) . put ( inserted_row. key , inserted_row. val ) ;
525
525
526
526
let index_row = self . insert_index_row ( & row, row_id) ?;
527
527
for to_insert in index_row {
528
- if self . snapshot ( ) . get ( & to_insert. key ) ?. is_some ( ) {
528
+ if self . snapshot ( ) . get_pinned ( & to_insert. key ) ?. is_some ( ) {
529
529
return Err ( CubeError :: internal ( format ! ( "Primary key constraint violation in secondary index. Primary key already exists for a row id {}: {:?}" , row_id, & row) ) ) ;
530
530
}
531
531
batch_pipe. batch ( ) . put ( to_insert. key , to_insert. val ) ;
@@ -573,15 +573,15 @@ pub trait RocksTable: BaseRocksTable + Debug + Send + Sync {
573
573
fn migration_check_table ( & self ) -> Result < ( ) , CubeError > {
574
574
let snapshot = self . snapshot ( ) ;
575
575
576
- let table_info = snapshot. get (
576
+ let table_info = snapshot. get_pinned (
577
577
& RowKey :: TableInfo {
578
578
table_id : Self :: table_id ( ) ,
579
579
}
580
580
. to_bytes ( ) ,
581
581
) ?;
582
582
583
583
if let Some ( table_info) = table_info {
584
- let table_info = self . deserialize_table_info ( table_info. as_slice ( ) ) ?;
584
+ let table_info = self . deserialize_table_info ( & table_info) ?;
585
585
586
586
if table_info. version != Self :: T :: version ( )
587
587
|| table_info. value_version != Self :: T :: value_version ( )
@@ -633,14 +633,14 @@ pub trait RocksTable: BaseRocksTable + Debug + Send + Sync {
633
633
fn migration_check_indexes ( & self ) -> Result < ( ) , CubeError > {
634
634
let snapshot = self . snapshot ( ) ;
635
635
for index in Self :: indexes ( ) . into_iter ( ) {
636
- let index_info = snapshot. get (
636
+ let index_info = snapshot. get_pinned (
637
637
& RowKey :: SecondaryIndexInfo {
638
638
index_id : Self :: index_id ( index. get_id ( ) ) ,
639
639
}
640
640
. to_bytes ( ) ,
641
641
) ?;
642
642
if let Some ( index_info) = index_info {
643
- let index_info = self . deserialize_index_info ( index_info. as_slice ( ) ) ?;
643
+ let index_info = self . deserialize_index_info ( & index_info) ?;
644
644
if index_info. version != index. version ( )
645
645
|| index_info. value_version != index. value_version ( )
646
646
{
@@ -977,7 +977,7 @@ pub trait RocksTable: BaseRocksTable + Debug + Send + Sync {
977
977
RowKey :: SecondaryIndex ( Self :: index_id ( index_id) , secondary_key_hash, row_id) ;
978
978
let secondary_index_key = secondary_index_row_key. to_bytes ( ) ;
979
979
980
- if let Some ( secondary_key_bytes) = self . db ( ) . get ( & secondary_index_key) ? {
980
+ if let Some ( secondary_key_bytes) = self . db ( ) . get_pinned ( & secondary_index_key) ? {
981
981
let index_value_version = RocksSecondaryIndex :: value_version ( secondary_index) ;
982
982
let new_value = match RocksSecondaryIndexValue :: from_bytes (
983
983
& secondary_key_bytes,
@@ -1102,10 +1102,10 @@ pub trait RocksTable: BaseRocksTable + Debug + Send + Sync {
1102
1102
1103
1103
fn get_row ( & self , row_id : u64 ) -> Result < Option < IdRow < Self :: T > > , CubeError > {
1104
1104
let ref db = self . snapshot ( ) ;
1105
- let res = db. get ( RowKey :: Table ( Self :: table_id ( ) , row_id) . to_bytes ( ) ) ?;
1105
+ let res = db. get_pinned ( RowKey :: Table ( Self :: table_id ( ) , row_id) . to_bytes ( ) ) ?;
1106
1106
1107
1107
if let Some ( buffer) = res {
1108
- let row = self . deserialize_id_row ( row_id, buffer. as_slice ( ) ) ?;
1108
+ let row = self . deserialize_id_row ( row_id, & buffer) ?;
1109
1109
return Ok ( Some ( row) ) ;
1110
1110
}
1111
1111
0 commit comments