mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-11-29 22:24:02 +00:00
docs(flow): correct three comments the PR's own claims contradict
Review of the previous commit surfaced three places where a comment describes something the code does not do. `gen_create_table_expr` documented the auto-added `update_at` column as `DEFAULT now()`. It has no default: `create_table_with_expr` builds it with `ColumnSchema::new(..., nullable = true)` and no default constraint, and the sqlness expectations show `"update_at" TIMESTAMP(3) NULL`. The comment added in `table_creator.rs` by the previous commit already said so, leaving the two files disagreeing. State the nullable, default-less layout and why it is kept. `flow_config_ignores_the_removed_num_workers_option` attributed ignoring the unknown key to `#[serde(default)]`. That attribute supplies defaults for absent fields; unknown keys are ignored because `FlowConfig` does not set `deny_unknown_fields`. Separate the two mechanisms. `test_legacy_streaming_flow_metadata_stays_readable_and_droppable` claimed dropping a legacy flow "only needs the metadata". The real `DROP FLOW` procedure also calls the flownode, so scope the claim to deleting this metadata, and pass the value read back rather than the original one, which also shows that value is enough to delete it. The `AGENTS.md` note likewise presented `get_flow_type_from_options` as what keeps legacy metadata listable and droppable; it is only used on the create path. Record the two reasons separately. Signed-off-by: discord9 <55937128+discord9@users.noreply.github.com>
This commit is contained in:
@@ -898,9 +898,10 @@ mod tests {
|
||||
assert_eq!(names.len(), 1);
|
||||
assert_eq!(names[0].0, "legacy_flow");
|
||||
|
||||
// Dropping a legacy flow only needs the metadata; no runtime is involved.
|
||||
// Deleting this metadata needs no runtime, so it works for a legacy flow. Passing the
|
||||
// value read back above also checks that it is enough to delete the flow's metadata.
|
||||
flow_metadata_manager
|
||||
.destroy_flow_metadata(flow_id, &flow_value)
|
||||
.destroy_flow_metadata(flow_id, &listed)
|
||||
.await
|
||||
.unwrap();
|
||||
assert!(mem_kv.is_empty());
|
||||
|
||||
+5
-2
@@ -86,5 +86,8 @@ plan-to-schema helper shared with batching.
|
||||
change; it is a reserved internal key and must stay out of `SHOW CREATE FLOW`
|
||||
rendering. Writing it is a deliberate keep, not an oversight: dropping it would
|
||||
change the persisted metadata and the `options` column users can query, for no
|
||||
runtime benefit. Reading it must keep accepting `streaming` so legacy metadata
|
||||
stays listable and droppable (`get_flow_type_from_options`).
|
||||
runtime benefit. Options that already say `streaming` must stay readable: that
|
||||
is what keeps such legacy metadata listable and droppable, and a test in
|
||||
`common-meta`'s `key/flow.rs` covers it. Independently,
|
||||
`get_flow_type_from_options` must keep recognizing `streaming` so the persisted
|
||||
options and in-flight data of an old create procedure still deserialize.
|
||||
|
||||
@@ -130,8 +130,9 @@ fn output_column_schemas_normalizes_dictionary_output_type() {
|
||||
fn flow_config_ignores_the_removed_num_workers_option() {
|
||||
// `flow.num_workers` belonged to the removed flow workers. Deployments still
|
||||
// carry it in their TOML, so parsing must keep ignoring it instead of failing
|
||||
// the whole config. `FlowConfig` is `#[serde(default)]`, so the unknown key is
|
||||
// skipped and the remaining fields come from the defaults.
|
||||
// the whole config. The unknown key is ignored because `FlowConfig` does not
|
||||
// set `deny_unknown_fields`; `#[serde(default)]` separately makes the fields
|
||||
// absent from this TOML (such as `batching_mode`) come from the defaults.
|
||||
let config: super::FlowConfig = toml::from_str("num_workers = 4").unwrap();
|
||||
assert_eq!(config, super::FlowConfig::default());
|
||||
}
|
||||
|
||||
@@ -2016,8 +2016,9 @@ impl BatchingTask {
|
||||
|
||||
/// Generate the create table SQL
|
||||
///
|
||||
/// the auto created table will automatically added a `update_at` Milliseconds DEFAULT now() column in the end,
|
||||
/// matching the layout sink tables created by earlier versions already have
|
||||
/// the auto created table gets an extra `update_at` millisecond timestamp column appended at the
|
||||
/// end. It is nullable and has no default value, matching the layout of sink tables created by
|
||||
/// earlier versions
|
||||
///
|
||||
/// and it will use first timestamp column as time index, all other columns will be added as normal columns and nullable
|
||||
async fn gen_create_table_expr(
|
||||
|
||||
Reference in New Issue
Block a user