-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(state_table): Cow for get row, minor refactors #3241
Conversation
Signed-off-by: Alex Chi <iskyzh@gmail.com>
7c87190
to
95bb85b
Compare
Codecov Report
@@ Coverage Diff @@
## main #3241 +/- ##
=======================================
Coverage 73.22% 73.22%
=======================================
Files 747 747
Lines 101882 101892 +10
=======================================
+ Hits 74602 74610 +8
- Misses 27280 27282 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
src/storage/src/table/state_table.rs
Outdated
pub async fn get_row(&self, pk: &Row, epoch: u64) -> StorageResult<Option<Row>> { | ||
/// Get a single row from state table. This function will return a Cow. If the value is from | ||
/// memtable, it will be a [`Cow::Borrowed`]. If is from cell based table, it will be an owned | ||
/// value. To convert `Option<Cow<Row>>` to `Option<Row>`, just call `to_owned`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// value. To convert `Option<Cow<Row>>` to `Option<Row>`, just call `to_owned`. | |
/// value. To convert `Option<Cow<Row>>` to `Option<Row>`, just call `into_owned`. |
@@ -57,8 +57,7 @@ pub struct CellBasedTable<S: StateStore> { | |||
column_descs: Vec<ColumnDesc>, | |||
|
|||
/// Mapping from column id to column index | |||
/// TODO: all CellBasedTable users should have a pk serializer, we should remove this option. | |||
pub pk_serializer: Option<OrderedRowSerializer>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the Option
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet
src/storage/src/table/state_table.rs
Outdated
@@ -167,7 +188,7 @@ impl<S: StateStore> StateTable<S> { | |||
self.iter_with_pk_bounds::<_, Row>(.., epoch).await | |||
} | |||
|
|||
/// This function scans rows from the relational table with specific `pk_bounds`. | |||
/// This function scans rows from the relational table with specific `pk_prefix`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// This function scans rows from the relational table with specific `pk_prefix`. | |
/// This function scans rows from the relational table with specific `pk_bounds`. |
src/storage/src/table/state_table.rs
Outdated
@@ -239,76 +260,71 @@ where | |||
let cell_based_table_iter = self.cell_based_table_iter.peekable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also fuse this stream?
let cell_based_table_iter = self.cell_based_table_iter.peekable(); | |
let cell_based_table_iter = self.cell_based_table_iter.fuse().peekable(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LSTM
Signed-off-by: Alex Chi <iskyzh@gmail.com>
Signed-off-by: Alex Chi iskyzh@gmail.com
What's changed and what's your intention?
TopN test doesn't pass, guess there's something wrong with it. Will fix later.Checklist
./risedev check
(or alias,./risedev c
)Refer to a related PR or issue link (optional)