diff --git a/v2/CHANGELOG.md b/v2/CHANGELOG.md index 34e96634..bae741ab 100644 --- a/v2/CHANGELOG.md +++ b/v2/CHANGELOG.md @@ -5,6 +5,7 @@ - Add ARM Support for V2 testcases - Set TESTV2PARALLEL from 1 to 4 - Disabled V8 related testcases in V1 and V2 +- Added new ConsolidationPolicy attributes to support updated configuration options for ArangoSearch Views properties and Inverted Indexes ## [2.1.6](https://github.com/arangodb/go-driver/tree/v2.1.6) (2025-11-06) - Add missing endpoints from replication diff --git a/v2/arangodb/shared.go b/v2/arangodb/shared.go index ada024c6..4cd16b16 100644 --- a/v2/arangodb/shared.go +++ b/v2/arangodb/shared.go @@ -133,17 +133,31 @@ type ConsolidationPolicyBytesAccum struct { // ConsolidationPolicyTier contains fields used for ConsolidationPolicyTypeTier type ConsolidationPolicyTier struct { // MinScore Filter out consolidation candidates with a score less than this. Default: 0 + // Deprecated: Only available up to v3.12.6. MinScore *int64 `json:"minScore,omitempty"` - // SegmentsMin The minimum number of segments that are evaluated as candidates for consolidation. Default: 1 + // Deprecated: Only available up to v3.12.6. + // Deprecated since v3.12.7. Use segment byte size skew–based consolidation. SegmentsMin *int64 `json:"segmentsMin,omitempty"` // SegmentsMax The maximum number of segments that are evaluated as candidates for consolidation. Default: 10 + // Deprecated: Only available up to v3.12.6. SegmentsMax *int64 `json:"segmentsMax,omitempty"` // SegmentsBytesMax The maximum allowed size of all consolidated segments in bytes. Default: 5368709120 SegmentsBytesMax *int64 `json:"segmentsBytesMax,omitempty"` // SegmentsBytesFloor Defines the value (in bytes) to treat all smaller segments as equal for consolidation selection. Default: 2097152 + // Deprecated: Only available up to v3.12.6. SegmentsBytesFloor *int64 `json:"segmentsBytesFloor,omitempty"` + + // MaxSkewThreshold defines the maximum allowed size skew between segment files + // (value between 0.0 and 1.0) before they are considered for consolidation. + // Default: 0.4. Available from ArangoDB v3.12.7 onward. + MaxSkewThreshold *float64 `json:"maxSkewThreshold,omitempty"` + + // MinDeletionRatio defines the minimum ratio of deleted documents (0.0–1.0) + // required to trigger segment cleanup. + // Default: 0.5. Available from ArangoDB v3.12.7 onward. + MinDeletionRatio *float64 `json:"minDeletionRatio,omitempty"` } diff --git a/v2/arangodb/view_arango_search.go b/v2/arangodb/view_arango_search.go index 87da87b8..cfad6c78 100644 --- a/v2/arangodb/view_arango_search.go +++ b/v2/arangodb/view_arango_search.go @@ -149,19 +149,33 @@ type ArangoSearchConsolidationPolicyBytesAccum struct { // ArangoSearchConsolidationPolicyTier contains fields used for ArangoSearchConsolidationPolicyTypeTier type ArangoSearchConsolidationPolicyTier struct { + // Deprecated: Only available up to v3.12.6. MinScore *int64 `json:"minScore,omitempty"` - // MinSegments specifies the minimum number of segments that will be evaluated as candidates for consolidation. + // Deprecated: Only available up to v3.12.6. + // Deprecated since v3.12.7. Use segment byte size skew–based consolidation. MinSegments *int64 `json:"segmentsMin,omitempty"` // MaxSegments specifies the maximum number of segments that will be evaluated as candidates for consolidation. + // Deprecated: Only available up to v3.12.6. MaxSegments *int64 `json:"segmentsMax,omitempty"` // SegmentsBytesMax specifies the maxinum allowed size of all consolidated segments in bytes. SegmentsBytesMax *int64 `json:"segmentsBytesMax,omitempty"` // SegmentsBytesFloor defines the value (in bytes) to treat all smaller segments as equal for consolidation selection. + // Deprecated: Only available up to v3.12.6. SegmentsBytesFloor *int64 `json:"segmentsBytesFloor,omitempty"` + + // MaxSkewThreshold defines the maximum allowed size skew between segment files + // (value between 0.0 and 1.0) before they are considered for consolidation. + // Default: 0.4. Available from ArangoDB v3.12.7 onward. + MaxSkewThreshold *float64 `json:"maxSkewThreshold,omitempty"` + + // MinDeletionRatio defines the minimum ratio of deleted documents (0.0–1.0) + // required to trigger segment cleanup. + // Default: 0.5. Available from ArangoDB v3.12.7 onward. + MinDeletionRatio *float64 `json:"minDeletionRatio,omitempty"` } // ArangoSearchPrimarySortEntry describes an entry for the primarySort list diff --git a/v2/tests/database_collection_indexes_test.go b/v2/tests/database_collection_indexes_test.go index b9763974..57b9a248 100644 --- a/v2/tests/database_collection_indexes_test.go +++ b/v2/tests/database_collection_indexes_test.go @@ -371,6 +371,8 @@ func Test_NamedIndexes(t *testing.T) { WithDatabase(t, client, nil, func(db arangodb.Database) { WithCollectionV2(t, db, nil, func(col arangodb.Collection) { withContextT(t, defaultTestTimeout, func(ctx context.Context, _ testing.TB) { + clientVersion, _ := client.Version(ctx) + t.Logf("Arangodb Version: %s", clientVersion.Version) var namedIndexTestCases = []struct { Name string @@ -441,6 +443,10 @@ func Test_NamedIndexes(t *testing.T) { }, }, }) + if clientVersion.Version.CompareTo("3.12.7") >= 0 { + require.Equal(t, 0.4, *idx.InvertedIndex.ConsolidationPolicy.MaxSkewThreshold) + require.Equal(t, 0.5, *idx.InvertedIndex.ConsolidationPolicy.MinDeletionRatio) + } return idx, err }, }, diff --git a/v2/tests/database_view-arangosearch-simple_test.go b/v2/tests/database_view-arangosearch-simple_test.go index 01ca0917..78fd5643 100644 --- a/v2/tests/database_view-arangosearch-simple_test.go +++ b/v2/tests/database_view-arangosearch-simple_test.go @@ -42,11 +42,18 @@ func Test_ArangoSearchSimple(t *testing.T) { CommitInterval: utils.NewType[int64](500), } + clientVersion, _ := client.Version(ctx) + t.Logf("Arangodb Version: %s", clientVersion.Version) + view, err := db.CreateArangoSearchView(ctx, viewName, opts) require.NoError(t, err, "Failed to create alias view '%s'", viewName) prop, err := view.Properties(ctx) require.NoError(t, err) + if clientVersion.Version.CompareTo("3.12.7") >= 0 { + require.Equal(t, 0.4, *prop.ConsolidationPolicy.MaxSkewThreshold) + require.Equal(t, 0.5, *prop.ConsolidationPolicy.MinDeletionRatio) + } require.Equal(t, prop.Type, arangodb.ViewTypeArangoSearch) require.Equal(t, prop.Name, viewName) require.Equal(t, int64(1), *prop.CleanupIntervalStep) @@ -61,6 +68,10 @@ func Test_ArangoSearchSimple(t *testing.T) { pr, err := view.Properties(ctx) require.NoError(t, err) + if clientVersion.Version.CompareTo("3.12.7") >= 0 { + require.Equal(t, 0.4, *pr.ConsolidationPolicy.MaxSkewThreshold) + require.Equal(t, 0.5, *pr.ConsolidationPolicy.MinDeletionRatio) + } require.Equal(t, pr.Type, arangodb.ViewTypeArangoSearch) require.Equal(t, pr.Name, viewName) require.Equal(t, int64(1), *pr.CleanupIntervalStep) @@ -76,6 +87,10 @@ func Test_ArangoSearchSimple(t *testing.T) { pr, err := view.Properties(ctx) require.NoError(t, err) + if clientVersion.Version.CompareTo("3.12.7") >= 0 { + require.Equal(t, 0.4, *pr.ConsolidationPolicy.MaxSkewThreshold) + require.Equal(t, 0.5, *pr.ConsolidationPolicy.MinDeletionRatio) + } require.Equal(t, pr.Type, arangodb.ViewTypeArangoSearch) require.Equal(t, pr.Name, viewName) require.Equal(t, int64(300), *pr.CommitInterval)