-
Notifications
You must be signed in to change notification settings - Fork 110
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
Update TableSchema & system tables to resemble ABI V9 #1697
Conversation
5c7c851
to
0b0849b
Compare
b771dd4
to
893b425
Compare
e5415c3
to
804a774
Compare
0e0d9a3
to
d7d8c04
Compare
2553709
to
63cda1f
Compare
Get compiling, fix birdbrained API System table rewrite done More progress Get rid of useless generic args WIP module_host.rs errorless Lots more compilation successes Finish update.rs A bunch of easy fixes . CORE COMPILING BABY Core and planner tests compiling Everything but CLI compiling
…nt with old names
5f16f02
to
b371e6d
Compare
There's now a fix for the internal tests in private, so this is all ready. Together with #1370, |
use enum_as_inner::EnumAsInner; | ||
use itertools::Itertools; | ||
use similar::{Algorithm, TextDiff}; | ||
use crate::execution_context::ExecutionContext; |
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 file was completely rewritten so should probably not be reviewed in diff view.
@@ -541,39 +540,6 @@ impl<'db, 'tx> DbProgram<'db, 'tx> { | |||
} | |||
} | |||
|
|||
fn _create_table(&mut self, table: RawTableDefV8) -> Result<Code, ErrorVm> { |
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 code was dead and now out-of-date so I buried it.
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 scanned the whole PR. I left a few small nits. AFAICT, this looks really good. Very nice job here @kazimuth.
I am approving this PR from a traits.rs
perspective and no major objection to the rest, but would probably be good to get another approval as well.
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.
Looks good.
Error propagation needs another pass.
/// It's fine to call this on system table types, because `validate_system_table` checks that | ||
/// they are `ProductType`s. | ||
/// | ||
/// TODO: this performs some unnecessary allocation. We may want to reimplement the conversions manually for |
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.
🤷
log::warn!("Database update failed: {} @ {}", e, stdb.address()); | ||
self.system_logger().warn(&format!("Database update failed: {e}")); |
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.
Seen this so many times that I feel like there should be a tee
logger which can log to more than one sink.
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.
Would be a good idea to just log everything that goes through the system loggers yeah. I'll make that a separate issue tho
Description of Changes
This gets rid of most of the usages of
RawModuleDefV8
incore
. It replaces it withModuleDef
, which means that the new validation path is used consistently throughout the codebase. It also refactors the system tables &TableSchema
types to match the newModuleDef
, theupdate
functionality to use the new auto-migration functionality based onModuleDef
, and does a little bit of other cleanup.The major user-visible changes from this PR are:
describe
endpoint now returns a json-serializedRawModuleDefV9
rather thanRawModuleDefV8
.The major logical changes are:
ConstraintSchema
andIndexSchema
(and their corresponding system tables) no longer store redundant information. Constraints are completely separate from indices; to determine if an index is unique, look up a constraint with its columns. (This is not quite true inmut_tx.rs
and thetable
crate, see my discussion with tyler below, but this is now true throughout more of the codebase.)IndexSchema
stores aColList
, to keep track of field ordering, whereasConstraintSchema
stores aColSet
, which discards ordering, but can be cheaply constructed from aColList
.Constraints
type is now constructed on-demand fromTableSchema
, rather than being stored directly inTableSchema
. This means we have a single source of truth for the data inConstraints
and are less likely to muck it up.Constraints
is still used in thevm
andsql
modules.API and ABI breaking changes
ABI break in the system tables, API break at the describe endpoint.
Expected complexity level and risk
4, this is a system table update and touches things all over
core
.Testing
Updated all tests and added some. See also #1737