Skip to content

Commit 7580fd6

Browse files
authored
[DE-561] ArangoSearch column cache (#492)
* inverted index: primaryKeyCache * updated test docker images * primaryKeyCache test fix * inverted index: primarySort.cache * inverted index: StoredValue.cache * inverted index: cache * inverted index: InvertedIndexField.cache * test fixes * arangosearch view: FieldLink.cache * arangosearch view: primarySortCache & primaryKeyCache
1 parent eebcc41 commit 7580fd6

File tree

11 files changed

+186
-26
lines changed

11 files changed

+186
-26
lines changed

.github/workflows/native.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
docker-img:
17-
- docker.io/arangodb/enterprise:3.10.1
17+
- docker.io/arangodb/enterprise:3.10.5
1818
topology:
1919
- single
2020
java-version:
@@ -53,7 +53,7 @@ jobs:
5353
fail-fast: false
5454
matrix:
5555
docker-img:
56-
- docker.io/arangodb/enterprise:3.10.1
56+
- docker.io/arangodb/enterprise:3.10.5
5757
topology:
5858
- single
5959
java-version:

.github/workflows/test.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
docker-img:
28-
- docker.io/arangodb/arangodb:3.8.8
29-
- docker.io/arangodb/arangodb:3.9.9
30-
- docker.io/arangodb/arangodb:3.10.4
31-
- docker.io/arangodb/enterprise:3.8.8
32-
- docker.io/arangodb/enterprise:3.9.9
33-
- docker.io/arangodb/enterprise:3.10.4
28+
- docker.io/arangodb/arangodb:3.9.10
29+
- docker.io/arangodb/arangodb:3.10.5
30+
- docker.io/arangodb/enterprise:3.9.10
31+
- docker.io/arangodb/enterprise:3.10.5
3432
topology:
3533
- single
3634
- cluster
@@ -81,7 +79,7 @@ jobs:
8179
fail-fast: false
8280
matrix:
8381
docker-img:
84-
- docker.io/arangodb/arangodb:3.10.4
82+
- docker.io/arangodb/arangodb:3.10.5
8583
topology:
8684
- single
8785
java-version:
@@ -131,7 +129,7 @@ jobs:
131129
fail-fast: false
132130
matrix:
133131
docker-img:
134-
- docker.io/arangodb/enterprise:3.10.4
132+
- docker.io/arangodb/enterprise:3.10.5
135133
topology:
136134
- single
137135
- cluster
@@ -184,7 +182,7 @@ jobs:
184182
- 2.11.4
185183
- 2.10.5
186184
docker-img:
187-
- docker.io/arangodb/arangodb:3.10.4
185+
- docker.io/arangodb/arangodb:3.10.5
188186
topology:
189187
- single
190188
db-ext-names:
@@ -222,7 +220,7 @@ jobs:
222220
fail-fast: false
223221
matrix:
224222
docker-img:
225-
- docker.io/arangodb/arangodb:3.10.4
223+
- docker.io/arangodb/arangodb:3.10.5
226224
topology:
227225
- single
228226
- cluster
@@ -267,7 +265,7 @@ jobs:
267265
fail-fast: false
268266
matrix:
269267
docker-img:
270-
- docker.io/arangodb/enterprise:3.10.4
268+
- docker.io/arangodb/enterprise:3.10.5
271269
topology:
272270
- cluster
273271
db-ext-names:

core/src/main/java/com/arangodb/entity/InvertedIndexEntity.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public final class InvertedIndexEntity {
5757
private Long writebufferIdle;
5858
private Long writebufferActive;
5959
private Long writebufferSizeMax;
60+
private Boolean cache;
61+
private Boolean primaryKeyCache;
6062

6163
public String getId() {
6264
return id;
@@ -149,4 +151,12 @@ public Long getWritebufferActive() {
149151
public Long getWritebufferSizeMax() {
150152
return writebufferSizeMax;
151153
}
154+
155+
public Boolean getCache() {
156+
return cache;
157+
}
158+
159+
public Boolean getPrimaryKeyCache() {
160+
return primaryKeyCache;
161+
}
152162
}

core/src/main/java/com/arangodb/entity/InvertedIndexField.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public final class InvertedIndexField {
1515
private Boolean includeAllFields;
1616
private Boolean searchField;
1717
private Boolean trackListPositions;
18+
private Boolean cache;
1819
private final Set<AnalyzerFeature> features = new HashSet<>();
1920
private Collection<InvertedIndexField> nested;
2021

@@ -103,6 +104,23 @@ public InvertedIndexField trackListPositions(Boolean trackListPositions) {
103104
return this;
104105
}
105106

107+
public Boolean getCache() {
108+
return cache;
109+
}
110+
111+
/**
112+
* @param cache Enable this option to always cache the field normalization values in memory for this specific field.
113+
* This can improve the performance of scoring and ranking queries. Otherwise, these values are
114+
* memory-mapped and it is up to the operating system to load them from disk into memory and to evict
115+
* them from memory. (Enterprise Edition only)
116+
* @return this
117+
* @since ArangoDB 3.10.2
118+
*/
119+
public InvertedIndexField cache(Boolean cache) {
120+
this.cache = cache;
121+
return this;
122+
}
123+
106124
public Set<AnalyzerFeature> getFeatures() {
107125
return features;
108126
}
@@ -139,11 +157,11 @@ public boolean equals(Object o) {
139157
if (this == o) return true;
140158
if (o == null || getClass() != o.getClass()) return false;
141159
InvertedIndexField that = (InvertedIndexField) o;
142-
return Objects.equals(name, that.name) && Objects.equals(analyzer, that.analyzer) && Objects.equals(includeAllFields, that.includeAllFields) && Objects.equals(searchField, that.searchField) && Objects.equals(trackListPositions, that.trackListPositions) && Objects.equals(features, that.features) && Objects.equals(nested, that.nested);
160+
return Objects.equals(name, that.name) && Objects.equals(analyzer, that.analyzer) && Objects.equals(includeAllFields, that.includeAllFields) && Objects.equals(searchField, that.searchField) && Objects.equals(trackListPositions, that.trackListPositions) && Objects.equals(cache, that.cache) && Objects.equals(features, that.features) && Objects.equals(nested, that.nested);
143161
}
144162

145163
@Override
146164
public int hashCode() {
147-
return Objects.hash(name, analyzer, includeAllFields, searchField, trackListPositions, features, nested);
165+
return Objects.hash(name, analyzer, includeAllFields, searchField, trackListPositions, cache, features, nested);
148166
}
149167
}

core/src/main/java/com/arangodb/entity/InvertedIndexPrimarySort.java

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
public final class InvertedIndexPrimarySort {
1818
private final List<Field> fields = new ArrayList<>();
1919
private ArangoSearchCompression compression;
20+
private Boolean cache;
2021

2122
public List<Field> getFields() {
2223
return fields;
@@ -44,17 +45,34 @@ public InvertedIndexPrimarySort compression(ArangoSearchCompression compression)
4445
return this;
4546
}
4647

48+
public Boolean getCache() {
49+
return cache;
50+
}
51+
52+
/**
53+
* @param cache If you enable this option, then the primary sort columns are always cached in memory. This can
54+
* improve the performance of queries that utilize the primary sort order. Otherwise, these values are
55+
* memory-mapped and it is up to the operating system to load them from disk into memory and to evict
56+
* them from memory (Enterprise Edition only).
57+
* @return this
58+
* @since ArangoDB 3.10.2
59+
*/
60+
public InvertedIndexPrimarySort cache(Boolean cache) {
61+
this.cache = cache;
62+
return this;
63+
}
64+
4765
@Override
4866
public boolean equals(Object o) {
4967
if (this == o) return true;
5068
if (o == null || getClass() != o.getClass()) return false;
5169
InvertedIndexPrimarySort that = (InvertedIndexPrimarySort) o;
52-
return Objects.equals(fields, that.fields) && compression == that.compression;
70+
return Objects.equals(fields, that.fields) && compression == that.compression && Objects.equals(cache, that.cache);
5371
}
5472

5573
@Override
5674
public int hashCode() {
57-
return Objects.hash(fields, compression);
75+
return Objects.hash(fields, compression, cache);
5876
}
5977

6078
public static class Field {

core/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchPropertiesEntity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public final class ArangoSearchPropertiesEntity extends ViewEntity {
4141
private Collection<CollectionLink> links;
4242
private ArangoSearchCompression primarySortCompression;
4343
private Collection<StoredValue> storedValues;
44+
private Boolean primarySortCache;
45+
private Boolean primaryKeyCache;
4446

4547
/**
4648
* @return Wait at least this many milliseconds between committing view data store changes and making documents
@@ -119,4 +121,11 @@ public Collection<StoredValue> getStoredValues() {
119121
return storedValues;
120122
}
121123

124+
public Boolean getPrimarySortCache() {
125+
return primarySortCache;
126+
}
127+
128+
public Boolean getPrimaryKeyCache() {
129+
return primaryKeyCache;
130+
}
122131
}

core/src/main/java/com/arangodb/entity/arangosearch/FieldLink.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public final class FieldLink {
2121
private Collection<FieldLink> fields;
2222
private Collection<FieldLink> nested;
2323
private Boolean inBackground;
24+
private Boolean cache;
2425

2526
private FieldLink(final String name) {
2627
super();
@@ -112,6 +113,19 @@ public FieldLink inBackground(final Boolean inBackground) {
112113
return this;
113114
}
114115

116+
/**
117+
* @param cache If you enable this option, then field normalization values are always cached in memory. This can
118+
* improve the performance of scoring and ranking queries. Otherwise, these values are memory-mapped
119+
* and it is up to the operating system to load them from disk into memory and to evict them from
120+
* memory.
121+
* @return link
122+
* @since ArangoDB 3.9.5, Enterprise Edition only
123+
*/
124+
public FieldLink cache(final Boolean cache) {
125+
this.cache = cache;
126+
return this;
127+
}
128+
115129
@JsonIgnore
116130
public String getName() {
117131
return name;
@@ -146,4 +160,8 @@ public Collection<FieldLink> getNested() {
146160
public Boolean getInBackground() {
147161
return inBackground;
148162
}
163+
164+
public Boolean getCache() {
165+
return cache;
166+
}
149167
}

core/src/main/java/com/arangodb/model/InvertedIndexOptions.java

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public final class InvertedIndexOptions extends IndexOptions<InvertedIndexOption
5151
private Long writebufferIdle;
5252
private Long writebufferActive;
5353
private Long writebufferSizeMax;
54+
private Boolean cache;
55+
private Boolean primaryKeyCache;
5456

5557
public InvertedIndexOptions() {
5658
super();
@@ -347,16 +349,52 @@ public InvertedIndexOptions writebufferSizeMax(Long writebufferSizeMax) {
347349
return this;
348350
}
349351

352+
public Boolean getCache() {
353+
return cache;
354+
}
355+
356+
/**
357+
* @param cache Enable this option to always cache the field normalization values in memory for all fields by
358+
* default. This can improve the performance of scoring and ranking queries. Otherwise, these values
359+
* are memory-mapped and it is up to the operating system to load them from disk into memory and to
360+
* evict them from memory.
361+
* <p/>
362+
* Default: `false`. (Enterprise Edition only)
363+
* @return this
364+
* @since ArangoDB 3.10.2
365+
*/
366+
public InvertedIndexOptions cache(Boolean cache) {
367+
this.cache = cache;
368+
return this;
369+
}
370+
371+
public Boolean getPrimaryKeyCache() {
372+
return primaryKeyCache;
373+
}
374+
375+
/**
376+
* @param primaryKeyCache If you enable this option, then the primary key columns are always cached in memory. This
377+
* can improve the performance of queries that return many documents. Otherwise, these values
378+
* are memory-mapped and it is up to the operating system to load them from disk into memory
379+
* and to evict them from memory (Enterprise Edition only). (default: false)
380+
* @return this
381+
* @since ArangoDB 3.10.2
382+
*/
383+
public InvertedIndexOptions primaryKeyCache(Boolean primaryKeyCache) {
384+
this.primaryKeyCache = primaryKeyCache;
385+
return this;
386+
}
387+
350388
@Override
351389
public boolean equals(Object o) {
352390
if (this == o) return true;
353391
if (o == null || getClass() != o.getClass()) return false;
354392
InvertedIndexOptions that = (InvertedIndexOptions) o;
355-
return type == that.type && Objects.equals(parallelism, that.parallelism) && Objects.equals(primarySort, that.primarySort) && Objects.equals(storedValues, that.storedValues) && Objects.equals(analyzer, that.analyzer) && Objects.equals(features, that.features) && Objects.equals(includeAllFields, that.includeAllFields) && Objects.equals(trackListPositions, that.trackListPositions) && Objects.equals(searchField, that.searchField) && Objects.equals(fields, that.fields) && Objects.equals(consolidationIntervalMsec, that.consolidationIntervalMsec) && Objects.equals(commitIntervalMsec, that.commitIntervalMsec) && Objects.equals(cleanupIntervalStep, that.cleanupIntervalStep) && Objects.equals(consolidationPolicy, that.consolidationPolicy) && Objects.equals(writebufferIdle, that.writebufferIdle) && Objects.equals(writebufferActive, that.writebufferActive) && Objects.equals(writebufferSizeMax, that.writebufferSizeMax);
393+
return type == that.type && Objects.equals(parallelism, that.parallelism) && Objects.equals(primarySort, that.primarySort) && Objects.equals(storedValues, that.storedValues) && Objects.equals(analyzer, that.analyzer) && Objects.equals(features, that.features) && Objects.equals(includeAllFields, that.includeAllFields) && Objects.equals(trackListPositions, that.trackListPositions) && Objects.equals(searchField, that.searchField) && Objects.equals(fields, that.fields) && Objects.equals(consolidationIntervalMsec, that.consolidationIntervalMsec) && Objects.equals(commitIntervalMsec, that.commitIntervalMsec) && Objects.equals(cleanupIntervalStep, that.cleanupIntervalStep) && Objects.equals(consolidationPolicy, that.consolidationPolicy) && Objects.equals(writebufferIdle, that.writebufferIdle) && Objects.equals(writebufferActive, that.writebufferActive) && Objects.equals(writebufferSizeMax, that.writebufferSizeMax) && Objects.equals(cache, that.cache) && Objects.equals(primaryKeyCache, that.primaryKeyCache);
356394
}
357395

358396
@Override
359397
public int hashCode() {
360-
return Objects.hash(type, parallelism, primarySort, storedValues, analyzer, features, includeAllFields, trackListPositions, searchField, fields, consolidationIntervalMsec, commitIntervalMsec, cleanupIntervalStep, consolidationPolicy, writebufferIdle, writebufferActive, writebufferSizeMax);
398+
return Objects.hash(type, parallelism, primarySort, storedValues, analyzer, features, includeAllFields, trackListPositions, searchField, fields, consolidationIntervalMsec, commitIntervalMsec, cleanupIntervalStep, consolidationPolicy, writebufferIdle, writebufferActive, writebufferSizeMax, cache, primaryKeyCache);
361399
}
362400
}

core/src/main/java/com/arangodb/model/arangosearch/ArangoSearchCreateOptions.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public final class ArangoSearchCreateOptions {
4343
private Collection<PrimarySort> primarySorts;
4444
private ArangoSearchCompression primarySortCompression;
4545
private Collection<StoredValue> storedValues;
46+
private Boolean primarySortCache;
47+
private Boolean primaryKeyCache;
4648

4749
public ArangoSearchCreateOptions() {
4850
super();
@@ -162,6 +164,32 @@ public ArangoSearchCreateOptions storedValues(final StoredValue... storedValues)
162164
return this;
163165
}
164166

167+
/**
168+
* @param primarySortCache If you enable this option, then the primary sort columns are always cached in memory.
169+
* This can improve the performance of queries that utilize the primary sort order.
170+
* Otherwise, these values are memory-mapped and it is up to the operating system to load
171+
* them from disk into memory and to evict them from memory.
172+
* @return options
173+
* @since ArangoDB 3.9.6, Enterprise Edition only
174+
*/
175+
public ArangoSearchCreateOptions primarySortCache(final Boolean primarySortCache) {
176+
this.primarySortCache = primarySortCache;
177+
return this;
178+
}
179+
180+
/**
181+
* @param primaryKeyCache If you enable this option, then the primary key columns are always cached in memory. This
182+
* can improve the performance of queries that return many documents. Otherwise, these values
183+
* are memory-mapped and it is up to the operating system to load them from disk into memory
184+
* and to evict them from memory.
185+
* @return options
186+
* @since ArangoDB 3.9.6, Enterprise Edition only
187+
*/
188+
public ArangoSearchCreateOptions primaryKeyCache(final Boolean primaryKeyCache) {
189+
this.primaryKeyCache = primaryKeyCache;
190+
return this;
191+
}
192+
165193
public String getName() {
166194
return name;
167195
}
@@ -203,4 +231,12 @@ public Collection<StoredValue> getStoredValues() {
203231
return storedValues;
204232
}
205233

234+
public Boolean getPrimarySortCache() {
235+
return primarySortCache;
236+
}
237+
238+
public Boolean getPrimaryKeyCache() {
239+
return primaryKeyCache;
240+
}
241+
206242
}

0 commit comments

Comments
 (0)