diff options
author | Sami Hiltunen <shiltunen@gitlab.com> | 2024-01-10 23:09:34 +0300 |
---|---|---|
committer | Sami Hiltunen <shiltunen@gitlab.com> | 2024-01-13 14:42:38 +0300 |
commit | 511a64dd9dfbfb9745c4475fe1143b697e5a938b (patch) | |
tree | 3a70af3c4932d4d5156f0174bf1a7461ff05aa0b | |
parent | 96b75e53b61c476029d510270daa1d5dfc444a09 (diff) |
Remove an obsolete TransactionManager test
TransactionManager has a test asserting that the pack file includes
unreachable objects. This was done previously as we didn't have a
good way to pack and hold on to all needed objects to ensure the packs
will always apply.
We've since introduced new functionality in Git that allows us to pack
the objects from the quarantine and figure out at the same time which
objects the quarantined objects depend on in the repository. We'll thus
prevent pruning the unreachable objects that a transaction depended upon
instead of packing them in the pack.
As we're about to change the behavior, remove the test that is about to
be obsoleted.
-rw-r--r-- | internal/gitaly/storage/storagemgr/transaction_manager_test.go | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/internal/gitaly/storage/storagemgr/transaction_manager_test.go b/internal/gitaly/storage/storagemgr/transaction_manager_test.go index 2e5e2b8b8..a8d5f31f2 100644 --- a/internal/gitaly/storage/storagemgr/transaction_manager_test.go +++ b/internal/gitaly/storage/storagemgr/transaction_manager_test.go @@ -657,122 +657,6 @@ func generateCommonTests(t *testing.T, ctx context.Context, setup testTransactio }, }, { - desc: "pack file includes unreachable objects depended upon", - steps: steps{ - Prune{}, - StartManager{}, - Begin{ - TransactionID: 1, - RelativePath: setup.RelativePath, - }, - Commit{ - TransactionID: 1, - ReferenceUpdates: ReferenceUpdates{ - "refs/heads/main": {OldOID: setup.ObjectHash.ZeroOID, NewOID: setup.Commits.Second.OID}, - }, - QuarantinedPacks: [][]byte{ - setup.Commits.First.Pack, - setup.Commits.Second.Pack, - }, - }, - Begin{ - TransactionID: 2, - RelativePath: setup.RelativePath, - ExpectedSnapshotLSN: 1, - }, - // Point main to the first commit so the second one is unreachable. - Commit{ - TransactionID: 2, - ReferenceUpdates: ReferenceUpdates{ - "refs/heads/main": {OldOID: setup.Commits.Second.OID, NewOID: setup.Commits.First.OID}, - }, - }, - AssertManager{}, - CloseManager{}, - StartManager{ - // Crash the manager before the third transaction is applied. This allows us to - // prune before it is applied to ensure the pack file contains all necessary commits. - Hooks: testTransactionHooks{ - BeforeApplyLogEntry: func(hookContext) { - panic(errSimulatedCrash) - }, - }, - ExpectedError: errSimulatedCrash, - }, - Begin{ - TransactionID: 3, - RelativePath: setup.RelativePath, - ExpectedSnapshotLSN: 2, - }, - Commit{ - TransactionID: 3, - ReferenceUpdates: ReferenceUpdates{ - "refs/heads/main": {OldOID: setup.Commits.First.OID, NewOID: setup.Commits.Third.OID}, - }, - QuarantinedPacks: [][]byte{setup.Commits.Third.Pack}, - ExpectedError: ErrTransactionProcessingStopped, - }, - AssertManager{ - ExpectedError: errSimulatedCrash, - }, - // Prune so the unreachable commits have been removed prior to the third log entry being - // applied. - Prune{ - ExpectedObjects: []git.ObjectID{ - setup.ObjectHash.EmptyTreeOID, - setup.Commits.First.OID, - }, - }, - StartManager{}, - }, - expectedState: StateAssertion{ - Database: DatabaseState{ - string(keyAppliedLSN(setup.PartitionID)): LSN(3).toProto(), - }, - Directory: testhelper.DirectoryState{ - "/": {Mode: fs.ModeDir | perm.PrivateDir}, - "/wal": {Mode: fs.ModeDir | perm.PrivateDir}, - "/wal/1": {Mode: fs.ModeDir | perm.PrivateDir}, - "/wal/1/objects.idx": indexFileDirectoryEntry(setup.Config), - "/wal/1/objects.rev": reverseIndexFileDirectoryEntry(setup.Config), - "/wal/1/objects.pack": packFileDirectoryEntry( - setup.Config, - []git.ObjectID{ - setup.ObjectHash.EmptyTreeOID, - setup.Commits.First.OID, - setup.Commits.Second.OID, - }, - ), - "/wal/3": {Mode: fs.ModeDir | perm.PrivateDir}, - "/wal/3/objects.idx": indexFileDirectoryEntry(setup.Config), - "/wal/3/objects.rev": reverseIndexFileDirectoryEntry(setup.Config), - "/wal/3/objects.pack": packFileDirectoryEntry( - setup.Config, - []git.ObjectID{ - setup.Commits.Second.OID, - setup.Commits.Third.OID, - }, - ), - }, - Repositories: RepositoryStates{ - setup.RelativePath: { - DefaultBranch: "refs/heads/main", - References: &ReferencesState{ - LooseReferences: map[git.ReferenceName]git.ObjectID{ - "refs/heads/main": setup.Commits.Third.OID, - }, - }, - Objects: []git.ObjectID{ - setup.ObjectHash.EmptyTreeOID, - setup.Commits.First.OID, - setup.Commits.Second.OID, - setup.Commits.Third.OID, - }, - }, - }, - }, - }, - { desc: "pack file reapplying works", steps: steps{ Prune{}, |