TestHintFileIntegration_MixedDataStructures tests hint files with mixed data structures
(t *testing.T)
| 274 | |
| 275 | // TestHintFileIntegration_MixedDataStructures tests hint files with mixed data structures |
| 276 | func TestHintFileIntegration_MixedDataStructures(t *testing.T) { |
| 277 | runForMergeModes(t, func(t *testing.T, mode mergeTestMode) { |
| 278 | opts := DefaultOptions |
| 279 | opts.SegmentSize = 64 * KB |
| 280 | opts.Dir = filepath.Join(t.TempDir(), fmt.Sprintf("test-hintfile-mixed-ds-%s", mode.name)) |
| 281 | opts.EnableHintFile = true |
| 282 | opts.EnableMergeV2 = mode.enableMergeV2 |
| 283 | |
| 284 | removeDir(opts.Dir) |
| 285 | |
| 286 | db, err := Open(opts) |
| 287 | require.NoError(t, err) |
| 288 | |
| 289 | // Create buckets for different data structures |
| 290 | bucketBTree := "bucket_btree" |
| 291 | bucketSet := "bucket_set" |
| 292 | bucketList := "bucket_list" |
| 293 | bucketZSet := "bucket_zset" |
| 294 | |
| 295 | txCreateBucket(t, db, DataStructureBTree, bucketBTree, nil) |
| 296 | txCreateBucket(t, db, DataStructureSet, bucketSet, nil) |
| 297 | txCreateBucket(t, db, DataStructureList, bucketList, nil) |
| 298 | txCreateBucket(t, db, DataStructureSortedSet, bucketZSet, nil) |
| 299 | |
| 300 | // Add data to each structure - increase data size to ensure 2 files are created |
| 301 | for i := 0; i < 2000; i++ { |
| 302 | txPut(t, db, bucketBTree, testutils.GetTestBytes(i), testutils.GetTestBytes(i), Persistent, nil, nil) |
| 303 | } |
| 304 | |
| 305 | setKey := testutils.GetTestBytes(0) |
| 306 | for i := 0; i < 1000; i++ { |
| 307 | txSAdd(t, db, bucketSet, setKey, testutils.GetTestBytes(i), nil, nil) |
| 308 | } |
| 309 | |
| 310 | listKey := testutils.GetTestBytes(0) |
| 311 | for i := 0; i < 500; i++ { |
| 312 | txPush(t, db, bucketList, listKey, testutils.GetTestBytes(i), true, nil, nil) |
| 313 | } |
| 314 | |
| 315 | zsetKey := testutils.GetTestBytes(0) |
| 316 | for i := 0; i < 300; i++ { |
| 317 | txZAdd(t, db, bucketZSet, zsetKey, testutils.GetTestBytes(i), float64(i), nil, nil) |
| 318 | } |
| 319 | |
| 320 | // Delete some data from each structure |
| 321 | for i := 0; i < 500; i++ { |
| 322 | txDel(t, db, bucketBTree, testutils.GetTestBytes(i), nil) |
| 323 | } |
| 324 | for i := 0; i < 250; i++ { |
| 325 | txSRem(t, db, bucketSet, setKey, testutils.GetTestBytes(i), nil) |
| 326 | } |
| 327 | for i := 0; i < 100; i++ { |
| 328 | txPop(t, db, bucketList, listKey, testutils.GetTestBytes(i), nil, false) |
| 329 | } |
| 330 | for i := 0; i < 50; i++ { |
| 331 | txZRem(t, db, bucketZSet, zsetKey, testutils.GetTestBytes(i), nil) |
| 332 | } |
| 333 |
nothing calls this directly
no test coverage detected