Skip to content

Commit 002f2ab

Browse files
committed
Remove the prop_MergeUnion test
It is similar to `prop_MergeDistributes`, and we'll test the semantics of `combineUnion` separately.
1 parent b5c79d2 commit 002f2ab

File tree

1 file changed

+1
-42
lines changed
  • test/Test/Database/LSMTree/Internal

1 file changed

+1
-42
lines changed

test/Test/Database/LSMTree/Internal/Merge.hs

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import qualified Data.BloomFilter as Bloom
77
import Data.Foldable (traverse_)
88
import Data.Map.Strict (Map)
99
import qualified Data.Map.Strict as Map
10-
import Data.Maybe (isJust, mapMaybe)
10+
import Data.Maybe (isJust)
1111
import qualified Data.Vector as V
1212
import Database.LSMTree.Extras
1313
import Database.LSMTree.Extras.Generators (KeyForIndexCompact)
@@ -39,9 +39,6 @@ tests = testGroup "Test.Database.LSMTree.Internal.Merge"
3939
[ testProperty "prop_MergeDistributes" $ \mergeType stepSize rds ->
4040
ioPropertyWithMockFS $ \fs hbio ->
4141
prop_MergeDistributes fs hbio mergeType stepSize rds
42-
, testProperty "prop_MergeUnion" $ \stepSize rds ->
43-
ioPropertyWithMockFS $ \fs hbio ->
44-
prop_MergeUnion fs hbio stepSize rds
4542
, testProperty "prop_AbortMerge" $ \level stepSize rds ->
4643
ioPropertyWithMockFS $ \fs hbio ->
4744
prop_AbortMerge fs hbio level stepSize rds
@@ -134,44 +131,6 @@ prop_MergeDistributes fs hbio mergeType stepSize (SmallList rds) =
134131
, blobFileContent
135132
)
136133

137-
-- | Union-merging multiple runs behaves like 'Map.unionsWith' on their values
138-
-- and blobs.
139-
prop_MergeUnion ::
140-
FS.HasFS IO h ->
141-
FS.HasBlockIO IO h ->
142-
StepSize ->
143-
SmallList (RunData KeyForIndexCompact SerialisedValue SerialisedBlob) ->
144-
IO Property
145-
prop_MergeUnion fs hbio stepSize (SmallList rds) =
146-
withRuns fs hbio (V.fromList (zip (simplePaths [10..]) rds')) $ \runs -> do
147-
(_, run) <- mergeRuns fs hbio MergeUnion (RunNumber 0) runs stepSize
148-
149-
lhsKOps <- readKOps Nothing run
150-
let lhs = Map.fromList (mapMaybe (traverse getValueAndBlob) lhsKOps)
151-
152-
-- cleanup
153-
releaseRef run
154-
155-
return $
156-
lhs === rhs
157-
.&&. counterexample ("Deletes in " <> show lhs)
158-
(all ((/= Entry.Delete) . snd) lhsKOps)
159-
where
160-
rds' = fmap serialiseRunData rds
161-
162-
rhs :: Map SerialisedKey (SerialisedValue, Maybe SerialisedBlob)
163-
rhs = Map.unionsWith resolveValueAndBlob
164-
(map (Map.mapMaybe getValueAndBlob . unRunData) rds')
165-
166-
getValueAndBlob :: Entry.Entry v b -> Maybe (v, Maybe b)
167-
getValueAndBlob = \case
168-
Entry.Insert v -> Just (v, Nothing)
169-
Entry.InsertWithBlob v b -> Just (v, Just b)
170-
Entry.Mupdate v -> Just (v, Nothing)
171-
Entry.Delete -> Nothing
172-
173-
resolveValueAndBlob (v', b') (v, _) = (mappendValues v' v, b')
174-
175134
-- | After merging for a few steps, we can prematurely abort the merge, which
176135
-- should clean up properly.
177136
prop_AbortMerge ::

0 commit comments

Comments
 (0)