Skip to content

Commit 9d3a58b

Browse files
authored
GT-154 Update the structures to align them with the ArangoDB 3.10 release (#416)
* GT-154 Update the structures to align them with the ArangoDB 3.10 release * fix name * update doc
1 parent 756f3a4 commit 9d3a58b

11 files changed

+62
-8
lines changed

.travis.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ env:
3232
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.6.16
3333
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.7.17
3434
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.8.5.1
35-
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.9.0 ALWAYS=1
36-
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:latest TEST_DISALLOW_UNKNOWN_FIELDS=false
35+
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.9.0
36+
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:3.10-nightly TEST_DISALLOW_UNKNOWN_FIELDS=false ALWAYS=1
3737
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.6.16
3838
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.7.17
3939
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.8.5.1
40-
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.9.0 ALWAYS=1
41-
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:latest
40+
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.9.0
41+
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:3.10-nightly ALWAYS=1
4242

4343
script:
4444
- |

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Add support for `computedValues`
66
- Optional `computeOn` field in `computedValues`
77
- Add support for `computedValues` into collection inventory
8+
- Update the structures to align them with the ArangoDB 3.10 release
89

910
## [1.3.3](https://github.com/arangodb/go-driver/tree/v1.3.3) (2022-07-27)
1011
- Fix `lastValue` field type

client_server_admin.go

+1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ type TransactionStats struct {
132132
Committed int64 `json:"committed"`
133133
IntermediateCommits int64 `json:"intermediateCommits"`
134134
ReadOnly int64 `json:"readOnly,omitempty"`
135+
DirtyReadOnly int64 `json:"dirtyReadOnly,omitempty"`
135136
}
136137

137138
// MemoryStats contains statistics about memory usage.

cluster.go

+1
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ type InventoryIndex struct {
315315
ExpireAfter int `json:"expireAfter,omitempty"`
316316
Estimates bool `json:"estimates,omitempty"`
317317
FieldValueTypes string `json:"fieldValueTypes,omitempty"`
318+
CacheEnabled *bool `json:"cacheEnabled,omitempty"`
318319
}
319320

320321
// FieldsEqual returns true when the given fields list equals the

collection.go

+7
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,13 @@ type CollectionStatistics struct {
296296
// The memory used for storing the revisions of this collection in the storage engine (in bytes). This figure does not include the document data but only mappings from document revision ids to storage engine datafile positions.
297297
Size int64 `json:"size,omitempty"`
298298
} `json:"revisions"`
299+
300+
DocumentsSize *int64 `json:"documentsSize,omitempty"`
301+
302+
// RocksDB cache statistics
303+
CacheInUse *bool `json:"cacheInUse,omitempty"`
304+
CacheSize *int64 `json:"cacheSize,omitempty"`
305+
CacheUsage *int64 `json:"cacheUsage,omitempty"`
299306
} `json:"figures"`
300307
}
301308

collection_indexes_impl.go

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ type indexData struct {
4646
SelectivityEstimate float64 `json:"selectivityEstimate,omitempty"`
4747
BestIndexedLevel int `json:"bestIndexedLevel,omitempty"`
4848
WorstIndexedLevel int `json:"worstIndexedLevel,omitempty"`
49+
LegacyPolygons *bool `json:"legacyPolygons,omitempty"`
50+
CacheEnabled *bool `json:"cacheEnabled,omitempty"`
4951

5052
ArangoError `json:",inline"`
5153
}

context.go

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ func WithWaitForSync(parent context.Context, value ...bool) context.Context {
159159
// You can pass a reference to a boolean that will set according to whether a potentially dirty read
160160
// happened or not. nil is allowed.
161161
// This is valid for document reads, aql queries, gharial vertex and edge reads.
162+
// Since 3.10 This feature is available in the Enterprise Edition for cluster deployments as well
162163
func WithAllowDirtyReads(parent context.Context, wasDirtyRead *bool) context.Context {
163164
return context.WithValue(contextOrBackground(parent), keyAllowDirtyReads, wasDirtyRead)
164165
}

cursor_impl.go

+20-3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ type cursor struct {
5858
lastReadWasDirty bool
5959
}
6060

61+
// CursorStats TODO: all these int64 should be changed into uint64
6162
type cursorStats struct {
6263
// The total number of data-modification operations successfully executed.
6364
WritesExecutedInt int64 `json:"writesExecuted,omitempty"`
@@ -76,6 +77,21 @@ type cursorStats struct {
7677
Nodes []cursorPlanNodes `json:"nodes,omitempty"`
7778
HttpRequests int64 `json:"httpRequests,omitempty"`
7879
PeakMemoryUsage int64 `json:"peakMemoryUsage,omitempty"`
80+
81+
// CursorsCreated the total number of cursor objects created during query execution. Cursor objects are created for index lookups.
82+
CursorsCreated uint64 `json:"cursorsCreated,omitempty"`
83+
// CursorsRearmed the total number of times an existing cursor object was repurposed.
84+
// Repurposing an existing cursor object is normally more efficient compared to destroying an existing cursor object
85+
// and creating a new one from scratch.
86+
CursorsRearmed uint64 `json:"cursorsRearmed,omitempty"`
87+
// CacheHits the total number of index entries read from in-memory caches for indexes of type edge or persistent.
88+
// This value will only be non-zero when reading from indexes that have an in-memory cache enabled,
89+
// and when the query allows using the in-memory cache (i.e. using equality lookups on all index attributes).
90+
CacheHits uint64 `json:"cacheHits,omitempty"`
91+
// CacheMisses the total number of cache read attempts for index entries that could not be served from in-memory caches for indexes of type edge or persistent.
92+
// This value will only be non-zero when reading from indexes that have an in-memory cache enabled,
93+
// the query allows using the in-memory cache (i.e. using equality lookups on all index attributes) and the looked up values are not present in the cache.
94+
CacheMisses uint64 `json:"cacheMisses,omitempty"`
7995
}
8096

8197
type cursorPlan struct {
@@ -131,9 +147,10 @@ func (c cursorExtra) GetPlanRaw() ([]byte, bool, error) {
131147
}
132148

133149
type cursorPlanVariable struct {
134-
ID int `json:"id"`
135-
Name string `json:"name"`
136-
IsDataFromCollection bool `json:"isDataFromCollection"`
150+
ID int `json:"id"`
151+
Name string `json:"name"`
152+
IsDataFromCollection bool `json:"isDataFromCollection"`
153+
IsFullDocumentFromCollection bool `json:"isFullDocumentFromCollection"`
137154
}
138155

139156
type cursorPlanCollection struct {

database_collections_schema.go

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type CollectionSchemaOptions struct {
3939
Rule interface{} `json:"rule,omitempty"`
4040
Level CollectionSchemaLevel `json:"level,omitempty"`
4141
Message string `json:"message,omitempty"`
42+
Type string `json:"type,omitempty"`
4243
}
4344

4445
func (d *CollectionSchemaOptions) LoadRule(data []byte) error {

test/collection_schema_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestCollectionSchema(t *testing.T) {
4949
ctx, cancel := context.WithCancel(context.Background())
5050
defer cancel()
5151

52-
EnsureVersion(t, ctx, c).CheckVersion(MinimumVersion("3.7.0"))
52+
EnsureVersion(t, ctx, c).CheckVersion(MinimumVersion("3.10.0"))
5353

5454
name := "document_schema_validation_test"
5555
db := ensureDatabase(nil, c, name, nil, t)
@@ -58,6 +58,7 @@ func TestCollectionSchema(t *testing.T) {
5858
Schema: &driver.CollectionSchemaOptions{
5959
Level: driver.CollectionSchemaLevelStrict,
6060
Message: "Validation Err",
61+
Type: "json",
6162
},
6263
}
6364

@@ -91,6 +92,7 @@ func TestCollectionSchema(t *testing.T) {
9192
schema := &driver.CollectionSchemaOptions{
9293
Level: driver.CollectionSchemaLevelStrict,
9394
Message: "Validation Err",
95+
Type: "json",
9496
}
9597

9698
require.NoError(t, schema.LoadRule([]byte(`{
@@ -127,6 +129,7 @@ func TestCollectionSchema(t *testing.T) {
127129
schema := &driver.CollectionSchemaOptions{
128130
Level: driver.CollectionSchemaLevelStrict,
129131
Message: "Validation Err",
132+
Type: "json",
130133
}
131134

132135
require.NoError(t, schema.LoadRule([]byte(`{
@@ -150,6 +153,7 @@ func TestCollectionSchema(t *testing.T) {
150153
schema := &driver.CollectionSchemaOptions{
151154
Level: driver.CollectionSchemaLevelStrict,
152155
Message: "Validation Err",
156+
Type: "json",
153157
}
154158

155159
require.NoError(t, schema.LoadRule([]byte(`{

v2/arangodb/cursor.go

+19
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Cursor interface {
5454
Statistics() CursorStats
5555
}
5656

57+
// CursorStats TODO: all these int64 should be changed into uint64
5758
type CursorStats struct {
5859
// The total number of data-modification operations successfully executed.
5960
WritesExecutedInt int64 `json:"writesExecuted,omitempty"`
@@ -69,6 +70,24 @@ type CursorStats struct {
6970
FullCountInt int64 `json:"fullCount,omitempty"`
7071
// Query execution time (wall-clock time). value will be set from the outside
7172
ExecutionTimeInt float64 `json:"executionTime,omitempty"`
73+
74+
HTTPRequests uint64 `json:"httpRequests,omitempty"`
75+
PeakMemoryUsage uint64 `json:"peakMemoryUsage,omitempty"`
76+
77+
// CursorsCreated the total number of cursor objects created during query execution. Cursor objects are created for index lookups.
78+
CursorsCreated uint64 `json:"cursorsCreated,omitempty"`
79+
// CursorsRearmed the total number of times an existing cursor object was repurposed.
80+
// Repurposing an existing cursor object is normally more efficient compared to destroying an existing cursor object
81+
// and creating a new one from scratch.
82+
CursorsRearmed uint64 `json:"cursorsRearmed,omitempty"`
83+
// CacheHits the total number of index entries read from in-memory caches for indexes of type edge or persistent.
84+
// This value will only be non-zero when reading from indexes that have an in-memory cache enabled,
85+
// and when the query allows using the in-memory cache (i.e. using equality lookups on all index attributes).
86+
CacheHits uint64 `json:"cacheHits,omitempty"`
87+
// CacheMisses the total number of cache read attempts for index entries that could not be served from in-memory caches for indexes of type edge or persistent.
88+
// This value will only be non-zero when reading from indexes that have an in-memory cache enabled,
89+
// the query allows using the in-memory cache (i.e. using equality lookups on all index attributes) and the looked up values are not present in the cache.
90+
CacheMisses uint64 `json:"cacheMisses,omitempty"`
7291
}
7392

7493
type cursorData struct {

0 commit comments

Comments
 (0)