Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compact: add new compact cmd, used for specific path #4333

Closed
wants to merge 2 commits into from

Conversation

jiefenghuang
Copy link
Contributor

@jiefenghuang jiefenghuang commented Jan 10, 2024

close #4303

Copy link

codecov bot commented Jan 10, 2024

Codecov Report

Attention: 79 lines in your changes are missing coverage. Please review.

Comparison is base (62d9a84) 55.82% compared to head (8e171bf) 56.03%.
Report is 2 commits behind head on main.

Files Patch % Lines
cmd/compact_unix.go 80.00% 22 Missing and 8 partials ⚠️
pkg/meta/utils.go 68.51% 14 Missing and 3 partials ⚠️
pkg/meta/redis.go 80.55% 6 Missing and 1 partial ⚠️
pkg/meta/base.go 85.36% 4 Missing and 2 partials ⚠️
pkg/utils/file.go 40.00% 4 Missing and 2 partials ⚠️
cmd/gc.go 61.53% 3 Missing and 2 partials ⚠️
pkg/meta/sql.go 75.00% 2 Missing and 1 partial ⚠️
pkg/meta/interface.go 66.66% 2 Missing ⚠️
pkg/meta/sql_lock.go 33.33% 0 Missing and 2 partials ⚠️
cmd/summary.go 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4333      +/-   ##
==========================================
+ Coverage   55.82%   56.03%   +0.21%     
==========================================
  Files         153      155       +2     
  Lines       39733    40024     +291     
==========================================
+ Hits        22181    22428     +247     
- Misses      15059    15091      +32     
- Partials     2493     2505      +12     

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

@jiefenghuang jiefenghuang self-assigned this Jan 10, 2024
@jiefenghuang jiefenghuang added the kind/feature New feature or request label Jan 10, 2024
@@ -0,0 +1,111 @@
/*
* JuiceFS, Copyright 2020 Juicedata, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

2024

)

func GetInode(path string) (uint64, error) {
dpath, err := filepath.Abs(path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary?

@@ -249,9 +249,9 @@ func (m *dbMeta) Setlk(ctx Context, inode Ino, owner_ uint64, block bool, ltype
return err
}

func (r *dbMeta) ListLocks(ctx context.Context, inode Ino) ([]PLockItem, []FLockItem, error) {
func (m *dbMeta) ListLocks(ctx context.Context, inode Ino) ([]PLockItem, []FLockItem, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can move these into another PR.

$ juicefs compact --path /mnt/jfs/foo redis://localhost

# max depth of 5
$ juicefs summary --path /mnt/jfs/foo --depth 5 /mnt/jfs/foo redis://localhost
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this

Description: `
Examples:
# compact with path
$ juicefs compact --path /mnt/jfs/foo redis://localhost
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually need either META-URL or mount point, not both.

compact could be a tool used by end-user (not admin), so a mountpoint will be easier. The end-user may don't have the secret in META-URL.

// new meta client
metaConf := meta.DefaultConf()
metaConf.MaxDeletes = int(deleteConcurrency)
client := meta.NewClient(metaUri, metaConf)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't use meta client, instead write control message to a mount point. Check these codes:

@jiefenghuang jiefenghuang deleted the feature/cmd-compact branch January 12, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support triggering compaction of all files under a given directory
3 participants