Skip to content

Preserve bulk delete scope and background task state during recovery - #2734

Open
niemyjski wants to merge 3 commits into
feature/bulk-operationsfrom
issue/bulk-operation-recovery
Open

niemyjski wants to merge 3 commits into
feature/bulk-operationsfrom
issue/bulk-operation-recovery

Conversation

@niemyjski

@niemyjski niemyjski commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Bulk deletes reject malformed time ranges, invalid UTC offsets, and unreadable saved selections before they can change which events are deleted. This PR is stacked on #2713.

Changes

  • Require a live task record before running a tracked project reset.
  • Store the selection before admitting a bulk task. If a cache or index write fails, remove the unqueued task and its selection.
  • Keep active tasks discoverable across index expiry and remove an organization's task data during hard deletion.
  • Group retry settings, centralize timestamps and cache keys, and remove unused state.

Breaking changes and deploy notes

  • No API schema changes. Workers receiving tracked resets must understand the task-state check before the feature is enabled.

Testing

261 focused tests passed for the initial fixes. The follow-up passed 156 affected tests covering tasks, bulk operations, offsets, and cleanup. A separate Redis 8.6 check verified index expiry and tenant cleanup.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T13:59:05.481035Z 3712e10 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3712e10a48

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

public static string GetActiveIndexCacheKey(string organizationId) => $"{GetOrganizationIndexCacheKey(organizationId)}:active";
public static string GetUpdateLockResource(string id) => $"{KeyPrefix}:update:{id}";
public static string GetCreateLockResource(string organizationId) => $"{KeyPrefix}:create:{organizationId}";
public static string GetCreateLockResource(string organizationId) => $"{GetOrganizationIndexCacheKey(organizationId)}:create";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the existing distributed creation lock key

During a deployment with old and new API instances running together, this changes the organization lock from background-tasks:create:{organizationId} to background-tasks:organization:{organizationId}:create. The two versions therefore acquire independent locks in BulkOperationService.CreateAsync, allowing simultaneous requests to both pass FindConflictingTaskAsync before either task is indexed and enqueue overlapping destructive operations. The API Deployment in k8s/exceptionless/templates/api.yaml does not require a stop-the-world upgrade. Preserve the previous lock resource string while centralizing its construction so mixed-version instances retain mutual exclusion.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 20178fa. The creation lock retains its original resource name across API versions. The regression check failed with the renamed key and passed after the fix, alongside all 41 task and bulk service tests.

@github-actions

Copy link
Copy Markdown

Code Coverage

Package Line Rate Branch Rate Complexity Health
Exceptionless.AppHost 23% 22% 130 ❌
Exceptionless.Core 79% 71% 11802 ✔
Exceptionless.Insulation 51% 43% 370 ➖
Exceptionless.Web 87% 73% 10492 ✔
Summary 82% (31242 / 38182) 71% (15926 / 22298) 22794 ✔

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant