Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- Add migration script here
BEGIN;
-- Lock the table to ensure the backfill of schedule_order is safe
LOCK TABLE pbs_computations IN ACCESS EXCLUSIVE MODE;

ALTER TABLE pbs_computations
ADD COLUMN IF NOT EXISTS error TEXT,
ADD COLUMN IF NOT EXISTS schedule_order TIMESTAMPTZ DEFAULT NOW();

-- Backfill existing rows
UPDATE pbs_computations
SET schedule_order = created_at
WHERE schedule_order IS NULL;

-- enforce not-null after backfill
ALTER TABLE pbs_computations
ALTER COLUMN schedule_order SET NOT NULL;
COMMIT;

-- Partial index for unfinished rows ordered/filtered by created_at
CREATE INDEX IF NOT EXISTS idx_pbs_comp_unfinished_created_at
ON pbs_computations (schedule_order, created_at)
WHERE is_completed = FALSE;
20 changes: 20 additions & 0 deletions coprocessor/fhevm-engine/fhevm-engine-common/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,23 @@ impl Default for HeartBeat {
Self::new()
}
}

#[macro_export]
macro_rules! with_panic_guard {
($body:expr) => {{
use std::panic::{catch_unwind, AssertUnwindSafe};
match catch_unwind(AssertUnwindSafe(|| $body)) {
Ok(v) => Ok(v),
Err(payload) => {
let msg = if let Some(s) = (&*payload).downcast_ref::<&'static str>() {
s.to_string()
} else if let Some(s) = (&*payload).downcast_ref::<String>() {
s.clone()
} else {
"panic payload: non-string".to_string()
};
Err(msg)
}
}
}};
}
4 changes: 3 additions & 1 deletion coprocessor/fhevm-engine/sns-worker/src/aws_upload.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::{
BigCiphertext, Ciphertext128Format, Config, ExecutionError, HandleItem, S3Config, UploadJob,
BigCiphertext, Ciphertext128Format, Config, ExecutionError, HandleItem, S3Config, TaskStatus,
UploadJob,
};
use aws_sdk_s3::error::SdkError;
use aws_sdk_s3::operation::head_bucket::HeadBucketError;
Expand Down Expand Up @@ -486,6 +487,7 @@ async fn fetch_pending_uploads(
ct128: Arc::new(ct128),
otel: telemetry::tracer_with_handle("recovery_task", handle, &transaction_id),
transaction_id,
status: TaskStatus::default(),
};

// Instruct the uploader to acquire DB lock when processing the item
Expand Down
Loading
Loading