-
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
chore(relational_state_store): define interfaces of relational layer #1900
Conversation
#![allow(dead_code)] | ||
#![allow(unused)] |
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.
Remember to remove these lines in the next PR. 😁
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.
Ok, adding these two lines is to pass CI, and it will be removed when the interface is implemented.
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.
I think we should never allow unused. We can allow dead_code.
Codecov Report
@@ Coverage Diff @@
## main #1900 +/- ##
==========================================
- Coverage 70.87% 70.80% -0.07%
==========================================
Files 611 619 +8
Lines 79623 80076 +453
==========================================
+ Hits 56431 56697 +266
- Misses 23192 23379 +187
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 struct StateTableRowIter<S: StateStore> { | ||
keyspace: Keyspace<S>, | ||
/// A buffer to store prefetched kv pairs from state store | ||
buf: Vec<(Bytes, Bytes)>, | ||
/// The idx into `buf` for the next item | ||
next_idx: usize, | ||
/// A bool to indicate whether there are more data to fetch from state store | ||
done: bool, | ||
/// An epoch representing the read snapshot | ||
epoch: u64, | ||
/// Cell-based row deserializer | ||
cell_based_row_deserializer: CellBasedRowDeserializer, | ||
/// Statistics | ||
_stats: Arc<StateStoreMetrics>, |
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.
we should re-consider the fields in StateTableRowIter
. It should be a merge iterator of mem_table
nad cell_based_table
, so I think maybe it only contains the 2 iterators.
Self::new() | ||
} | ||
} | ||
impl MemTable { |
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.
A MemTable::drain(&mut self)
function returns a Iterator of (pk: Row, op: RowOp)
and clear the memtable.
It will be called by StateTable::commit
and drain all the operators in mem_table
and flush them into cell_based_table
src/storage/src/table/mem_table.rs
Outdated
} | ||
|
||
pub struct MemTableIter { | ||
mem_table: MemTable, |
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.
I think maybe it should be btree_map::Iter<'a, Row, RowOp>
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.
generally LGTM, might there will be some lifetime issue on the MemTableIter
, we can resolve them while implementing them.
What's changed and what's your intention?
As described in doc Relational State Store Layer, this PR defines IO interfaces of
StateTable
andMemTable
.Checklist
Refer to a related PR or issue link (optional)