Skip to content

Conversation

@potapovkd
Copy link
Contributor

@potapovkd potapovkd commented Nov 9, 2025

…cross various storage adapters

Closes #9614

Change Description

Remove unused Adapter.Remove method from the block adapter interface and all its implementations.

Background

The Remove method in the block adapter interface was not being used anywhere in the codebase except in tests. As mentioned in issue #9614, this makes issue #6836 (which was about optimizing the S3 Remove implementation with wait/verify logic) meaningless since the method is never actually called in production code.

This PR removes:

  • The Remove method from the Adapter interface
  • All implementations across adapters (S3, GCS, Azure, Local, Memory, Transient)
  • The metrics wrapper for the Remove method
  • The test function testAdapterRemove

This simplifies the codebase and removes approximately ~230 lines of dead code, including the expensive waiter.Wait operation in the S3 adapter that was waiting for object deletion confirmation.

Bug Fix

N/A - This is a tech debt cleanup, not a bug fix.

New Feature

N/A - This PR removes code rather than adding new features.

Testing Details

  1. Verified that Remove method is not called anywhere in production code using grep searches
  2. Confirmed successful compilation of all block adapter packages
  3. Verified no linter errors after changes
  4. The only references to Remove were in test code, which has been appropriately removed

Breaking Change?

Technically yes - this removes a public method from the Adapter interface. However, the method was not used anywhere in the actual codebase (only in tests), so there should be no practical impact on existing functionality.

Impact:

  • ✅ API: Method removed from interface (unused in practice)
  • ✅ CLI: No impact
  • ✅ Clients: No impact (method was not exposed to clients)

Additional info

Files modified:

  • pkg/block/adapter.go - removed method from interface
  • pkg/block/s3/adapter.go - removed S3 implementation
  • pkg/block/gs/adapter.go - removed GCS implementation
  • pkg/block/azure/adapter.go - removed Azure implementation
  • pkg/block/local/adapter.go - removed local filesystem implementation
  • pkg/block/mem/adapter.go - removed in-memory implementation
  • pkg/block/transient/adapter.go - removed transient implementation
  • pkg/block/metrics.go - removed metrics wrapper
  • pkg/block/blocktest/basic_suite.go - removed test and unused import

Contact Details

kdpotapov02@gmail.com

@zubron zubron self-requested a review December 5, 2025 22:54
@N-o-Z
Copy link
Member

N-o-Z commented Dec 9, 2025

@potapovkd please note your have some test errors (specifically the linters job which fails on code errors)

@N-o-Z N-o-Z assigned N-o-Z and potapovkd and unassigned N-o-Z Dec 9, 2025
@N-o-Z N-o-Z added the exclude-changelog PR description should not be included in next release changelog label Dec 9, 2025
Copilot AI review requested due to automatic review settings December 9, 2025 22:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the unused Remove method from the block adapter interface and all its implementations across various storage adapters (S3, GCS, Azure, Local, Memory, Transient), along with associated test code and metrics wrappers. This tech debt cleanup eliminates approximately 230 lines of dead code that was never called in production.

Key changes:

  • Removed Remove method from the Adapter interface
  • Removed all Remove implementations from adapters (S3, GCS, Azure, Local, Memory, Transient)
  • Removed metrics wrapper for the Remove method and the testAdapterRemove test function

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/block/adapter.go Removed Remove method from the Adapter interface
pkg/block/s3/adapter.go Removed S3 implementation of Remove with waiter logic
pkg/block/gs/adapter.go Removed GCS implementation of Remove
pkg/block/azure/adapter.go Removed Azure implementation of Remove
pkg/block/local/adapter.go Removed local filesystem implementation and helper function removeEmptyDirUntil
pkg/block/mem/adapter.go Removed in-memory implementation of Remove
pkg/block/transient/adapter.go Removed transient implementation of Remove
pkg/block/metrics.go Removed metrics wrapper for Remove method
pkg/block/blocktest/basic_suite.go Removed testAdapterRemove test and unused deep import
pkg/block/blocktest/adapter.go Removed testGetProperties function and sort import (issues found)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"mime"
"net/url"
"path"
"path/filepath"
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

The sort import was removed, but sort.Strings(tree) is still used on line 270 in the dumpPathTree function. This will cause a compilation error.

The sort import should not be removed.

Suggested change
"path/filepath"
"path/filepath"
"sort"

Copilot uses AI. Check for mistakes.
})
}

func dumpPathTree(t testing.TB, ctx context.Context, adapter block.Adapter, qk block.QualifiedKey) []string {
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

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

The testGetProperties function is being removed here, but it's still called on line 28 in the AdapterTest function. This will cause a compilation error.

Either keep this function, or remove the call to it from line 28.

Copilot uses AI. Check for mistakes.
@potapovkd
Copy link
Contributor Author

@N-o-Z done

@N-o-Z
Copy link
Member

N-o-Z commented Dec 10, 2025

@N-o-Z done

Thank you!
We will review your changes promptly.
Thank you for your contribution!

Copy link
Contributor

@zubron zubron left a comment

Choose a reason for hiding this comment

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

Thank you so much for this, @potapovkd! There's a MockAdapter implementation that also includes this method which we should remove, along with the error variable it returns. Other than that, it looks great!

It seems like we have some CI configuration issues where a necessary secret isn't being passed to forked repositories. I'll look into this with the team and make sure we get the tests running :)

@github-actions github-actions bot added the area/testing Improvements or additions to tests label Dec 11, 2025
@potapovkd
Copy link
Contributor Author

@zubron thank you! I removed this method from the MockAdapter implementation

@zubron zubron mentioned this pull request Dec 11, 2025
@zubron zubron self-requested a review December 11, 2025 19:38
Copy link
Contributor

@zubron zubron left a comment

Choose a reason for hiding this comment

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

Thanks for tidying up that last bit, @potapovkd! I tested your changes in another PR and it was all good 👍

@zubron zubron merged commit 17d693c into treeverse:master Dec 11, 2025
75 of 80 checks passed
@potapovkd potapovkd deleted the fix/remove-block-adapter-remove-9614 branch December 12, 2025 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/block-adapter area/testing Improvements or additions to tests exclude-changelog PR description should not be included in next release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove ".../block".Adapter.Remove

3 participants