-
Notifications
You must be signed in to change notification settings - Fork 671
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
store: remove integer values from DBCol variants #7441
Conversation
Discussion on Zulip: https://near.zulipchat.com/#narrow/stream/313099-pagoda.2Fstorage/topic/Using.20variant.20name.20as.20col_name @Longarithm, this might mess with any flat state tests you’re doing since it renames the FlatState column family. |
chain/client/src/rocksdb_metrics.rs
Outdated
/// Returns column's name as name in the DBCol enum without '_' prefix for deprecated columns. | ||
fn col_verbose_name(col: near_store::DBCol) -> &'static str { | ||
let name: &str = col.into(); | ||
name.strip_prefix("_").unwrap_or(name) | ||
<&str>::from(col) | ||
} |
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 fn probably doesn't pull its weight anymore?
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.
Though, I'd maybe add this as a convenience API to use instead of <str>::from
impl DBCol {
pub fn name(&self) -> &'static str { self.into() }
}
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 used to have this function but then it turns out it was only ever used when Display could be used so I got rid of it. At the moment it would be used in just two places so dunno really if it’s worth it.
So far we’ve been using ‘col##’ names for the RocksDB column families.
This commit proposes to move away from this pattern for new columns
and instead use variant name as the column family name. For example,
rather than ‘col50’ for flat state we would simply use ‘FlatState’.
This has a couple of advantages. Firstly, there’s no longer need to
manually assign unique numbers to columns. Secondly, troubleshooting
on RocksDB level becomes easier since it’s simpler to map from column
family name to the column name used in source code.
As far as I can tell, RocksDB doesn’t have a simple way to rename
a column family. Because of that, this commit only makes the change
in names for future columns leaving currently existing ones with
‘col##’ names.