Skip to content

object: reuse encrypted data across put retries - #7396

Open
Light-City wants to merge 1 commit into
juicedata:mainfrom
Light-City:fix/encrypted-put-retry
Open

Light-City wants to merge 1 commit into
juicedata:mainfrom
Light-City:fix/encrypted-put-retry

Conversation

@Light-City

Copy link
Copy Markdown
Contributor

1.Why and Backgroud?

cachedStore.upload retries failed object uploads by calling ObjectStorage.Put again. For encrypted storage, each attempt previously reread and re-encrypted the same data block, generating a new data key, nonce, and ciphertext. This introduced unnecessary CPU and memory overhead, especially when timed-out attempts overlapped with subsequent retries.

related issue: #7325

2.How to fix?

This change creates a request-scoped context shared by all attempts of one logical Put. encrypted.Put encrypts the payload once and reuses the prepared ciphertext for subsequent attempts, with synchronization for overlapping retries and isolation between different encryption instances. Regular Put calls without this context keep their existing behavior, and storage wrappers require no additional interfaces as long as they propagate the context.

@Light-City
Light-City force-pushed the fix/encrypted-put-retry branch 2 times, most recently from 3b1dd9a to b2214e0 Compare August 13, 2026 14:56
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.29730% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 55.07%. Comparing base (44a5657) to head (b2214e0).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
pkg/object/encrypt.go 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7396      +/-   ##
==========================================
- Coverage   56.32%   55.07%   -1.25%     
==========================================
  Files         177      139      -38     
  Lines       59011    48866   -10145     
==========================================
- Hits        33236    26913    -6323     
+ Misses      22259    19041    -3218     
+ Partials     3516     2912     -604     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Light-City
Light-City force-pushed the fix/encrypted-put-retry branch from b2214e0 to c31a5f7 Compare August 13, 2026 15:28
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