Repository navigation
fix(queue-storage): create queue lanes as the schema owner (v053) #637
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
Changes from all commits
0cb61a6
70fe5ff
80178b3
9a7eed9
bfccec5
cacf380
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 |
|---|---|---|
|
|
@@ -267,6 +267,23 @@ fn sanitize_filename(description: &str) -> String { | |
| .collect() | ||
| } | ||
|
|
||
| /// After a migration, say which lane sequences still need repair and how to | ||
| /// finish it. Read-only. | ||
| async fn print_lane_sequence_leftovers( | ||
| pool: &sqlx::PgPool, | ||
| ) -> Result<(), Box<dyn std::error::Error>> { | ||
| let mut problems = Vec::new(); | ||
| for (schema, _) in awa_model::storage::lane_sequence_problem_counts(pool).await? { | ||
| problems.extend(awa_model::storage::lane_sequence_problems(pool, &schema).await?); | ||
| } | ||
| for next_step in awa_model::storage::lane_sequence_next_steps( | ||
| problems.iter().map(|problem| (problem, false)), | ||
| ) { | ||
| eprintln!("warning: {next_step}"); | ||
| } | ||
| Ok(()) | ||
| } | ||
|
|
||
| /// Classify a command as read-only or mutating for context resolution. | ||
| /// | ||
| /// Read-only commands may fall back to `DATABASE_URL` or `default_context`; | ||
|
|
@@ -328,11 +345,13 @@ fn access_for(command: &Commands) -> context::Access { | |
| }, | ||
| Commands::Storage { command } => match command { | ||
| StorageCommands::Status => ReadOnly, | ||
| StorageCommands::LaneSequences { repair: false, .. } => ReadOnly, | ||
| StorageCommands::Finalize { check: true, .. } => ReadOnly, | ||
| StorageCommands::FlipRingAuthority { check: true, .. } => ReadOnly, | ||
| StorageCommands::Prepare { .. } | ||
| | StorageCommands::PrepareQueueStorageSchema { .. } | ||
| | StorageCommands::PrepareQueue { .. } | ||
| | StorageCommands::LaneSequences { .. } | ||
| | StorageCommands::Abort | ||
| | StorageCommands::EnterMixedTransition { .. } | ||
| | StorageCommands::Finalize { .. } | ||
|
|
@@ -811,7 +830,7 @@ enum StorageCommands { | |
| #[arg(long)] | ||
| reset: bool, | ||
| }, | ||
| /// Provision lane sequences as the migrator, before starting a runtime without DDL | ||
| /// Provision every priority and shard of a queue ahead of its first enqueue | ||
| PrepareQueue { | ||
| /// Queue-storage schema to provision | ||
| #[arg(long, default_value = "awa")] | ||
|
|
@@ -826,6 +845,17 @@ enum StorageCommands { | |
| #[arg(long, default_value_t = 1)] | ||
| queue_stripe_count: usize, | ||
| }, | ||
| /// List lane sequences not owned by the schema owner or missing runtime | ||
| /// grants, with the statements that fix them. Exits 2 while any remain. | ||
| LaneSequences { | ||
| /// Queue-storage schema to check | ||
| #[arg(long, default_value = "awa")] | ||
| schema: String, | ||
| /// Reassign and grant first, as far as the connected role (or, failing | ||
| /// that, its login role) is allowed to | ||
| #[arg(long)] | ||
| repair: bool, | ||
| }, | ||
| /// Abort a prepared or mixed-transition storage rollout before final activation | ||
| Abort, | ||
| /// Enter mixed transition and begin routing new writes to the prepared engine | ||
|
|
@@ -1182,6 +1212,7 @@ async fn run() -> Result<(), Box<dyn std::error::Error>> { | |
| }; | ||
| awa_model::migrations::run_with_options(&pool, options).await?; | ||
| println!("Migrations applied successfully."); | ||
| print_lane_sequence_leftovers(&pool).await?; | ||
|
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.
|
||
| } | ||
| } | ||
|
|
||
|
|
@@ -1933,6 +1964,39 @@ async fn run() -> Result<(), Box<dyn std::error::Error>> { | |
| }))? | ||
| ); | ||
| } | ||
| StorageCommands::LaneSequences { schema, repair } => { | ||
| let next_steps = if repair { | ||
| let mut conn = pool.acquire().await?; | ||
| let repairs = | ||
| awa_model::storage::repair_lane_sequences(&mut conn, &schema) | ||
| .await?; | ||
| println!( | ||
| "{}", | ||
| serde_json::to_string_pretty(&serde_json::json!({ | ||
| "schema": schema, "results": repairs, | ||
| }))? | ||
| ); | ||
| awa_model::storage::lane_sequence_repair_next_steps(&repairs) | ||
| } else { | ||
| let problems = | ||
| awa_model::storage::lane_sequence_problems(&pool, &schema).await?; | ||
| println!( | ||
| "{}", | ||
| serde_json::to_string_pretty(&serde_json::json!({ | ||
| "schema": schema, "problems": problems, | ||
| }))? | ||
| ); | ||
| awa_model::storage::lane_sequence_next_steps( | ||
| problems.iter().map(|problem| (problem, false)), | ||
| ) | ||
| }; | ||
| if !next_steps.is_empty() { | ||
| for next_step in next_steps { | ||
| eprintln!("{next_step}"); | ||
| } | ||
| std::process::exit(2); | ||
| } | ||
| } | ||
| StorageCommands::Abort => { | ||
| awa_model::storage::abort(&pool).await?; | ||
| let report = awa_model::storage::status_report(&pool).await?; | ||
|
|
||
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.
Script executed:
Repository: hardbyte/awa
Length of output: 18704
Script executed:
Repository: hardbyte/awa
Length of output: 37661
Script executed:
Repository: hardbyte/awa
Length of output: 42781
Script executed:
Repository: hardbyte/awa
Length of output: 20583
Rehearse the older-binary lane ownership claim.
The split-role test uses current
QueueStoragewith provisioner access revoked. The released-artifact rehearsal checks job completion, not post-v053 lane ownership. Rehearse and link the stated versions, or limit this claim and the upgrade guide to the tested helper path.As per coding guidelines, “Link compatibility claims to rehearsals of the claimed version topology; describe narrower evidence only by the behavior it covers.”
Source: Coding guidelines