Skip to content

feat: cloud locking performance hardening, expired upload cleanup, and conformity child deduplication - #145

Open
tomdesair wants to merge 9 commits into
masterfrom
feature/cloud-locking-performance-hardening
Open

tomdesair wants to merge 9 commits into
masterfrom
feature/cloud-locking-performance-hardening

Conversation

@tomdesair

Copy link
Copy Markdown
Owner

Summary

This PR hardens distributed cloud locking (AWS S3 & Azure Blob Storage), resolves performance bottlenecks, unifies upload lock lifecycles, and ensures complete cleanup for expired uploads and checksum deduplication indexes.

Key Changes

  1. S3 Upload Performance & Latency Reduction (~3x Speedup)

    • Implemented optimistic conditional writes (If-None-Match: *) during S3 lock acquisition, eliminating the initial GET request pre-check when no lock is present.
    • Cached committed part sizes in memory to eliminate repeated statObject round-trips when appending parts or calculating offsets.
    • Streamlined byte truncation during error rollbacks to use stream truncation instead of part rewrites.
    • Validated against AWS S3 conformity suites: overall execution dropped from ~174s to ~55–57s (~300% performance improvement).
  2. Unified Lock Lifecycle & Expired Upload Cleanup

    • Replaced single-threaded watchdog polling executors with a consolidated multi-threaded scheduled daemon executor sized by Runtime.getRuntime().availableProcessors().
    • Updated cleanupExpiredUploads() across all storage backends (Disk, S3, Azure Blob) to explicitly call uploadLockingService.cleanupLock(id) for expired uploads and prune stale checksum index entries.
    • Removed cleanupLock(id) from terminateUpload() across all storage backends, ensuring it aligns with the UploadLock try-with-resources lifecycle where the request-scoped lock handle releases and cleans itself.
    • Restored default locking service fallback in deprecated cleanupExpiredUploads(UploadLockingService) and removed all redundant null checks.
  3. Active Child Deduplication & Conformity Testing

    • Added active child preservation tests in both Tus v1.0.0 (scripts/tus_conformity_test.py) and IETF RUFH (scripts/rufh_conformity_test.py) conformity test suites to guarantee parent tombstoning preserves child readability.
    • Added automated multi-backend integration tests (ITAzureBlobStorageService, ITS3StorageService, DiskStorageServiceTest) covering expired upload lock cleanup and checksum index lifecycle.
    • Updated AGENTS.md with Section 25 documenting the UploadLock cleanup and non-null invariant.
    • Updated CHANGELOG.md with the release notes for version 2.0.0.

Verification

  • Full offline Maven unit test suite passes: 1,433+ tests.
  • Code style verified via mvn -P codestyle com.spotify.fmt:fmt-maven-plugin:format.
  • Conformity test suites (330/330 tests passing across all backends):
    • Tus v1.0.0: Disk (55/55 in 3.25s), AWS S3 (55/55 in 57.16s), Azure Blob (55/55 in 23.34s).
    • IETF RUFH (Draft-12): Disk (55/55 in 3.68s), AWS S3 (55/55 in 55.76s), Azure Blob (55/55 in 26.60s).

…onformity child deduplication

- Clean up orphaned locks and stale checksum indices on expired uploads in cleanupExpiredUploads across Disk, S3, and Azure backends
- Remove redundant cleanupLock invocation from terminateUpload, aligning with UploadLock try-with-resources lifecycle
- Remove redundant uploadLockingService != null guards and restore default locking service fallback in cleanupExpiredUploads
- Enhance Utils.createScheduledDaemonExecutor to support multi-core pools sized by available processors
- Add active child preservation tests in Tus and RUFH conformity suites
- Add unit and multi-backend integration tests covering expired upload lock cleanup
… lock release, redundant call elimination, and NFS directory hardening
@coveralls

coveralls commented Oct 20, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 94.308% (-0.08%) from 94.39% — feature/cloud-locking-performance-hardening into master

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.

2 participants