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

Make objects deleted in the same branch that created them continue to show up in older commits (#997) #1000

Merged
merged 38 commits into from
Dec 6, 2020

Conversation

tzahij
Copy link
Contributor

@tzahij tzahij commented Dec 5, 2020

fixed in regular and by prefix listing

itaiad200 and others added 30 commits November 22, 2020 16:14
Co-authored-by: itaiad200 <itaiad200@gmail.com>
…e/lakeFS into feature/rocks-catalog-interface
Copy link
Contributor

@arielshaqed arielshaqed left a comment

Choose a reason for hiding this comment

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

Please rebase your branch on master. Right now there are 35 commits in this branch, which makes it hard to review each commit separately.

I do not understand this commit well enough to approve it. OTOH, I am therefore unequally unqualified to say that it is safe and does not break other behaviours.

catalog/mvcc/cataloger_delete_entry_test.go Outdated Show resolved Hide resolved
catalog/mvcc/cataloger_delete_entry_test.go Show resolved Hide resolved
}
return unionMap
}

func selectSingleBranch(branchID int64, isBaseBranch bool, branchBatchSize int, topCommitID CommitID, prefixLen int, endOfPrefixRange string) sq.SelectBuilder {
rawSelect := sq.Select("branch_id", "min_commit").
func selectSingleBranch(branchID int64, branchBatchSize int, topCommitID CommitID, prefixLen int, endOfPrefixRange string) sq.SelectBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please document the function with these parameters. The action of this function is confusing.

}
return unionMap
}

func selectSingleBranch(branchID int64, isBaseBranch bool, branchBatchSize int, topCommitID CommitID, prefixLen int, endOfPrefixRange string) sq.SelectBuilder {
rawSelect := sq.Select("branch_id", "min_commit").
func selectSingleBranch(branchID int64, branchBatchSize int, topCommitID CommitID, prefixLen int, endOfPrefixRange string) sq.SelectBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also I don't understand the action of parameter isBaseBranch, why we needed it, and why we no longer do. I don't want to expose some bug that caused that parameter, and it is getting hard for me to track.
I can see that isBaseBranch used to change the behaviour of max_commit. Is an unchanged leftover from changing the min_commit and max_commit values?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixing the bug here made the code simpler. I found I can have the same behavior on max_commit in the base branch, and all its lineage. That is the reason I happily removed "isBaseBranch". This change has nothing to do with the change to minCommit behavior. I just got smarter :-). As for the other parameters - Which one needs clarification?

Co-authored-by: arielshaqed <ariels@treeverse.io>
@arielshaqed
Copy link
Contributor

Also, can we retitle this? AFAICT it does not "erase the object from all commits from master", see my comments on #997 where I reproduced. The objects are deleted from the listings, but they still exist. We should avoid misinformation.

Copy link
Contributor

@nopcoder nopcoder left a comment

Choose a reason for hiding this comment

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

The code doesn't pass the test

@@ -120,3 +122,94 @@ func testDeleteEntryCommitAndExpectNotFound(t *testing.T, ctx context.Context, c
t.Fatalf("DeleteEntry() get entry err = %s, want = %s", err, wantErr)
}
}

func TestCataloger_DeleteEntryAndCheckItRemainsInCommits(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Think you can leave the second test as it cover this one - but it is just me ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous test is somewhat different, and it covers list by prefix (where a separate bug was fixed)

Comment on lines 24 to 27
fmt.Sprintf("min_commit != %d AS is_committed", MinCommitUncommittedIndicator),
"max_commit = 0 AS is_tombstone",
"ctid AS entry_ctid\n",
fmt.Sprintf("max_commit < %d AS is_deleted", MaxCommitID)).
fmt.Sprintf("max_commit < %d AS is_deleted", actualCommit)).
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the Column syntax - ex: .Column("min_commit != ? AS is_committed", MinCommitUncommittedIndicator)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, Fixed them all

@codecov-io
Copy link

codecov-io commented Dec 5, 2020

Codecov Report

Merging #1000 (db47811) into master (b1b3858) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1000      +/-   ##
==========================================
+ Coverage   44.26%   44.27%   +0.01%     
==========================================
  Files         140      140              
  Lines       11570    11570              
==========================================
+ Hits         5121     5123       +2     
+ Misses       5799     5797       -2     
  Partials      650      650              
Impacted Files Coverage Δ
catalog/mvcc/cataloger_list_entries.go 85.21% <100.00%> (-0.32%) ⬇️
catalog/mvcc/views.go 100.00% <100.00%> (+2.98%) ⬆️
catalog/mvcc/cataloger_create_branch.go 84.90% <0.00%> (-3.78%) ⬇️
catalog/mvcc/cataloger_create_entry.go 100.00% <0.00%> (+5.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1b3858...db47811. Read the comment docs.

@tzahij tzahij merged commit 99e89ec into master Dec 6, 2020
@arielshaqed
Copy link
Contributor

This comment (missed in the commits) needs to be addressed immediately:

Also, can we retitle this? AFAICT it does not "erase the object from all commits from master", see my comments on #997 where I reproduced. The objects are deleted from the listings, but they still exist. We should avoid misinformation.

The title of this PR is simply the title of issue #997. That issue was titled without a root-cause analysis, since it came from outside (thanks again, @tsykes-2020, for a really good catch!). To limit further fallout I am changing the PR title unilaterally. @tzahij and others: please feel free to correct the title further as needed!

@arielshaqed arielshaqed changed the title Committing an object deletion to master erases object from all commits to master - #997 Make objects deleted in the same branch that created them continue to show up in older commits (#997) Dec 6, 2020
@nopcoder nopcoder deleted the bugfix/issue-997 branch February 4, 2021 12:40
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.

Committing an object deletion to master erases object from all commits to master
6 participants