Skip to content

Commit 955aaed

Browse files
OAS-11786: Added new attributes to Support new ConsolidationPolicy in 3.12.7 and modified testcases accordingly
1 parent f7010b4 commit 955aaed

File tree

4 files changed

+49
-1
lines changed

4 files changed

+49
-1
lines changed

v2/arangodb/shared.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,31 @@ type ConsolidationPolicyBytesAccum struct {
133133
// ConsolidationPolicyTier contains fields used for ConsolidationPolicyTypeTier
134134
type ConsolidationPolicyTier struct {
135135
// MinScore Filter out consolidation candidates with a score less than this. Default: 0
136+
// This option is only available up to v3.12.6
136137
MinScore *int64 `json:"minScore,omitempty"`
137138

138139
// SegmentsMin The minimum number of segments that are evaluated as candidates for consolidation. Default: 1
140+
// This option is only available up to v3.12.6
139141
SegmentsMin *int64 `json:"segmentsMin,omitempty"`
140142

141143
// SegmentsMax The maximum number of segments that are evaluated as candidates for consolidation. Default: 10
144+
// This option is only available up to v3.12.6
142145
SegmentsMax *int64 `json:"segmentsMax,omitempty"`
143146

144147
// SegmentsBytesMax The maximum allowed size of all consolidated segments in bytes. Default: 5368709120
145148
SegmentsBytesMax *int64 `json:"segmentsBytesMax,omitempty"`
146149

147150
// SegmentsBytesFloor Defines the value (in bytes) to treat all smaller segments as equal for consolidation selection. Default: 2097152
151+
// This option is only available up to v3.12.6
148152
SegmentsBytesFloor *int64 `json:"segmentsBytesFloor,omitempty"`
153+
154+
// MaxSkewThreshold defines the maximum allowed size skew between segment files
155+
// (value between 0.0 and 1.0) before they are considered for consolidation.
156+
// Default: 0.4. Available from ArangoDB v3.12.7 onward.
157+
MaxSkewThreshold *float64 `json:"maxSkewThreshold,omitempty"`
158+
159+
// MinDeletionRatio defines the minimum ratio of deleted documents (0.0–1.0)
160+
// required to trigger segment cleanup.
161+
// Default: 0.5. Available from ArangoDB v3.12.7 onward.
162+
MinDeletionRatio *float64 `json:"minDeletionRatio,omitempty"`
149163
}

v2/arangodb/view_arango_search.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,33 @@ type ArangoSearchConsolidationPolicyBytesAccum struct {
149149

150150
// ArangoSearchConsolidationPolicyTier contains fields used for ArangoSearchConsolidationPolicyTypeTier
151151
type ArangoSearchConsolidationPolicyTier struct {
152+
// This option is only available up to v3.12.6
152153
MinScore *int64 `json:"minScore,omitempty"`
153154

154155
// MinSegments specifies the minimum number of segments that will be evaluated as candidates for consolidation.
156+
// This option is only available up to v3.12.6
155157
MinSegments *int64 `json:"segmentsMin,omitempty"`
156158

157159
// MaxSegments specifies the maximum number of segments that will be evaluated as candidates for consolidation.
160+
// This option is only available up to v3.12.6
158161
MaxSegments *int64 `json:"segmentsMax,omitempty"`
159162

160163
// SegmentsBytesMax specifies the maxinum allowed size of all consolidated segments in bytes.
161164
SegmentsBytesMax *int64 `json:"segmentsBytesMax,omitempty"`
162165

163166
// SegmentsBytesFloor defines the value (in bytes) to treat all smaller segments as equal for consolidation selection.
167+
// This option is only available up to v3.12.6
164168
SegmentsBytesFloor *int64 `json:"segmentsBytesFloor,omitempty"`
169+
170+
// MaxSkewThreshold defines the maximum allowed size skew between segment files
171+
// (value between 0.0 and 1.0) before they are considered for consolidation.
172+
// Default: 0.4. Available from ArangoDB v3.12.7 onward.
173+
MaxSkewThreshold *float64 `json:"maxSkewThreshold,omitempty"`
174+
175+
// MinDeletionRatio defines the minimum ratio of deleted documents (0.0–1.0)
176+
// required to trigger segment cleanup.
177+
// Default: 0.5. Available from ArangoDB v3.12.7 onward.
178+
MinDeletionRatio *float64 `json:"minDeletionRatio,omitempty"`
165179
}
166180

167181
// ArangoSearchPrimarySortEntry describes an entry for the primarySort list

v2/tests/database_collection_indexes_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ func Test_NamedIndexes(t *testing.T) {
371371
WithDatabase(t, client, nil, func(db arangodb.Database) {
372372
WithCollectionV2(t, db, nil, func(col arangodb.Collection) {
373373
withContextT(t, defaultTestTimeout, func(ctx context.Context, _ testing.TB) {
374+
clientVersion, _ := client.Version(ctx)
375+
t.Logf("Arangodb Version: %s", clientVersion.Version)
374376

375377
var namedIndexTestCases = []struct {
376378
Name string
@@ -441,6 +443,10 @@ func Test_NamedIndexes(t *testing.T) {
441443
},
442444
},
443445
})
446+
if clientVersion.Version.CompareTo("3.12.7") >= 0 {
447+
require.Equal(t, 0.4, *idx.InvertedIndex.ConsolidationPolicy.MaxSkewThreshold)
448+
require.Equal(t, 0.5, *idx.InvertedIndex.ConsolidationPolicy.MinDeletionRatio)
449+
}
444450
return idx, err
445451
},
446452
},

v2/tests/database_view-arangosearch-simple_test.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,18 @@ func Test_ArangoSearchSimple(t *testing.T) {
4242
CommitInterval: utils.NewType[int64](500),
4343
}
4444

45+
clientVersion, _ := client.Version(ctx)
46+
t.Logf("Arangodb Version: %s", clientVersion.Version)
47+
4548
view, err := db.CreateArangoSearchView(ctx, viewName, opts)
4649
require.NoError(t, err, "Failed to create alias view '%s'", viewName)
4750

4851
prop, err := view.Properties(ctx)
4952
require.NoError(t, err)
50-
require.Equal(t, prop.Type, arangodb.ViewTypeArangoSearch)
53+
if clientVersion.Version.CompareTo("3.12.7") >= 0 {
54+
require.Equal(t, 0.4, *prop.ConsolidationPolicy.MaxSkewThreshold)
55+
require.Equal(t, 0.5, *prop.ConsolidationPolicy.MinDeletionRatio)
56+
}
5157
require.Equal(t, prop.Name, viewName)
5258
require.Equal(t, int64(1), *prop.CleanupIntervalStep)
5359
require.Equal(t, int64(500), *prop.CommitInterval)
@@ -61,6 +67,10 @@ func Test_ArangoSearchSimple(t *testing.T) {
6167

6268
pr, err := view.Properties(ctx)
6369
require.NoError(t, err)
70+
if clientVersion.Version.CompareTo("3.12.7") >= 0 {
71+
require.Equal(t, 0.4, *pr.ConsolidationPolicy.MaxSkewThreshold)
72+
require.Equal(t, 0.5, *pr.ConsolidationPolicy.MinDeletionRatio)
73+
}
6474
require.Equal(t, pr.Type, arangodb.ViewTypeArangoSearch)
6575
require.Equal(t, pr.Name, viewName)
6676
require.Equal(t, int64(1), *pr.CleanupIntervalStep)
@@ -76,6 +86,10 @@ func Test_ArangoSearchSimple(t *testing.T) {
7686

7787
pr, err := view.Properties(ctx)
7888
require.NoError(t, err)
89+
if clientVersion.Version.CompareTo("3.12.7") >= 0 {
90+
require.Equal(t, 0.4, *pr.ConsolidationPolicy.MaxSkewThreshold)
91+
require.Equal(t, 0.5, *pr.ConsolidationPolicy.MinDeletionRatio)
92+
}
7993
require.Equal(t, pr.Type, arangodb.ViewTypeArangoSearch)
8094
require.Equal(t, pr.Name, viewName)
8195
require.Equal(t, int64(300), *pr.CommitInterval)

0 commit comments

Comments
 (0)