Skip to content

feat: Adds property based testing framework for compaction (#26783)#26865

Merged
devanbenz merged 1 commit into1.12from
db/cherrypick-3f1f4a
Sep 30, 2025
Merged

feat: Adds property based testing framework for compaction (#26783)#26865
devanbenz merged 1 commit into1.12from
db/cherrypick-3f1f4a

Conversation

@devanbenz
Copy link
Copy Markdown

Adds property based testing framework for our compaction testings. Current we support checking for "gaps" within adjacent compaction groups.

For example:

			expectedResult: func() TestLevelResults {
				return TestLevelResults{
					// Our rogue level 2 file should be picked up in the full compaction
					level4Groups: []tsm1.PlannedCompactionGroup{
						{
							tsm1.CompactionGroup{
								"000016844-000000002.tsm",
								"000016948-000000004.tsm",
								"000016948-000000005.tsm",
								"000017076-000000004.tsm",
								"000017094-000000004.tsm",
							},
							tsdb.DefaultMaxPointsPerBlock,
						},
					},
					// Other files should get picked up by optimize compaction
					level5Groups: []tsm1.PlannedCompactionGroup{
						{
							tsm1.CompactionGroup{
								"000016684-000000007.tsm",
								"000016684-000000008.tsm",
								"000016684-000000009.tsm",
								"000016684-000000010.tsm",
								"000016812-000000004.tsm",
								"000016812-000000005.tsm",
								"000017095-000000005.tsm",
							},
							tsdb.DefaultMaxPointsPerBlock,
						},
					},
				}
			},
		},

Would be invalid and cause our validator to fail due to the file "000017095-000000005.tsm" in level5Groups.

(cherry picked from commit 3f1f4a0)

Adds property based testing framework for our compaction testings.
Current we support checking for "gaps" within adjacent compaction groups.

For example:
```
			expectedResult: func() TestLevelResults {
				return TestLevelResults{
					// Our rogue level 2 file should be picked up in the full compaction
					level4Groups: []tsm1.PlannedCompactionGroup{
						{
							tsm1.CompactionGroup{
								"000016844-000000002.tsm",
								"000016948-000000004.tsm",
								"000016948-000000005.tsm",
								"000017076-000000004.tsm",
								"000017094-000000004.tsm",
							},
							tsdb.DefaultMaxPointsPerBlock,
						},
					},
					// Other files should get picked up by optimize compaction
					level5Groups: []tsm1.PlannedCompactionGroup{
						{
							tsm1.CompactionGroup{
								"000016684-000000007.tsm",
								"000016684-000000008.tsm",
								"000016684-000000009.tsm",
								"000016684-000000010.tsm",
								"000016812-000000004.tsm",
								"000016812-000000005.tsm",
								"000017095-000000005.tsm",
							},
							tsdb.DefaultMaxPointsPerBlock,
						},
					},
				}
			},
		},
```

Would be invalid and cause our validator to fail due to the file `"000017095-000000005.tsm"` in `level5Groups`.

(cherry picked from commit 3f1f4a0)
Copy link
Copy Markdown
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

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

LGTM

@devanbenz devanbenz merged commit ba2c2b6 into 1.12 Sep 30, 2025
9 checks passed
@devanbenz devanbenz deleted the db/cherrypick-3f1f4a branch September 30, 2025 14:30
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.

2 participants