Repository navigation
fix(streams/update-table): CreationRequestDateTime, and measured UpdateTable sentences and validation order #548
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
base: main
Are you sure you want to change the base?
Changes from all commits
ebe8352
6eff502
64fce7f
cd2e20f
f20de8a
c665aac
6459ee8
248f5a2
484c0f4
ae5072c
0598f8e
34b6c92
f3c65cd
7fbb1bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,15 +106,6 @@ pub async fn handle_update_table( | |
| )); | ||
| } | ||
|
|
||
| // Validate: enabling streams requires a view type. | ||
| if let Some(spec) = &input.stream_specification | ||
| && spec.stream_enabled | ||
| && spec.stream_view_type.is_none() | ||
| { | ||
| return Err(DynamoDbError::ValidationException( | ||
| "StreamViewType must be specified when StreamEnabled is true".to_owned(), | ||
| )); | ||
| } | ||
| // A disable carries no view type (measured 2026-10-24 on a never-streamed | ||
| // table and on an enabled one alike; checked before the no-stream rule). | ||
| if let Some(spec) = &input.stream_specification | ||
|
|
@@ -131,7 +122,7 @@ pub async fn handle_update_table( | |
| && input.provisioned_throughput.is_none() | ||
| { | ||
| return Err(DynamoDbError::ValidationException( | ||
| "One or more parameter values were invalid: ProvisionedThroughput must be specified when changing BillingMode to PROVISIONED".to_owned(), | ||
| "One or more parameter values were invalid: ProvisionedThroughput must be specified when BillingMode is PROVISIONED".to_owned(), | ||
| )); | ||
| } | ||
|
|
||
|
|
@@ -153,14 +144,18 @@ pub async fn handle_update_table( | |
| )); | ||
| } | ||
|
|
||
| crate::gsi_updates::validate_gsi_updates(&input)?; | ||
| validate_stream_specification(&input)?; | ||
|
|
||
| // A table-level WarmThroughput stands alone in its request, with the | ||
| // measured per-companion sentences (measured 2026-10-23). Checked before | ||
| // the value rules, as the service does: it fired on requests whose values | ||
| // were otherwise valid. GlobalSecondaryIndexUpdates is accepted beside it. | ||
| // The index rules and the view type check above come first: the service | ||
| // answers their sentences beside WarmThroughput, with or without | ||
| // DeletionProtectionEnabled or BillingMode (measured 2026-11-25). | ||
| extenddb_core::validation::validate_warm_throughput_is_only_operation(&input)?; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The view-type check now runs after
The measured order is the billing rules, the index rules, the view type, then the warm rule. Running
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in ae5072c: The three shapes from this thread are rows of
|
||
|
|
||
| crate::gsi_updates::validate_gsi_updates(&input)?; | ||
|
|
||
| // A stream change travels alone. Measured 2026-10-24: beside BillingMode or | ||
| // ProvisionedThroughput the service refuses with the IOPS sentence, beside | ||
| // any GlobalSecondaryIndexUpdates entry with the index sentence, and | ||
|
|
@@ -288,6 +283,26 @@ pub async fn handle_update_table( | |
| serialize_output(&output) | ||
| } | ||
|
|
||
| /// Enabling a stream requires a view type. The sentence is the service's | ||
| /// ([`extenddb_storage::stream_lineage::STREAM_VIEW_TYPE_REQUIRED`]). The | ||
| /// service reports a defective index Create and a missing | ||
| /// ProvisionedThroughput before this, and this before the warm throughput | ||
| /// rule and the table lookup (measured 2026-10-25 and 2026-11-25), so the call | ||
| /// sits after the billing and index rules and before the warm rule and the | ||
| /// backend call, where it also precedes the already-enabled refusal. The | ||
| /// `CreateTable` form has its own sentence. | ||
| fn validate_stream_specification(input: &UpdateTableInput) -> Result<(), DynamoDbError> { | ||
| if let Some(spec) = &input.stream_specification | ||
| && spec.stream_enabled | ||
| && spec.stream_view_type.is_none() | ||
| { | ||
| return Err(DynamoDbError::ValidationException( | ||
| extenddb_storage::stream_lineage::STREAM_VIEW_TYPE_REQUIRED.to_owned(), | ||
| )); | ||
| } | ||
| Ok(()) | ||
| } | ||
|
|
||
| /// The sentence the service refuses a stream change with when the same | ||
| /// `UpdateTable` also changes the table's billing or throughput, creates or | ||
| /// deletes an index, or changes deletion protection. `None` when the request | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,13 @@ use crate::util::{ | |
| /// Fixed shards per stream (hash-based partition-key assignment). | ||
| pub const SHARDS_PER_STREAM: u32 = 4; | ||
|
|
||
| /// The service's refusal of an `UpdateTable` that enables a stream without a | ||
| /// `StreamViewType` (measured 2026-10-24 on a never-streamed table and on a | ||
| /// table whose stream is enabled). The engine answers it before storage is | ||
| /// called; [`stream_change`] answers it for a caller that reaches storage | ||
| /// without that check. | ||
| pub const STREAM_VIEW_TYPE_REQUIRED: &str = "One or more parameter values were invalid: If stream is being enabled then UpdateViewType is required"; | ||
|
|
||
| /// A `CreateTable` request with a disabled `StreamSpecification` dropped. | ||
| /// | ||
| /// The service does not store `{StreamEnabled: false}`: `DescribeTable` on | ||
|
|
@@ -85,21 +92,13 @@ pub fn stream_change( | |
| (false, false) => Err(StorageError::Validation(format!( | ||
| "Table has no stream to disable: TableName: {table_name}" | ||
| ))), | ||
| // Unreachable through the engine, which refuses an enable without a | ||
| // view type before storage with this same sentence. The service's | ||
| // sentence for that case, measured 2026-10-24, is "One or more | ||
| // parameter values were invalid: If stream is being enabled then | ||
| // UpdateViewType is required", and it precedes the already-enabled | ||
| // check; the engine's sentence pre-dates this change and is not | ||
| // changed here. | ||
| // Unreachable through the engine, whose `validate_stream_specification` | ||
| // refuses an enable without a view type before storage with this same | ||
| // sentence, and before the already-enabled check. | ||
| (true, false) => requested | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No test checks this sentence. With the old sentence put back, the 31 storage stream tests and every wire row pass.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added in 34b6c92. |
||
| .stream_view_type | ||
| .map(StreamChange::Enable) | ||
| .ok_or_else(|| { | ||
| StorageError::Validation( | ||
| "StreamViewType must be specified when StreamEnabled is true".to_owned(), | ||
| ) | ||
| }), | ||
| .ok_or_else(|| StorageError::Validation(STREAM_VIEW_TYPE_REQUIRED.to_owned())), | ||
| (false, true) => Ok(StreamChange::Disable), | ||
| } | ||
| } | ||
|
|
@@ -500,6 +499,7 @@ pub fn describe_stream( | |
| (remaining.len() > limit).then(|| remaining[limit - 1].shard_id.clone()); | ||
| remaining.truncate(limit); | ||
| Ok(StreamDescription { | ||
| creation_request_date_time: None, | ||
| stream_status: stream_status(table, &label), | ||
| stream_view_type: stream.view_type, | ||
| stream_arn, | ||
|
|
||
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.
The 12
update_tableunit tests pass with this sentence reverted; only the wire ordering row catches 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.
The wire row
missing-throughput-before-the-view-typeofNEVER_CREATED_ROWSintests/python/test_update_table_sentences.pyasserts this sentence by equality. CI runs that file in the--comprehensivesuite (devtools/run-tests --extenddb --pytest --comprehensive,.github/workflows/integration.ymllines 246 and 425), and the MongoDB and Cassandra jobs run it too. A server built with the old sentence fails that row. The check reads the request insidehandle_update_table, so a unit test would only repeat the sentence that the wire row holds.