8 | int main(){for(;;)pause();}
9 | ' >pause.c
10 | gcc -o pause pause.c
11 |
12 | [ -z "$CONTAINER_INIT_SCRIPT" ] && export CONTAINER_INIT_SCRIPT="$ciscripts_dir/secondary/tests/ci/scripts/build"
13 |
14 | echo "running $CONTAINER_INIT_SCRIPT"
15 |
16 | bash $CONTAINER_INIT_SCRIPT &
17 | ./pause
18 |
--------------------------------------------------------------------------------
/secondary/tests/ci/scripts/setup/run_ci_dc.yaml:
--------------------------------------------------------------------------------
1 | name: ci_runner
2 |
3 | services:
4 | ci:
5 | build:
6 | dockerfile: ci_machine.dockerfile
7 | args:
8 | PEGGED: $PEGGED
9 | # RELEASE: 8.0.0
10 | # MANIFEST: couchbase-server/morpheus/8.0.0.xml
11 | CIBOT: true
12 | MODE: "unit,functional"
13 | USERNAME: cbci # gerrit username
14 | tags:
15 | - ci_machine:latest
16 | - ci_machine:$PEGGED
17 | secrets:
18 | - github_key
19 | - gerrit_key
20 | ulimits:
21 | nofile:
22 | soft: 200000
23 | hard: 400000
24 | secrets:
25 | - github_key
26 | - gerrit_key
27 | ports:
28 | - "8091-8095:8091-8095"
29 | - "11200-11220:11200-11220"
30 | - "9000-9120:9000-9120"
31 | - 2222:22
32 | volumes:
33 | - build:/home/bot/build:rw
34 | - var-www:/var/www:rw
35 | - depscache:/home/bot/.cbdepscache:rw
36 | - depscache:/home/bot/.cbdepcache:rw
37 | - $HOME/testdata:/home/bot/testdata
38 | init: true
39 | # comment both of the below to run standalone tests
40 | restart: unless-stopped
41 | entrypoint: /home/bot/.ciscripts/secondary/tests/ci/scripts/setup/container-runner.sh
42 | # cpus: 6.0
43 | cpuset: "0-5"
44 | mem_limit: 12G
45 | memswap_limit: "0"
46 | apache:
47 | build:
48 | dockerfile: apache_server.dockerfile
49 | restart: unless-stopped
50 | volumes:
51 | - var-www:/var/www:ro
52 | ports:
53 | - 80:80
54 | cpus: 0.5
55 | mem_limit: 1G
56 | secrets:
57 | github_key:
58 | file: $HOME/.ssh/id_rsa_server_buildnode_to_github
59 | gerrit_key:
60 | file: $HOME/.ssh/cbci
61 | volumes:
62 | var-www:
63 | build:
64 | driver: local
65 | driver_opts:
66 | type: none
67 | device: /opt/ci
68 | o: bind
69 | depscache:
70 |
--------------------------------------------------------------------------------
/secondary/tests/ci/scripts/setup/standalone-runner.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # this file is supposed to be a trimmed down version of dobuild
4 | # dobuild clones gerrit patches. here the expectation is that
5 | # all the clone has happened already in the $WORKSPACE
6 |
7 | source $HOME/.cienv
8 |
9 | if [ ! -d "/mnt/project/goproj/src/github.com/couchbase/indexing" ];
10 | then
11 | domain
12 | exit $?
13 | fi;
14 |
15 | echo "cloning custom repo into $WORKSPACE"
16 | cp -r /mnt/project/* $WORKSPACE
17 | rm -rf $WORKSPACE/analytics/CMakeLists.txt
18 | cd $WORKSPACE/goproj/src/github.com/couchbase/indexing
19 | cp -r secondary/tests/ci/scripts/* /home/bot/bin/
20 |
21 | export PATH=/home/bot/bin:$PATH
22 |
23 | echo "running standalone runner - $WORKSPACE"
24 |
25 | export TS="$(date +%d.%m.%Y-%H.%M)"
26 | echo ''
27 | echo 'Building using ' $(which builder) '...'
28 |
29 | cd $WORKSPACE
30 | make clean
31 | rm -rf build
32 | rm -rf analytics/CMakeLists.txt
33 |
34 | # add 2ici_test flag
35 | sed -i 's/SET (TAGS "jemalloc")/SET (TAGS "jemalloc 2ici_test")/' $WORKSPACE/goproj/src/github.com/couchbase/indexing/CMakeLists.txt
36 |
37 | builder
38 | rc=$?
39 | echo "builder exit code $rc"
40 | test $rc -eq 0 || (cat $WORKSPACE/make.log && exit 2)
41 |
42 | echo 'Build done'
43 | echo 'Testing using ' $(which dotest) '...'
44 |
45 | dotest
46 | rc=$?
47 | echo 'Test done'
48 | echo '
'
49 |
50 | if [ $rc -eq 0 ]; then status=pass; else status=fail; fi
51 | echo ''
52 | gzip ${WORKSPACE}/logs.tar 2>&1 1>/dev/null
53 | echo "Version: versions-$TS.cfg"
54 | echo "Build Log: make-$TS.log"
55 | echo "Server Log: logs-$TS.tar.gz"
56 | echo "
Finished
"
57 |
58 | cp $WORKSPACE/logs.tar.gz /mnt/project/
59 | cp $WORKSPACE/make.log /mnt/project/
60 | cp $WORKSPACE/test.log /mnt/project/
61 |
--------------------------------------------------------------------------------
/secondary/tests/ci/scripts/setupvm:
--------------------------------------------------------------------------------
1 | #!/bin/bash -xv
2 | set -e
3 | sudo rm -rf /var/www/lost+found
4 | sudo rm -rf /opt/build/lost+found
5 | sudo cp -r ~admin/xvdb/.htaccess /var/www/
6 | sudo cp -r ~admin/xvdb/var/www/* /var/www/
7 | sudo chown -r buildbot.buildbot /var/www
8 | sudo chown -r buildbot.buildbot /opt/build
9 | if grep -qs CCACHE_DIR ~/.profile; then
10 | echo ccache already setup
11 | else
12 | echo 'export PATH="/usr/lib/ccache:$PATH"' >> ~/.profile
13 | echo 'export CCACHE_DIR=/opt/.ccache' >> ~/.profile
14 | echo 'max_size = 12G' >> /opt/.ccache/ccache.conf
15 | fi
16 |
--------------------------------------------------------------------------------
/secondary/tests/ci/skip.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/indexing/ba752cd53c7865086c4d99f312eafbe3d23982a9/secondary/tests/ci/skip.txt
--------------------------------------------------------------------------------
/secondary/tests/config/blrcluster_conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "KVAddress": "122.248.204.207:8091",
3 | "Username": "Administrator",
4 | "Password": "asdasd"
5 | }
6 |
--------------------------------------------------------------------------------
/secondary/tests/config/build_validation.json:
--------------------------------------------------------------------------------
1 | {
2 | "KVAddress": "127.0.0.1:9000",
3 | "Username": "Administrator",
4 | "Password": "asdasd",
5 | "IndexUsing": "memory_optimized"
6 | }
7 |
--------------------------------------------------------------------------------
/secondary/tests/config/buildtest_fdb.json:
--------------------------------------------------------------------------------
1 | {
2 | "KVAddress": "127.0.0.1:9000",
3 | "Username": "Administrator",
4 | "Password": "asdasd",
5 | "IndexUsing": "forestdb",
6 | "Nodes": [
7 | "127.0.0.1:9000",
8 | "127.0.0.1:9001",
9 | "127.0.0.1:9002",
10 | "127.0.0.1:9003"
11 | ],
12 | "MultipleIndexerTests":true
13 | }
14 |
--------------------------------------------------------------------------------
/secondary/tests/config/buildtest_memdb.json:
--------------------------------------------------------------------------------
1 | {
2 | "KVAddress": "127.0.0.1:9000",
3 | "Username": "Administrator",
4 | "Password": "asdasd",
5 | "IndexUsing": "memory_optimized",
6 | "Nodes": [
7 | "127.0.0.1:9000",
8 | "127.0.0.1:9001",
9 | "127.0.0.1:9002",
10 | "127.0.0.1:9003"
11 | ],
12 | "MultipleIndexerTests":true
13 | }
14 |
--------------------------------------------------------------------------------
/secondary/tests/config/buildtest_plasma.json:
--------------------------------------------------------------------------------
1 | {
2 | "KVAddress": "127.0.0.1:9000",
3 | "Username": "Administrator",
4 | "Password": "asdasd",
5 | "IndexUsing": "plasma",
6 | "Nodes": [
7 | "127.0.0.1:9000",
8 | "127.0.0.1:9001",
9 | "127.0.0.1:9002",
10 | "127.0.0.1:9003",
11 | "127.0.0.1:9004",
12 | "127.0.0.1:9005",
13 | "127.0.0.1:9006"
14 | ],
15 | "MultipleIndexerTests":true
16 | }
17 |
--------------------------------------------------------------------------------
/secondary/tests/config/clusterrun_conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "KVAddress": "127.0.0.1:9000",
3 | "Username": "Administrator",
4 | "Password": "asdasd",
5 | "IndexUsing": "memory_optimized",
6 | "Nodes": [
7 | "127.0.0.1:9000",
8 | "127.0.0.1:9001",
9 | "127.0.0.1:9002",
10 | "127.0.0.1:9003"
11 | ],
12 | "MultipleIndexerTests":true
13 | }
14 |
--------------------------------------------------------------------------------
/secondary/tests/config/remote1node_conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "KVAddress": "54.151.180.34:8091",
3 | "Username": "Administrator",
4 | "Password": "password"
5 | }
--------------------------------------------------------------------------------
/secondary/tests/config/remoteSc1node_conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "KVAddress": "172.23.107.133:8091",
3 | "Username": "Administrator",
4 | "Password": "password"
5 | }
--------------------------------------------------------------------------------
/secondary/tests/config/remoteWindows1node_conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "KVAddress": "172.23.106.123:8091",
3 | "Username": "Administrator",
4 | "Password": "password"
5 | }
6 |
--------------------------------------------------------------------------------
/secondary/tests/framework/common/constants.go:
--------------------------------------------------------------------------------
1 | package common
2 |
3 | const IndexTypesStaticJSONDataDrive = "https://drive.google.com/uc?export=download&id=0B-2n-TmVRNyDelV6amphY2pZa2M"
4 | const IndexTypesStaticJSONDataS3 = "https://s3-ap-southeast-1.amazonaws.com/indexing-test/testdata/Users10k.txt.gz"
5 | const IndexTypesMutationJSONDataS3 = "https://s3-ap-southeast-1.amazonaws.com/indexing-test/testdata/Users_mut.txt.gz"
6 | const IndexTypesTwitterFeed1JSONDataS3 = "https://s3-ap-southeast-1.amazonaws.com/indexing-test/testdata/TwitterFeed1.txt.gz"
7 | const MissingLiteral = "~[]{}falsenilNA~"
8 |
9 | const CODEBOOK_COPY_PREFIX = "codebook_v1"
10 | const REBALANCE_STAGING_DIR = "staging2"
11 | const CODEBOOK_DIR = "codebook"
12 |
--------------------------------------------------------------------------------
/secondary/tests/framework/datautility/jsonloader.go:
--------------------------------------------------------------------------------
1 | package datautility
2 |
3 | import (
4 | "fmt"
5 | json "github.com/couchbase/indexing/secondary/common/json"
6 | tc "github.com/couchbase/indexing/secondary/tests/framework/common"
7 | )
8 |
9 | func LoadJSONFromCompressedFile(path, docidfield string) tc.KeyValues {
10 | file, err := tc.ReadCompressedFile(path)
11 | tc.HandleError(err, "Error while decompressing data file "+path)
12 |
13 | var data interface{}
14 | json.Unmarshal(file, &data)
15 |
16 | m := data.([]interface{})
17 | keyValues := make(tc.KeyValues)
18 |
19 | var i = 0
20 | var k string
21 | if len(docidfield) > 0 {
22 | for _, v := range m {
23 | k = fmt.Sprintf("%v", v.(map[string]interface{})[docidfield])
24 | keyValues[k] = v
25 | i++
26 | }
27 | } else {
28 | for _, v := range m {
29 | k = fmt.Sprintf("%v", i)
30 | keyValues[k] = v
31 | i++
32 | }
33 | }
34 |
35 | return keyValues
36 | }
37 |
--------------------------------------------------------------------------------
/secondary/tests/functionaltests/runtest_clusterrun.sh:
--------------------------------------------------------------------------------
1 | export NS_SERVER_CBAUTH_URL="http://127.0.0.1:9000/_cbauth"
2 | export NS_SERVER_CBAUTH_USER="Administrator"
3 | export NS_SERVER_CBAUTH_PWD="asdasd"
4 | export NS_SERVER_CBAUTH_RPC_URL="http://127.0.0.1:9000/cbauth-demo"
5 |
6 | export CBAUTH_REVRPC_URL="http://Administrator:asdasd@127.0.0.1:9000/query"
7 |
8 | go "$@"
9 |
--------------------------------------------------------------------------------
/secondary/tests/functionaltests/setup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | export WORKSPACE="$(PWD)/../../../../../../../../"
4 | export GOPATH="$WORKSPACE/goproj":"$WORKSPACE/godeps"
5 | export GO111MODULE=auto
6 | export CGO_CFLAGS="-I$WORKSPACE/sigar/include -I$WORKSPACE/build/tlm/deps/zstd-cpp.exploded/include -I$WORKSPACE/build/tlm/deps/jemalloc.exploded/include -I$WORKSPACE/forestdb/include/ -DJEMALLOC=1"
7 | export CGO_LDFLAGS="-L $WORKSPACE/install/lib -Wl,-rpath $WORKSPACE/install/lib"
8 | export CBAUTH_REVRPC_URL="http://Administrator:asdasd@127.0.0.1:9000/query"
9 |
--------------------------------------------------------------------------------
/secondary/tests/perftests/TestPerfScanLatency_Lookup_StaleFalse.json:
--------------------------------------------------------------------------------
1 | {
2 | "Concurrency" : 200,
3 | "Clients": 20,
4 | "ScanSpecs" : [
5 | {
6 | "Type" : "Lookup",
7 | "Bucket" : "default",
8 | "Id" : 3,
9 | "Index" : "index_company",
10 | "Lookups" : [ ["WARETEL"] ],
11 | "Limit" : 1,
12 | "Repeat" : 100000,
13 | "Consistency": true,
14 | "NInterval": 1
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/secondary/tests/perftests/TestPerfScanLatency_Lookup_StaleOk.json:
--------------------------------------------------------------------------------
1 | {
2 | "Concurrency" : 200,
3 | "Clients": 20,
4 | "ScanSpecs" : [
5 | {
6 | "Type" : "Lookup",
7 | "Bucket" : "default",
8 | "Id" : 1,
9 | "Index" : "index_company",
10 | "Lookups" : [ ["WARETEL"] ],
11 | "Limit" : 1,
12 | "Repeat" : 100000,
13 | "Consistency": false,
14 | "NInterval": 1
15 | }
16 | ]
17 | }
--------------------------------------------------------------------------------
/secondary/tests/perftests/TestPerfScanLatency_Range_StaleFalse.json:
--------------------------------------------------------------------------------
1 | {
2 | "Concurrency" : 200,
3 | "Clients": 20,
4 | "ScanSpecs" : [
5 | {
6 | "Type" : "Range",
7 | "Bucket" : "default",
8 | "Id" : 4,
9 | "Index" : "index_company",
10 | "Low" : [
11 | "E"
12 | ],
13 | "High" : [
14 | "P"
15 | ],
16 | "Limit" : 1000000000,
17 | "Repeat" : 100000,
18 | "Consistency": true,
19 | "NInterval": 1
20 | }
21 | ]
22 | }
--------------------------------------------------------------------------------
/secondary/tests/perftests/TestPerfScanLatency_Range_StaleOk.json:
--------------------------------------------------------------------------------
1 | {
2 | "Concurrency" : 200,
3 | "Clients": 20,
4 | "ScanSpecs" : [
5 | {
6 | "Type" : "Range",
7 | "Bucket" : "default",
8 | "Id" : 2,
9 | "Index" : "index_company",
10 | "Low" : [
11 | "E"
12 | ],
13 | "High" : [
14 | "P"
15 | ],
16 | "Limit" : 1000000000,
17 | "Repeat" : 100000,
18 | "Consistency": false,
19 | "NInterval": 1
20 | }
21 | ]
22 | }
--------------------------------------------------------------------------------
/secondary/tests/plasmatests/README-smat.md:
--------------------------------------------------------------------------------
1 | # Instructions for smat testing for plasma
2 |
3 | [smat](https://github.com/mschoch/smat) is a framework that provides
4 | state machine assisted fuzz testing.
5 |
6 | To run the smat tests for plasma...
7 |
8 | ## Prerequisites
9 |
10 | $ go get github.com/dvyukov/go-fuzz/go-fuzz
11 | $ go get github.com/dvyukov/go-fuzz/go-fuzz-build
12 |
13 | ## Steps
14 |
15 | 1. Generate initial smat corpus:
16 | ```
17 | go test -tags=gofuzz -run=TestGenerateSmatCorpus
18 | ```
19 |
20 | 2. Build go-fuzz test program with instrumentation:
21 | ```
22 | go-fuzz-build github.com/couchbase/indexing/secondary/indexer/plasmatests
23 | ```
24 |
25 | 3. Run go-fuzz:
26 | ```
27 | go-fuzz -bin=./indexer-fuzz.zip -workdir=workdir/ -timeout=2000
28 | ```
29 |
--------------------------------------------------------------------------------
/secondary/tests/plasmatests/crash_test.go:
--------------------------------------------------------------------------------
1 | package indexer
2 |
3 | import (
4 | "log"
5 | "os"
6 | "testing"
7 |
8 | "github.com/mschoch/smat"
9 | )
10 |
11 | func TestCrasher(t *testing.T) {
12 | // paste in your crash here:
13 | crasher := []byte("\x00\x1f>]|\x9b\xba\xd9")
14 | // turn on logger
15 | smat.Logger = log.New(os.Stderr, "smat ", log.LstdFlags)
16 | // fuzz the crasher input
17 | smat.Fuzz(&smatContext{}, smat.ActionID('S'), smat.ActionID('T'),
18 | actionMap, crasher)
19 | }
20 |
--------------------------------------------------------------------------------
/secondary/tests/plasmatests/plasma_diag.go:
--------------------------------------------------------------------------------
1 | package indexer
2 |
3 | import (
4 | "net/http"
5 |
6 | "github.com/couchbase/plasma"
7 | )
8 |
9 | func init() {
10 | http.HandleFunc("/plasmaDiag", plasma.Diag.HandleHttp)
11 | go func() {
12 | http.ListenAndServe(":8080", nil)
13 | }()
14 | }
15 |
--------------------------------------------------------------------------------
/secondary/tests/serverlesstests/set99_rebalance_cleanup_test.go:
--------------------------------------------------------------------------------
1 | package serverlesstests
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | // This test removes the SHARD_REBALANCE_DIR from file system
8 | func TestRebalanceStorageDirCleanup(t *testing.T) {
9 | cleanupStorageDir(t)
10 | }
11 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/Users100.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/indexing/ba752cd53c7865086c4d99f312eafbe3d23982a9/secondary/tests/testdata/Users100.txt.gz
--------------------------------------------------------------------------------
/secondary/tests/testdata/Users_Template:
--------------------------------------------------------------------------------
1 | [
2 | '{{repeat(100, 100)}}',
3 | {
4 | _id: '{{objectId()}}',
5 | docid: 'User{{guid()}}',
6 | guid: '{{guid()}}',
7 | isActive: '{{bool()}}',
8 | balance: '{{floating(1000, 4000, 2, "$0,0.00")}}',
9 | picture: 'http://placehold.it/32x32',
10 | age: '{{integer(20, 40)}}',
11 | eyeColor: '{{random("blue", "brown", "green")}}',
12 | name: '{{firstName()}} {{surname()}}',
13 | gender: '{{gender()}}',
14 | company: '{{company().toUpperCase()}}',
15 | email: '{{email()}}',
16 | phone: '+1 {{phone()}}',
17 | address:
18 | {
19 | number: '{{integer(100, 999)}}',
20 | street: '{{street()}}',
21 | city: '{{city()}}',
22 | state: '{{state()}}',
23 | pin: '{{integer(100, 10000)}}'
24 | },
25 | about: '{{lorem(1, "paragraphs")}}',
26 | registered: '{{date(new Date(2014, 0, 1), new Date(), "YYYY-MM-ddThh:mm:ss Z")}}',
27 | latitude: '{{floating(-90.000001, 90)}}',
28 | longitude: '{{floating(-180.000001, 180)}}',
29 | tags: [
30 | '{{repeat(7)}}',
31 | '{{lorem(1, "words")}}'
32 | ],
33 | friends: [
34 | '{{repeat(3)}}',
35 | {
36 | id: '{{index()}}',
37 | name: '{{firstName()}} {{surname()}}'
38 | }
39 | ],
40 | greeting: function (tags) {
41 | return 'Hello, ' + this.name + '! You have ' + tags.integer(1, 10) + ' unread messages.';
42 | },
43 | favoriteFruit: function (tags) {
44 | var fruits = ['apple', 'banana', 'strawberry'];
45 | return fruits[tags.integer(0, fruits.length - 1)];
46 | }
47 | }
48 | ]
--------------------------------------------------------------------------------
/secondary/tests/testdata/invalidjson:
--------------------------------------------------------------------------------
1 | # Inavlid numbers in json
2 | 00
3 | -00
4 | 000475
5 | 0360
6 | -000475
7 | -0360
8 | 36.e3
9 | .67e4
10 | 1.67e9.5
11 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/json.prod:
--------------------------------------------------------------------------------
1 | json : "{" age properties "}".
2 |
3 | properties : properties "," property {100}
4 | | property.
5 |
6 | age : DQ "age" DQ ": " range(15, 80) ", " NL.
7 | property : DQ bag("./web2") DQ ":" value.
8 |
9 | value : TRUE
10 | | FALSE
11 | | NULL
12 | | number
13 | | string
14 | | array
15 | | json.
16 |
17 | string : DQ bag("./web2") DQ.
18 |
19 | number : range(0, 100000)
20 | | rangef(0.0, 100.0) {900}.
21 |
22 | array : "[" values "]".
23 |
24 | values : values "," value
25 | | value.
26 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/new_equiv_index.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name" : "newEquivIdx",
4 | "bucket" : "default",
5 | "isPrimary" : false,
6 | "secExprs" : ["equivField"],
7 | "isArrayIndex" : false,
8 | "replica" : 1,
9 | "defnId" : 987654,
10 | "NoUsageInfo" : true,
11 | "NeedsEstimate" : true
12 | }
13 | ]
14 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/new_equiv_index_1_replica.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name" : "newEquivIdx",
4 | "bucket" : "default",
5 | "isPrimary" : false,
6 | "secExprs" : ["equivField"],
7 | "isArrayIndex" : false,
8 | "replica" : 2,
9 | "defnId" : 987654,
10 | "NoUsageInfo" : true,
11 | "NeedsEstimate" : true
12 | }
13 | ]
14 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/new_equiv_index_2_replica.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name" : "newEquivIdx",
4 | "bucket" : "default",
5 | "isPrimary" : false,
6 | "secExprs" : ["equivField"],
7 | "isArrayIndex" : false,
8 | "replica" : 3,
9 | "defnId" : 987654,
10 | "NoUsageInfo" : true,
11 | "NeedsEstimate" : true
12 | }
13 | ]
14 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/new_index_1.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name" : "idx1",
4 | "bucket" : "bucket2",
5 | "isPrimary" : false,
6 | "secExprs" : ["name1"],
7 | "isArrayIndex" : false,
8 | "replica" : 1,
9 | "defnId" : 987654,
10 | "NoUsageInfo" : true,
11 | "NeedsEstimate" : true
12 | }
13 | ]
14 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/new_index_with_1_replica.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name" : "idx1",
4 | "bucket" : "bucket2",
5 | "isPrimary" : false,
6 | "secExprs" : ["name1"],
7 | "isArrayIndex" : false,
8 | "replica" : 2,
9 | "defnId" : 987654,
10 | "NoUsageInfo" : true,
11 | "NeedsEstimate" : true
12 | }
13 | ]
14 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/new_index_with_2_replicas.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name" : "idx1",
4 | "bucket" : "bucket2",
5 | "isPrimary" : false,
6 | "secExprs" : ["name1"],
7 | "isArrayIndex" : false,
8 | "replica" : 3,
9 | "defnId" : 987654,
10 | "NoUsageInfo" : true,
11 | "NeedsEstimate" : true
12 | }
13 | ]
14 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/topologies/1_empty_1_10pct_filled_node_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "indexerId":"",
7 | "restUrl":"",
8 | "serverGroup":"index 1",
9 | "memUsage":20000000000,
10 | "dataSize":20000000000,
11 | "cpuUsage":1,
12 | "indexes": [
13 | {
14 | "defnId": 1111,
15 | "instId": 0,
16 | "name": "index1",
17 | "bucket": "bucket2",
18 | "host": null,
19 | "avgArrSize": 0,
20 | "avgArrKeySize": 0,
21 | "mutationRate": 0,
22 | "scanRate": 0,
23 | "memUsage": 20000000000,
24 | "dataSize": 20000000000,
25 | "cpuUsage": 1
26 | }
27 | ]
28 | },
29 | {
30 | "nodeId":"127.0.0.1:9002",
31 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
32 | "indexerId":"",
33 | "restUrl":"",
34 | "serverGroup":"index 1"
35 | }
36 | ],
37 | "memQuota":200000000000,
38 | "cpuQuota":30,
39 | "isLive":true
40 | }
41 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/topologies/1_empty_1_30pct_filled_node_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "indexerId":"",
7 | "restUrl":"",
8 | "serverGroup":"index 1",
9 | "memUsage":60000000000,
10 | "dataSize":60000000000,
11 | "cpuUsage":1,
12 | "indexes": [
13 | {
14 | "defnId": 1111,
15 | "instId": 0,
16 | "name": "index1",
17 | "bucket": "bucket2",
18 | "host": null,
19 | "avgArrSize": 0,
20 | "avgArrKeySize": 0,
21 | "mutationRate": 0,
22 | "scanRate": 0,
23 | "memUsage": 60000000000,
24 | "dataSize": 60000000000,
25 | "cpuUsage": 1
26 | }
27 | ]
28 | },
29 | {
30 | "nodeId":"127.0.0.1:9002",
31 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
32 | "indexerId":"",
33 | "restUrl":"",
34 | "serverGroup":"index 1"
35 | }
36 | ],
37 | "memQuota":200000000000,
38 | "cpuQuota":30,
39 | "isLive":true
40 | }
41 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/topologies/1_empty_1_60pct_filled_node_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "indexerId":"",
7 | "restUrl":"",
8 | "serverGroup":"index 1",
9 | "memUsage":120000000000,
10 | "dataSize":120000000000,
11 | "cpuUsage":1,
12 | "indexes": [
13 | {
14 | "defnId": 1111,
15 | "instId": 0,
16 | "name": "index1",
17 | "bucket": "bucket2",
18 | "host": null,
19 | "avgArrSize": 0,
20 | "avgArrKeySize": 0,
21 | "mutationRate": 0,
22 | "scanRate": 0,
23 | "memUsage": 120000000000,
24 | "dataSize": 120000000000,
25 | "cpuUsage": 1
26 | }
27 | ]
28 | },
29 | {
30 | "nodeId":"127.0.0.1:9002",
31 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
32 | "indexerId":"",
33 | "restUrl":"",
34 | "serverGroup":"index 1"
35 | }
36 | ],
37 | "memQuota":200000000000,
38 | "cpuQuota":30,
39 | "isLive":true
40 | }
41 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/topologies/1_empty_2_non_empty_nodes_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "indexerId":"",
7 | "restUrl":"",
8 | "serverGroup":"index 1",
9 | "memUsage":2600000,
10 | "cpuUsage":1,
11 | "memOverhead": 165423720,
12 | "dataSize":0,
13 | "indexes": [
14 | {
15 | "defnId": 1111,
16 | "instId": 0,
17 | "name": "index1",
18 | "bucket": "bucket2",
19 | "host": null,
20 | "avgArrSize": 0,
21 | "avgArrKeySize": 0,
22 | "mutationRate": 0,
23 | "scanRate": 0,
24 | "memUsage": 2600000,
25 | "cpuUsage": 1,
26 | "memOverhead": 165423720
27 | }
28 | ]
29 | },
30 | {
31 | "nodeId":"127.0.0.1:9002",
32 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
33 | "indexerId":"",
34 | "restUrl":"",
35 | "serverGroup":"index 1",
36 | "memUsage":0,
37 | "cpuUsage":0,
38 | "memOverhead":0
39 | },
40 | {
41 | "nodeId":"127.0.0.1:9003",
42 | "nodeUUID":"def15192216a984a53fc19de249e0ba4",
43 | "indexerId":"",
44 | "restUrl":"",
45 | "serverGroup":"index 1",
46 | "memUsage":1600000,
47 | "cpuUsage":1,
48 | "memOverhead": 165423720,
49 | "dataSize":0,
50 | "indexes": [
51 | {
52 | "defnId": 3333,
53 | "instId": 0,
54 | "name": "index3",
55 | "bucket": "bucket2",
56 | "host": null,
57 | "avgArrSize": 0,
58 | "avgArrKeySize": 0,
59 | "mutationRate": 0,
60 | "scanRate": 0,
61 | "memUsage": 1600000,
62 | "cpuUsage": 1,
63 | "memOverhead": 165423720
64 | }
65 | ]
66 | }
67 | ],
68 | "memQuota":100000000000,
69 | "cpuQuota":30,
70 | "isLive":true
71 | }
72 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/topologies/1_empty_2_non_empty_nodes_2_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "indexerId":"",
7 | "restUrl":"",
8 | "serverGroup":"index 2",
9 | "memUsage":2600000,
10 | "cpuUsage":1,
11 | "memOverhead": 165423720,
12 | "dataSize":0,
13 | "indexes": [
14 | {
15 | "defnId": 1111,
16 | "instId": 0,
17 | "name": "index1",
18 | "bucket": "bucket2",
19 | "host": null,
20 | "avgArrSize": 0,
21 | "avgArrKeySize": 0,
22 | "mutationRate": 0,
23 | "scanRate": 0,
24 | "memUsage": 2600000,
25 | "cpuUsage": 1,
26 | "memOverhead": 165423720
27 | }
28 | ]
29 | },
30 | {
31 | "nodeId":"127.0.0.1:9002",
32 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
33 | "indexerId":"",
34 | "restUrl":"",
35 | "serverGroup":"index 1",
36 | "memUsage":0,
37 | "cpuUsage":0,
38 | "memOverhead":0
39 | },
40 | {
41 | "nodeId":"127.0.0.1:9003",
42 | "nodeUUID":"def15192216a984a53fc19de249e0ba4",
43 | "indexerId":"",
44 | "restUrl":"",
45 | "serverGroup":"index 1",
46 | "memUsage":1600000,
47 | "cpuUsage":1,
48 | "memOverhead": 165423720,
49 | "dataSize":0,
50 | "indexes": [
51 | {
52 | "defnId": 3333,
53 | "instId": 0,
54 | "name": "index3",
55 | "bucket": "bucket2",
56 | "host": null,
57 | "avgArrSize": 0,
58 | "avgArrKeySize": 0,
59 | "mutationRate": 0,
60 | "scanRate": 0,
61 | "memUsage": 1600000,
62 | "cpuUsage": 1,
63 | "memOverhead": 165423720
64 | }
65 | ]
66 | }
67 | ],
68 | "memQuota":100000000000,
69 | "cpuQuota":30,
70 | "isLive":true
71 | }
72 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/topologies/2_empty_1_non_empty_nodes_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "indexerId":"",
7 | "restUrl":"",
8 | "serverGroup":"index 1",
9 | "memUsage":0,
10 | "cpuUsage":0,
11 | "memOverhead":0
12 | },
13 | {
14 | "nodeId":"127.0.0.1:9002",
15 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
16 | "indexerId":"",
17 | "restUrl":"",
18 | "serverGroup":"index 1",
19 | "memUsage":0,
20 | "cpuUsage":0,
21 | "memOverhead":0
22 | },
23 | {
24 | "nodeId":"127.0.0.1:9003",
25 | "nodeUUID":"def15192216a984a53fc19de249e0ba4",
26 | "indexerId":"",
27 | "restUrl":"",
28 | "serverGroup":"index 1",
29 | "memUsage":1600000,
30 | "cpuUsage":1,
31 | "memOverhead": 165423720,
32 | "indexes": [
33 | {
34 | "defnId": 3333,
35 | "instId": 0,
36 | "name": "index3",
37 | "bucket": "bucket2",
38 | "host": null,
39 | "avgArrSize": 0,
40 | "avgArrKeySize": 0,
41 | "mutationRate": 0,
42 | "scanRate": 0,
43 | "memUsage": 1600000,
44 | "cpuUsage": 1,
45 | "memOverhead": 165423720
46 | }
47 | ]
48 | }
49 | ],
50 | "memQuota":100000000000,
51 | "cpuQuota":30,
52 | "isLive":true
53 | }
54 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/topologies/2_empty_1_non_empty_nodes_2_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "indexerId":"",
7 | "restUrl":"",
8 | "serverGroup":"index 1",
9 | "memUsage":0,
10 | "cpuUsage":0,
11 | "memOverhead":0
12 | },
13 | {
14 | "nodeId":"127.0.0.1:9002",
15 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
16 | "indexerId":"",
17 | "restUrl":"",
18 | "serverGroup":"index 2",
19 | "memUsage":0,
20 | "cpuUsage":0,
21 | "memOverhead":0
22 | },
23 | {
24 | "nodeId":"127.0.0.1:9003",
25 | "nodeUUID":"def15192216a984a53fc19de249e0ba4",
26 | "indexerId":"",
27 | "restUrl":"",
28 | "serverGroup":"index 1",
29 | "memUsage":1600000,
30 | "cpuUsage":1,
31 | "memOverhead": 165423720,
32 | "indexes": [
33 | {
34 | "defnId": 3333,
35 | "instId": 0,
36 | "name": "index3",
37 | "bucket": "bucket2",
38 | "host": null,
39 | "avgArrSize": 0,
40 | "avgArrKeySize": 0,
41 | "mutationRate": 0,
42 | "scanRate": 0,
43 | "memUsage": 1600000,
44 | "cpuUsage": 1,
45 | "memOverhead": 165423720
46 | }
47 | ]
48 | }
49 | ],
50 | "memQuota":100000000000,
51 | "cpuQuota":30,
52 | "isLive":true
53 | }
54 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/greedy/topologies/3_empty_nodes_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "indexerId":"",
7 | "restUrl":"",
8 | "serverGroup":"index 1",
9 | "memUsage":0,
10 | "cpuUsage":0,
11 | "memOverhead":0,
12 | "dataSize":0
13 | },
14 | {
15 | "nodeId":"127.0.0.1:9002",
16 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
17 | "indexerId":"",
18 | "restUrl":"",
19 | "serverGroup":"index 1",
20 | "memUsage":0,
21 | "cpuUsage":0,
22 | "memOverhead":0,
23 | "dataSize":0
24 | },
25 | {
26 | "nodeId":"127.0.0.1:9003",
27 | "nodeUUID":"def15192216a984a53fc19de249e0ba4",
28 | "indexerId":"",
29 | "restUrl":"",
30 | "serverGroup":"index 1",
31 | "memUsage":0,
32 | "cpuUsage":0,
33 | "memOverhead":0,
34 | "dataSize":0
35 | }
36 | ],
37 | "memQuota":100000000000,
38 | "cpuQuota":30,
39 | "isLive":true
40 | }
41 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/index/replica-3-constraint.json:
--------------------------------------------------------------------------------
1 | [{"name" : "index1",
2 | "bucket" : "bucket2",
3 | "isPrimary" : false,
4 | "secExprs" : ["name"],
5 | "isArrayIndex" : false,
6 | "replica" : 3,
7 | "numDoc" : 5000,
8 | "DocKeySize" : 200,
9 | "SecKeySize" : 200,
10 | "ArrKeySize" : 0,
11 | "ArrSize" : 0,
12 | "MutationRate" : 0,
13 | "ScanRate" : 0},
14 | {"name" : "index2",
15 | "bucket" : "bucket2",
16 | "isPrimary" : false,
17 | "secExprs" : ["name"],
18 | "isArrayIndex" : false,
19 | "replica" : 3,
20 | "numDoc" : 5000,
21 | "DocKeySize" : 200,
22 | "SecKeySize" : 200,
23 | "ArrKeySize" : 0,
24 | "ArrSize" : 0,
25 | "MutationRate" : 0,
26 | "ScanRate" : 0}]
27 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/index/replica-3.json:
--------------------------------------------------------------------------------
1 | [{"name" : "index1",
2 | "bucket" : "bucket2",
3 | "isPrimary" : false,
4 | "secExprs" : ["name"],
5 | "isArrayIndex" : false,
6 | "replica" : 3,
7 | "numDoc" : 5000,
8 | "DocKeySize" : 200,
9 | "SecKeySize" : 200,
10 | "ArrKeySize" : 0,
11 | "ArrSize" : 0,
12 | "MutationRate" : 0,
13 | "ScanRate" : 0}]
14 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/plan/empty-1-zone.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement": [
3 | {
4 | "nodeId": "127.0.0.1:9001",
5 | "nodeUUID": "dad15192216a984a53fc19de249e0ba4",
6 | "serverGroup": "index 1",
7 | "memUsage": 0,
8 | "cpuUsage": 0,
9 | "memOverhead": 104857600,
10 | "actualMemUsage": 0,
11 | "actualMemOverhead": 0,
12 | "indexes": []
13 | },
14 | {
15 | "nodeId": "127.0.0.1:9002",
16 | "nodeUUID": "fd3bdfd9cef59ef7def316a81d704329",
17 | "serverGroup": "index 1",
18 | "memUsage": 0,
19 | "cpuUsage": 0,
20 | "memOverhead": 104857600,
21 | "actualMemUsage": 0,
22 | "actualMemOverhead": 0,
23 | "indexes": []
24 | },
25 | {
26 | "nodeId": "127.0.0.1:9003",
27 | "nodeUUID": "b0a4f1bd3f3339003a1e4683e37e1763",
28 | "serverGroup": "index 1",
29 | "memUsage": 0,
30 | "cpuUsage": 0,
31 | "memOverhead": 104857600,
32 | "actualMemUsage": 0,
33 | "actualMemOverhead": 0,
34 | "indexes": []
35 | }
36 | ],
37 | "memQuota": 530294000000,
38 | "cpuQuota": 16,
39 | "isLive": true
40 | }
41 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/plan/empty-2-zone.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement": [
3 | {
4 | "nodeId": "127.0.0.1:9001",
5 | "nodeUUID": "dad15192216a984a53fc19de249e0ba4",
6 | "serverGroup": "index 1",
7 | "memUsage": 0,
8 | "cpuUsage": 0,
9 | "memOverhead": 104857600,
10 | "actualMemUsage": 0,
11 | "actualMemOverhead": 0,
12 | "indexes": []
13 | },
14 | {
15 | "nodeId": "127.0.0.1:9002",
16 | "nodeUUID": "fd3bdfd9cef59ef7def316a81d704329",
17 | "serverGroup": "index 1",
18 | "memUsage": 0,
19 | "cpuUsage": 0,
20 | "memOverhead": 104857600,
21 | "actualMemUsage": 0,
22 | "actualMemOverhead": 0,
23 | "indexes": []
24 | },
25 | {
26 | "nodeId": "127.0.0.1:9003",
27 | "nodeUUID": "b0a4f1bd3f3339003a1e4683e37e1763",
28 | "serverGroup": "index 2",
29 | "memUsage": 0,
30 | "cpuUsage": 0,
31 | "memOverhead": 104857600,
32 | "actualMemUsage": 0,
33 | "actualMemOverhead": 0,
34 | "indexes": []
35 | }
36 | ],
37 | "memQuota": 530294000,
38 | "cpuQuota": 16,
39 | "isLive": true
40 | }
41 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/plan/empty-3-zone.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement": [
3 | {
4 | "nodeId": "127.0.0.1:9001",
5 | "nodeUUID": "dad15192216a984a53fc19de249e0ba4",
6 | "serverGroup": "index 1",
7 | "memUsage": 0,
8 | "cpuUsage": 0,
9 | "memOverhead": 104857600,
10 | "actualMemUsage": 0,
11 | "actualMemOverhead": 0,
12 | "indexes": []
13 | },
14 | {
15 | "nodeId": "127.0.0.1:9003",
16 | "nodeUUID": "b0a4f1bd3f3339003a1e4683e37e1763",
17 | "serverGroup": "index 2",
18 | "memUsage": 0,
19 | "cpuUsage": 0,
20 | "memOverhead": 104857600,
21 | "actualMemUsage": 0,
22 | "actualMemOverhead": 0,
23 | "indexes": []
24 | },
25 | {
26 | "nodeId": "127.0.0.1:9005",
27 | "nodeUUID": "6f7b7ca95ca4bac2cab1e74b36793589",
28 | "serverGroup": "index 3",
29 | "memUsage": 0,
30 | "cpuUsage": 0,
31 | "memOverhead": 104857600,
32 | "actualMemUsage": 0,
33 | "actualMemOverhead": 0,
34 | "indexes": []
35 | }
36 | ],
37 | "memQuota": 530294000,
38 | "cpuQuota": 16,
39 | "isLive": true
40 | }
41 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/plan/min-memory-empty-plan.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement": [
3 | {
4 | "nodeId": "192.168.1.8:9000",
5 | "nodeUUID": "c6fe7e12b609acc9767c7b671c908773",
6 | "storageMode":"plasma",
7 | "memUsage": 0,
8 | "cpuUsage": 0,
9 | "memOverhead": 0,
10 | "actualDataSize": 0,
11 | "actualMemUsage": 0,
12 | "actualMemOverhead": 0,
13 | "actualMemMin": 0,
14 | "indexes": []
15 | },
16 | {
17 | "nodeId": "127.0.0.1:9001",
18 | "nodeUUID": "f18c1f3d3c1fabf2a63b51d06f536bf9",
19 | "storageMode":"plasma",
20 | "memUsage": 0,
21 | "cpuUsage": 0,
22 | "memOverhead": 0,
23 | "actualMemUsage": 0,
24 | "actualDataSize": 0,
25 | "actualMemOverhead": 0,
26 | "actualMemMin": 0,
27 | "indexes": []
28 | },
29 | {
30 | "nodeId": "127.0.0.1:9002",
31 | "nodeUUID": "f28c1f3d3c1fabf2a63b51d06f536bf9",
32 | "storageMode":"plasma",
33 | "memUsage": 0,
34 | "cpuUsage": 0,
35 | "memOverhead": 0,
36 | "actualMemUsage": 0,
37 | "actualDataSize": 0,
38 | "actualMemOverhead": 0,
39 | "actualMemMin": 0,
40 | "indexes": []
41 | },
42 | {
43 | "nodeId": "127.0.0.1:9003",
44 | "nodeUUID": "f38c1f3d3c1fabf2a63b51d06f536bf9",
45 | "storageMode":"plasma",
46 | "memUsage": 0,
47 | "cpuUsage": 0,
48 | "memOverhead": 0,
49 | "actualMemUsage": 0,
50 | "actualDataSize": 0,
51 | "actualMemOverhead": 0,
52 | "actualMemMin": 0,
53 | "indexes": []
54 | }
55 | ],
56 | "memQuota": 512000000,
57 | "cpuQuota": 8,
58 | "isLive": true
59 | }
60 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/new_index_1.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name" : "idx1",
4 | "bucket" : "bucket1",
5 | "isPrimary" : false,
6 | "secExprs" : ["name1"],
7 | "isArrayIndex" : false,
8 | "replica" : 2,
9 | "defnId" : 987654
10 | }
11 | ]
12 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/new_index_2.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name" : "idx1",
4 | "bucket" : "bucket7",
5 | "isPrimary" : false,
6 | "secExprs" : ["name1"],
7 | "isArrayIndex" : false,
8 | "replica" : 2,
9 | "defnId" : 987654
10 | }
11 | ]
12 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/1_empty_node_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "serverGroup":"sg1",
7 | "mandatoryQuota":0
8 | }
9 | ],
10 | "isLive":true,
11 | "usageThreshold": { "memHighThreshold" : 80,
12 | "memLowThreshold" : 60,
13 | "unitsHighThreshold" : 60,
14 | "unitsLowThreshold" : 40,
15 | "memQuota": 1000000000,
16 | "unitsQuota" : 10000
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/1_non_empty_node_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
6 | "serverGroup":"sg1",
7 | "mandatoryQuota":300000000,
8 | "actualUnits":1000,
9 | "indexes": [
10 | {
11 | "defnId": 1111,
12 | "instId": 1212,
13 | "name": "idx2",
14 | "bucket": "bucket1",
15 | "instance": {
16 | "replicaId":0
17 | }
18 | }
19 | ]
20 | }
21 | ],
22 | "isLive":true,
23 | "usageThreshold": { "memHighThreshold" : 80,
24 | "memLowThreshold" : 60,
25 | "unitsHighThreshold" : 60,
26 | "unitsLowThreshold" : 40,
27 | "memQuota": 1000000000,
28 | "unitsQuota" : 10000
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/2_empty_nodes_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "serverGroup":"sg1",
7 | "mandatoryQuota":0
8 | },
9 | {
10 | "nodeId":"127.0.0.1:9002",
11 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
12 | "serverGroup":"sg1",
13 | "mandatoryQuota":0
14 | }
15 | ],
16 | "isLive":true,
17 | "usageThreshold": { "memHighThreshold" : 80,
18 | "memLowThreshold" : 60,
19 | "unitsHighThreshold" : 60,
20 | "unitsLowThreshold" : 40,
21 | "memQuota": 1000000000,
22 | "unitsQuota" : 10000
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/2_non_empty_node_1_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
6 | "serverGroup":"sg1",
7 | "mandatoryQuota":300000000,
8 | "actualUnits":1000,
9 | "indexes": [
10 | {
11 | "defnId": 1111,
12 | "instId": 1212,
13 | "name": "idx2",
14 | "bucket": "bucket1",
15 | "instance": {
16 | "replicaId":0
17 | }
18 | }
19 | ]
20 | },
21 | {
22 | "nodeId":"127.0.0.1:9002",
23 | "nodeUUID":"xxx15192216a53fc19de249e0ba4",
24 | "serverGroup":"sg1",
25 | "mandatoryQuota":300000000,
26 | "actualUnits":1000,
27 | "indexes": [
28 | {
29 | "defnId": 4444,
30 | "instId": 4242,
31 | "name": "idx2",
32 | "bucket": "bucket2",
33 | "instance": {
34 | "replicaId":0
35 | }
36 | }
37 | ]
38 | }
39 | ],
40 | "isLive":true,
41 | "usageThreshold": { "memHighThreshold" : 80,
42 | "memLowThreshold" : 60,
43 | "unitsHighThreshold" : 60,
44 | "unitsLowThreshold" : 40,
45 | "memQuota": 1000000000,
46 | "unitsQuota" : 10000
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/4_empty_nodes_2_sg.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "serverGroup":"sg1",
7 | "mandatoryQuota":0
8 | },
9 | {
10 | "nodeId":"127.0.0.1:9002",
11 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
12 | "serverGroup":"sg2",
13 | "mandatoryQuota":0
14 | },
15 | {
16 | "nodeId":"127.0.0.1:9003",
17 | "nodeUUID":"def15192216a984a53fc19de249e0ba4",
18 | "serverGroup":"sg1",
19 | "mandatoryQuota":0
20 | },
21 | {
22 | "nodeId":"127.0.0.1:9004",
23 | "nodeUUID":"zzz15192216a984a53fc19de249e0ba4",
24 | "serverGroup":"sg2",
25 | "mandatoryQuota":0
26 | }
27 | ],
28 | "isLive":true,
29 | "usageThreshold": { "memHighThreshold" : 80,
30 | "memLowThreshold" : 60,
31 | "unitsHighThreshold" : 60,
32 | "unitsLowThreshold" : 40,
33 | "memQuota": 1000000000,
34 | "unitsQuota" : 10000
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/4_non_empty_nodes_2_sg_a.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "serverGroup":"sg1",
7 | "mandatoryQuota":300000000,
8 | "actualUnits":1000,
9 | "indexes": [
10 | {
11 | "defnId": 1111,
12 | "instId": 2222,
13 | "name": "idx2",
14 | "bucket": "bucket1",
15 | "instance": {
16 | "replicaId":1
17 | }
18 | }
19 | ]
20 | },
21 | {
22 | "nodeId":"127.0.0.1:9002",
23 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
24 | "serverGroup":"sg2",
25 | "mandatoryQuota":300000000,
26 | "actualUnits":1000,
27 | "indexes": [
28 | {
29 | "defnId": 1111,
30 | "instId": 1212,
31 | "name": "idx2",
32 | "bucket": "bucket1",
33 | "instance": {
34 | "replicaId":0
35 | }
36 | }
37 | ]
38 | },
39 | {
40 | "nodeId":"127.0.0.1:9003",
41 | "nodeUUID":"def15192216a984a53fc19de249e0ba4",
42 | "serverGroup":"sg1",
43 | "mandatoryQuota":300000000,
44 | "actualUnits":1000
45 | },
46 | {
47 | "nodeId":"127.0.0.1:9004",
48 | "nodeUUID":"zzz15192216a984a53fc19de249e0ba4",
49 | "serverGroup":"sg3",
50 | "mandatoryQuota":300000000,
51 | "actualUnits":1000
52 | }
53 | ],
54 | "isLive":true,
55 | "usageThreshold": { "memHighThreshold" : 80,
56 | "memLowThreshold" : 60,
57 | "unitsHighThreshold" : 60,
58 | "unitsLowThreshold" : 40,
59 | "memQuota": 1000000000,
60 | "unitsQuota" : 10000
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/4_non_empty_nodes_2_sg_b.json:
--------------------------------------------------------------------------------
1 | {
2 | "placement":[
3 | {
4 | "nodeId":"127.0.0.1:9001",
5 | "nodeUUID":"fdb15192216a984a53fc19de249e0ba4",
6 | "serverGroup":"sg1",
7 | "mandatoryQuota":300000000,
8 | "actualUnits":1000,
9 | "indexes": [
10 | {
11 | "defnId": 1111,
12 | "instId": 2222,
13 | "name": "idx2",
14 | "bucket": "bucket1",
15 | "instance": {
16 | "replicaId":1
17 | }
18 | }
19 | ]
20 | },
21 | {
22 | "nodeId":"127.0.0.1:9002",
23 | "nodeUUID":"abc15192216a984a53fc19de249e0ba4",
24 | "serverGroup":"sg2",
25 | "mandatoryQuota":300000000,
26 | "actualUnits":1000
27 | },
28 | {
29 | "nodeId":"127.0.0.1:9003",
30 | "nodeUUID":"def15192216a984a53fc19de249e0ba4",
31 | "serverGroup":"sg1",
32 | "mandatoryQuota":300000000,
33 | "actualUnits":1000
34 | },
35 | {
36 | "nodeId":"127.0.0.1:9004",
37 | "nodeUUID":"zzz15192216a984a53fc19de249e0ba4",
38 | "serverGroup":"sg3",
39 | "mandatoryQuota":300000000,
40 | "actualUnits":1000,
41 | "indexes": [
42 | {
43 | "defnId": 1111,
44 | "instId": 1212,
45 | "name": "idx2",
46 | "bucket": "bucket1",
47 | "instance": {
48 | "replicaId":0
49 | }
50 | }
51 | ]
52 | }
53 | ],
54 | "isLive":true,
55 | "usageThreshold": { "memHighThreshold" : 80,
56 | "memLowThreshold" : 60,
57 | "unitsHighThreshold" : 60,
58 | "unitsLowThreshold" : 40,
59 | "memQuota": 1000000000,
60 | "unitsQuota" : 10000
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/4_non_empty_nodes_3_sg_a_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 |
4 | "127.0.0.1:9001" : {
5 | "memory_used_actual": 600000000,
6 | "units_used_actual": 6000,
7 | "num_tenants" :2,
8 | "num_index_repaired": 0
9 | },
10 | "127.0.0.1:9003" : {
11 | "memory_used_actual": 300000000,
12 | "units_used_actual": 3000,
13 | "num_tenants" : 1,
14 | "num_index_repaired": 0
15 | },
16 | "127.0.0.1:9004" : {
17 | "memory_used_actual": 600000000,
18 | "units_used_actual": 6000,
19 | "num_tenants" :2,
20 | "num_index_repaired": 0
21 | },
22 | "127.0.0.1:9006" : {
23 | "memory_used_actual": 300000000,
24 | "units_used_actual": 3000,
25 | "num_tenants" : 1,
26 | "num_index_repaired": 0
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/4_non_empty_nodes_3_sg_b_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 |
4 | "127.0.0.1:9001" : {
5 | "memory_used_actual": 600000000,
6 | "units_used_actual": 6000,
7 | "num_tenants" :2,
8 | "num_index_repaired": 0
9 | },
10 | "127.0.0.1:9002" : {
11 | "memory_used_actual": 600000000,
12 | "units_used_actual": 4000,
13 | "num_tenants" : 3,
14 | "num_index_repaired": 0
15 | },
16 | "127.0.0.1:9004" : {
17 | "memory_used_actual": 600000000,
18 | "units_used_actual": 6000,
19 | "num_tenants" :2,
20 | "num_index_repaired": 0
21 | },
22 | "127.0.0.1:9005" : {
23 | "memory_used_actual": 600000000,
24 | "units_used_actual": 4000,
25 | "num_tenants" : 3,
26 | "num_index_repaired": 0
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/4_non_empty_nodes_3_sg_d_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 |
4 | "127.0.0.1:9001" : {
5 | "memory_used_actual": 700000000,
6 | "units_used_actual": 5000,
7 | "num_tenants" : 3,
8 | "num_index_repaired": 0
9 | },
10 | "127.0.0.1:9003" : {
11 | "memory_used_actual": 0,
12 | "units_used_actual": 0,
13 | "num_tenants" : 0,
14 | "num_index_repaired": 0
15 | },
16 | "127.0.0.1:9004" : {
17 | "memory_used_actual": 700000000,
18 | "units_used_actual": 5000,
19 | "num_tenants" : 3,
20 | "num_index_repaired": 0
21 | },
22 | "127.0.0.1:9006" : {
23 | "memory_used_actual": 0,
24 | "units_used_actual": 0,
25 | "num_tenants" : 0,
26 | "num_index_repaired": 0
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/4_non_empty_nodes_3_sg_e_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 |
4 | "127.0.0.1:9001" : {
5 | "memory_used_actual": 700000000,
6 | "units_used_actual": 5000,
7 | "num_tenants" : 3,
8 | "num_index_repaired": 0
9 | },
10 | "127.0.0.1:9003" : {
11 | "memory_used_actual": 650000000,
12 | "units_used_actual": 4500,
13 | "num_tenants" : 3,
14 | "num_index_repaired": 0
15 | },
16 | "127.0.0.1:9004" : {
17 | "memory_used_actual": 700000000,
18 | "units_used_actual": 5000,
19 | "num_tenants" : 3,
20 | "num_index_repaired": 0
21 | },
22 | "127.0.0.1:9006" : {
23 | "memory_used_actual": 650000000,
24 | "units_used_actual": 4500,
25 | "num_tenants" : 3,
26 | "num_index_repaired": 0
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/4_non_empty_nodes_3_sg_f_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 |
4 | "127.0.0.1:9001" : {
5 | "memory_used_actual": 600000000,
6 | "units_used_actual": 6000,
7 | "num_tenants" :2,
8 | "num_index_repaired": 0
9 | },
10 | "127.0.0.1:9003" : {
11 | "memory_used_actual": 300000000,
12 | "units_used_actual": 3000,
13 | "num_tenants" : 1,
14 | "num_index_repaired": 1
15 | },
16 | "127.0.0.1:9004" : {
17 | "memory_used_actual": 600000000,
18 | "units_used_actual": 6000,
19 | "num_tenants" :2,
20 | "num_index_repaired": 1
21 | },
22 | "127.0.0.1:9006" : {
23 | "memory_used_actual": 300000000,
24 | "units_used_actual": 3000,
25 | "num_tenants" : 1,
26 | "num_index_repaired": 0
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/4_non_empty_nodes_3_sg_g_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 |
4 | "127.0.0.1:9001" : {
5 | "memory_used_actual": 600000000,
6 | "units_used_actual": 6000,
7 | "num_tenants" :2,
8 | "num_index_repaired": 4
9 | },
10 | "127.0.0.1:9003" : {
11 | "memory_used_actual": 300000000,
12 | "units_used_actual": 3000,
13 | "num_tenants" : 1,
14 | "num_index_repaired": 2
15 | },
16 | "127.0.0.1:9004" : {
17 | "memory_used_actual": 600000000,
18 | "units_used_actual": 6000,
19 | "num_tenants" :2,
20 | "num_index_repaired": 0
21 | },
22 | "127.0.0.1:9006" : {
23 | "memory_used_actual": 300000000,
24 | "units_used_actual": 3000,
25 | "num_tenants" : 1,
26 | "num_index_repaired": 0
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/4_non_empty_nodes_3_sg_h_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | "127.0.0.1:9002" : {
4 | "memory_used_actual": 300000000,
5 | "units_used_actual": 3000,
6 | "num_tenants" : 2,
7 | "num_index_repaired": 0
8 | },
9 | "127.0.0.1:9005" : {
10 | "memory_used_actual": 300000000,
11 | "units_used_actual": 3000,
12 | "num_tenants" : 2,
13 | "num_index_repaired": 0
14 | },
15 | "127.0.0.1:9003" : {
16 | "memory_used_actual": 0,
17 | "units_used_actual": 0,
18 | "num_tenants" : 0,
19 | "num_index_repaired": 0
20 | },
21 | "127.0.0.1:9006" : {
22 | "memory_used_actual": 0,
23 | "units_used_actual": 0,
24 | "num_tenants" : 0,
25 | "num_index_repaired": 0
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/4_non_empty_nodes_3_sg_i_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 | "127.0.0.1:9002" : {
4 | "memory_used_actual": 200000000,
5 | "units_used_actual": 1000,
6 | "num_tenants" : 1,
7 | "num_index_repaired": 0
8 | },
9 | "127.0.0.1:9005" : {
10 | "memory_used_actual": 200000000,
11 | "units_used_actual": 1000,
12 | "num_tenants" : 1,
13 | "num_index_repaired": 0
14 | },
15 | "127.0.0.1:9003" : {
16 | "memory_used_actual": 0,
17 | "units_used_actual": 0,
18 | "num_tenants" : 0,
19 | "num_index_repaired": 0
20 | },
21 | "127.0.0.1:9006" : {
22 | "memory_used_actual": 0,
23 | "units_used_actual": 0,
24 | "num_tenants" : 0,
25 | "num_index_repaired": 0
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/4_non_empty_nodes_3_sg_l_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 |
4 | "127.0.0.1:9001" : {
5 | "memory_used_actual": 500000000,
6 | "units_used_actual": 800,
7 | "num_tenants" :3,
8 | "num_index_repaired": 0
9 | },
10 | "127.0.0.1:9004" : {
11 | "memory_used_actual": 500000000,
12 | "units_used_actual": 800,
13 | "num_tenants" :3,
14 | "num_index_repaired": 2
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/6_non_empty_nodes_3_sg_c_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 |
4 | "127.0.0.1:9001" : {
5 | "memory_used_actual": 400000000,
6 | "units_used_actual": 4000,
7 | "num_tenants" : 1,
8 | "num_index_repaired": 0
9 | },
10 | "127.0.0.1:9002" : {
11 | "memory_used_actual": 500000000,
12 | "units_used_actual": 3000,
13 | "num_tenants" : 3,
14 | "num_index_repaired": 0
15 | },
16 | "127.0.0.1:9003" : {
17 | "memory_used_actual": 300000000,
18 | "units_used_actual": 3000,
19 | "num_tenants" : 1,
20 | "num_index_repaired": 0
21 | },
22 | "127.0.0.1:9004" : {
23 | "memory_used_actual": 400000000,
24 | "units_used_actual": 4000,
25 | "num_tenants" : 1,
26 | "num_index_repaired": 0
27 | },
28 | "127.0.0.1:9005" : {
29 | "memory_used_actual": 500000000,
30 | "units_used_actual": 3000,
31 | "num_tenants" : 3,
32 | "num_index_repaired": 0
33 | },
34 | "127.0.0.1:9006" : {
35 | "memory_used_actual": 300000000,
36 | "units_used_actual": 3000,
37 | "num_tenants" : 1,
38 | "num_index_repaired": 0
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/6_non_empty_nodes_3_sg_j_out.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 |
4 |
5 | "127.0.0.1:9001" : {
6 | "memory_used_actual": 400000000,
7 | "units_used_actual": 4000,
8 | "num_tenants" : 1,
9 | "num_index_repaired": 0
10 | },
11 | "127.0.0.1:9002" : {
12 | "memory_used_actual": 100000000,
13 | "units_used_actual": 1000,
14 | "num_tenants" : 1,
15 | "num_index_repaired": 0
16 | },
17 | "127.0.0.1:9003" : {
18 | "memory_used_actual": 400000000,
19 | "units_used_actual": 4000,
20 | "num_tenants" : 2,
21 | "num_index_repaired": 0
22 | },
23 | "127.0.0.1:9004" : {
24 | "memory_used_actual": 400000000,
25 | "units_used_actual": 4000,
26 | "num_tenants" : 1,
27 | "num_index_repaired": 0
28 | },
29 | "127.0.0.1:9005" : {
30 | "memory_used_actual": 100000000,
31 | "units_used_actual": 1000,
32 | "num_tenants" : 1,
33 | "num_index_repaired": 0
34 | },
35 | "127.0.0.1:9006" : {
36 | "memory_used_actual": 400000000,
37 | "units_used_actual": 4000,
38 | "num_tenants" : 2,
39 | "num_index_repaired": 0
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/tenantaware/topology/defrag/6_non_empty_nodes_3_sg_k_out.json:
--------------------------------------------------------------------------------
1 | {
2 |
3 |
4 | "127.0.0.1:9001" : {
5 | "memory_used_actual": 500000000,
6 | "units_used_actual": 5000,
7 | "num_tenants" : 2,
8 | "num_index_repaired": 0
9 | },
10 | "127.0.0.1:9002" : {
11 | "memory_used_actual": 0,
12 | "units_used_actual": 0,
13 | "num_tenants" : 0,
14 | "num_index_repaired": 0
15 | },
16 | "127.0.0.1:9003" : {
17 | "memory_used_actual": 400000000,
18 | "units_used_actual": 4000,
19 | "num_tenants" : 2,
20 | "num_index_repaired": 0
21 | },
22 | "127.0.0.1:9004" : {
23 | "memory_used_actual": 500000000,
24 | "units_used_actual": 5000,
25 | "num_tenants" : 2,
26 | "num_index_repaired": 0
27 | },
28 | "127.0.0.1:9005" : {
29 | "memory_used_actual": 0,
30 | "units_used_actual": 0,
31 | "num_tenants" : 0,
32 | "num_index_repaired": 0
33 | },
34 | "127.0.0.1:9006" : {
35 | "memory_used_actual": 400000000,
36 | "units_used_actual": 4000,
37 | "num_tenants" : 2,
38 | "num_index_repaired": 0
39 | }
40 | }
41 |
42 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/workload/mixed-small-medium-30-3.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "Mixed Workload",
3 | "comment" : "go test -iteration=1 -memQuotaFactor=2 -cpuQuotaFactor=2 -placement=mixedWorkload.json",
4 | "workload" : [
5 | {
6 | "name" : "bucket1",
7 | "replica" : 3,
8 | "workload" : [
9 | {
10 | "name" : "small",
11 | "minNumDoc" : 20000000,
12 | "maxNumDoc" : 50000000,
13 | "minDocKeySize" : 20,
14 | "maxDocKeySize" : 200,
15 | "minSecKeySize" : 20,
16 | "maxSecKeySize" : 200,
17 | "minArrKeySize" : 0,
18 | "maxArrKeySize" : 0,
19 | "minArrSize" : 0,
20 | "maxArrSize" : 0,
21 | "minMutationRate" : 10000,
22 | "maxMutationRate" : 30000,
23 | "minScanRate" : 1000,
24 | "maxScanRate" : 10000
25 | },
26 | {
27 | "name" : "medium",
28 | "minNumDoc" : 200000000,
29 | "maxNumDoc" : 500000000,
30 | "minDocKeySize" : 20,
31 | "maxDocKeySize" : 200,
32 | "minSecKeySize" : 20,
33 | "maxSecKeySize" : 200,
34 | "minArrKeySize" : 0,
35 | "maxArrKeySize" : 0,
36 | "minArrSize" : 0,
37 | "maxArrSize" : 0,
38 | "minMutationRate" : 10000,
39 | "maxMutationRate" : 30000,
40 | "minScanRate" : 1000,
41 | "maxScanRate" : 10000
42 | }],
43 | "distribution" : [60,40]
44 | }],
45 | "distribution" : [100],
46 | "minNumIndex" : 30,
47 | "maxNumIndex" : 30
48 | }
49 |
50 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/workload/uniform-medium-10-3.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "Medium Workload (200-500M)",
3 | "comment" : "",
4 | "workload" : [
5 | {
6 | "name" : "bucket1",
7 | "replica" : 3,
8 | "workload" : [
9 | {
10 | "name" : "small",
11 | "minNumDoc" : 200000000,
12 | "maxNumDoc" : 500000000,
13 | "minDocKeySize" : 20,
14 | "maxDocKeySize" : 200,
15 | "minSecKeySize" : 20,
16 | "maxSecKeySize" : 200,
17 | "minArrKeySize" : 0,
18 | "maxArrKeySize" : 0,
19 | "minArrSize" : 0,
20 | "maxArrSize" : 0,
21 | "minMutationRate" : 10000,
22 | "maxMutationRate" : 100000,
23 | "minScanRate" : 1000,
24 | "maxScanRate" : 10000
25 | }],
26 | "distribution" : [100]
27 | }],
28 | "distribution" : [100],
29 | "minNumIndex" : 10,
30 | "maxNumIndex" : 10
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/workload/uniform-medium-30-3.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "Medium Workload (200-500M)",
3 | "comment" : "",
4 | "workload" : [
5 | {
6 | "name" : "bucket1",
7 | "replica" : 3,
8 | "workload" : [
9 | {
10 | "name" : "small",
11 | "minNumDoc" : 200000000,
12 | "maxNumDoc" : 500000000,
13 | "minDocKeySize" : 20,
14 | "maxDocKeySize" : 200,
15 | "minSecKeySize" : 20,
16 | "maxSecKeySize" : 200,
17 | "minArrKeySize" : 0,
18 | "maxArrKeySize" : 0,
19 | "minArrSize" : 0,
20 | "maxArrSize" : 0,
21 | "minMutationRate" : 10000,
22 | "maxMutationRate" : 100000,
23 | "minScanRate" : 1000,
24 | "maxScanRate" : 10000
25 | }],
26 | "distribution" : [100]
27 | }],
28 | "distribution" : [100],
29 | "minNumIndex" : 30,
30 | "maxNumIndex" : 30
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/workload/uniform-small-10-1.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "Small Workload (20-50M)",
3 | "comment" : "",
4 | "workload" : [
5 | {
6 | "name" : "bucket1",
7 | "replica" : 1,
8 | "workload" : [
9 | {
10 | "name" : "small",
11 | "minNumDoc" : 20000000,
12 | "maxNumDoc" : 50000000,
13 | "minDocKeySize" : 20,
14 | "maxDocKeySize" : 200,
15 | "minSecKeySize" : 20,
16 | "maxSecKeySize" : 200,
17 | "minArrKeySize" : 0,
18 | "maxArrKeySize" : 0,
19 | "minArrSize" : 0,
20 | "maxArrSize" : 0,
21 | "minMutationRate" : 10000,
22 | "maxMutationRate" : 100000,
23 | "minScanRate" : 1000,
24 | "maxScanRate" : 10000
25 | }],
26 | "distribution" : [100]
27 | }],
28 | "distribution" : [100],
29 | "minNumIndex" : 30,
30 | "maxNumIndex" : 30
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/workload/uniform-small-10-3.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "Small Workload (20-50M)",
3 | "comment" : "",
4 | "workload" : [
5 | {
6 | "name" : "bucket1",
7 | "replica" : 3,
8 | "workload" : [
9 | {
10 | "name" : "small",
11 | "minNumDoc" : 20000000,
12 | "maxNumDoc" : 50000000,
13 | "minDocKeySize" : 20,
14 | "maxDocKeySize" : 200,
15 | "minSecKeySize" : 20,
16 | "maxSecKeySize" : 200,
17 | "minArrKeySize" : 0,
18 | "maxArrKeySize" : 0,
19 | "minArrSize" : 0,
20 | "maxArrSize" : 0,
21 | "minMutationRate" : 10000,
22 | "maxMutationRate" : 100000,
23 | "minScanRate" : 1000,
24 | "maxScanRate" : 10000
25 | }],
26 | "distribution" : [100]
27 | }],
28 | "distribution" : [100],
29 | "minNumIndex" : 10,
30 | "maxNumIndex" : 10
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/planner/workload/uniform-small-30-3.json:
--------------------------------------------------------------------------------
1 | {
2 | "name" : "Small Workload (20-50M)",
3 | "comment" : "",
4 | "workload" : [
5 | {
6 | "name" : "bucket1",
7 | "replica" : 3,
8 | "workload" : [
9 | {
10 | "name" : "small",
11 | "minNumDoc" : 20000000,
12 | "maxNumDoc" : 50000000,
13 | "minDocKeySize" : 20,
14 | "maxDocKeySize" : 200,
15 | "minSecKeySize" : 20,
16 | "maxSecKeySize" : 200,
17 | "minArrKeySize" : 0,
18 | "maxArrKeySize" : 0,
19 | "minArrSize" : 0,
20 | "maxArrSize" : 0,
21 | "minMutationRate" : 10000,
22 | "maxMutationRate" : 100000,
23 | "minScanRate" : 1000,
24 | "maxScanRate" : 10000
25 | }],
26 | "distribution" : [100]
27 | }],
28 | "distribution" : [100],
29 | "minNumIndex" : 30,
30 | "maxNumIndex" : 30
31 | }
32 |
33 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/projects.json.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/indexing/ba752cd53c7865086c4d99f312eafbe3d23982a9/secondary/tests/testdata/projects.json.bz2
--------------------------------------------------------------------------------
/secondary/tests/testdata/projects.prod:
--------------------------------------------------------------------------------
1 | json : "{ " properties "}".
2 |
3 | properties : DQ "type" DQ ": " DQ "project" DQ ", " NL
4 | DQ "name" DQ ": " DQ projectname DQ ", " NL
5 | DQ "members" DQ ": " "[" members "]" ", " NL
6 | DQ "language" DQ ": " DQ language DQ NL.
7 |
8 | projectname : bag("propernames").
9 | members : members "," DQ bag("propernames") DQ {100}
10 | | DQ bag("propernames") DQ.
11 | language : "python"
12 | | "haskell"
13 | | "lua"
14 | | "golang".
15 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/users.json.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/indexing/ba752cd53c7865086c4d99f312eafbe3d23982a9/secondary/tests/testdata/users.json.bz2
--------------------------------------------------------------------------------
/secondary/tests/testdata/users.prod:
--------------------------------------------------------------------------------
1 | json : "{ " properties "}".
2 |
3 | properties : DQ "type" DQ ": " DQ "user" DQ ", " NL
4 | DQ "first-name" DQ ": " DQ fname DQ ", " NL
5 | lastname
6 | age
7 | emailid
8 | city
9 | gender.
10 |
11 | fname : bag("./propernames").
12 | lastname : DQ "last-name" DQ ": " DQ bag("./propernames") DQ ", " NL.
13 | age : DQ "age" DQ ": " range(15, 80) ", " NL.
14 | emailid : DQ "emailid" DQ ": " DQ $fname "@gmail.com" DQ ", " NL.
15 | city : DQ "city" DQ ": " DQ bag("./cities") DQ ", " NL.
16 | gender : DQ "gender" DQ ": " DQ "male" DQ NL
17 | | DQ "gender" DQ ": " DQ "female" DQ NL.
18 |
--------------------------------------------------------------------------------
/secondary/tests/testdata/web2.bz2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/indexing/ba752cd53c7865086c4d99f312eafbe3d23982a9/secondary/tests/testdata/web2.bz2
--------------------------------------------------------------------------------
/secondary/tools/cluster_ops/Makefile:
--------------------------------------------------------------------------------
1 | all: clean comp run
2 |
3 | export GOPATH=$(PWD)/../../../../../../../../goproj:$(PWD)/../../../../../../../../godeps
4 | export GO111MODULE=auto
5 | export CGO_CFLAGS=-I$(PWD)/../../../../../../../../sigar/include -I$(PWD)/../../../../../../../../build/tlm/deps/zstd-cpp.exploded/include -I$(PWD)/../../../../../../../../build/tlm/deps/jemalloc.exploded/include -I$(PWD)/../../../../../../../../forestdb/include/ -DJEMALLOC=1
6 | export CGO_LDFLAGS=-L $(PWD)/../../../../../../../../install/lib -Wl,-rpath $(PWD)/../../../../../../../../install/lib
7 |
8 | clean:
9 | rm -rf ./cluster_ops
10 |
11 | comp:
12 | go build -o cluster_ops main.go init_cluster.go
13 |
14 | run:
15 | # Performs a rebalance on the cluster without adding or removing
16 | # nodes from the cluster. See Readme.md for other options to compile
17 | # and run
18 | ./cluster_ops
19 |
--------------------------------------------------------------------------------
/secondary/tools/cluster_ops/Readme.md:
--------------------------------------------------------------------------------
1 | Usage:
2 |
3 | Do "make comp" to compile the tool
4 |
5 | ./cluster_ops -> Performs only rebalance on the existing cluster. If cluster is not initialised, initialises the cluster and adds nodes 127.0.0.1:9000 (kv+n1ql), 127.0.0.1:9001 (index), 127.0.0.1:9002 (index) services to cluster
6 | ./cluster_ops --Nodes 127.0.0.1:9003 --Nodes 127.0.0.1:9004 -> Initialises cluster with nodes 127.0.0.1:9003 & 127.0.0.1:9004 to the cluster
7 | ./cluster_ops --addNodes 127.0.0.1:9003 --addNodes 127.0.0.1:9004 -> Adds nodes 127.0.0.1:9003 & 127.0.0.1:9004 to the cluster
8 | and performs rebalance (Unless -rebalance=false is set explicitly)
9 | ./cluster_ops --ejectNodes 127.0.0.1:9003 --ejectNodes 127.0.0.1:9004 -> Ejects nodes 127.0.0.1:9003 & 127.0.0.1:9004 to the cluster
10 | and performs rebalance (Unless -rebalance=false is set explicitly)
11 |
--------------------------------------------------------------------------------
/secondary/tools/fdb/fdb_slice_thrpt.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "log"
6 | "net/http"
7 | _ "net/http/pprof"
8 | "os"
9 | "runtime/pprof"
10 | "time"
11 |
12 | "github.com/couchbase/indexing/secondary/common"
13 | "github.com/couchbase/indexing/secondary/indexer"
14 | )
15 |
16 | func main() {
17 |
18 | go func() {
19 | http.ListenAndServe("localhost:6060", nil)
20 | }()
21 |
22 | f, _ := os.Create("cpu.prof")
23 | pprof.StartCPUProfile(f)
24 | do_test1()
25 | pprof.StopCPUProfile()
26 |
27 | f, _ = os.Create("mem.prof")
28 | pprof.WriteHeapProfile(f)
29 | f.Close()
30 |
31 | }
32 |
33 | func do_test1() {
34 |
35 | log.Println("***** TEST1 TWO KV STORE 5M INSERT EACH WITH GET *****")
36 |
37 | config := common.SystemConfig.SectionConfig(
38 | "indexer.", true /*trim*/)
39 |
40 | stats := &indexer.IndexStats{}
41 | stats.Init()
42 |
43 | slice, _ := indexer.NewForestDBSlice(".", 0, 1, 1, 1, false, 1, config, stats)
44 |
45 | log.Println("***** GENERATING *****")
46 | numItems := 5000000
47 | keys := make([][]byte, numItems)
48 | //lenkeys := make([]int, numItems)
49 | vals := make([][]byte, numItems)
50 | //lenvals := make([]int, numItems)
51 | for i := 0; i < numItems; i++ {
52 | keys[i] = []byte(fmt.Sprintf("perf%v", i))
53 | //lenkeys[i] = len(keys[i])
54 | vals[i] = []byte(fmt.Sprintf("body%v", i))
55 | // lenvals[i] = len(vals[i])
56 | }
57 |
58 | time.Sleep(3 * time.Second)
59 | log.Println("***** LOADING*****")
60 | start := time.Now()
61 | for i := 0; i < numItems; i++ {
62 | slice.Insert(keys[i], vals[i], nil, nil)
63 | }
64 | // dbfile.Commit(forestdb.COMMIT_MANUAL_WAL_FLUSH)
65 | slice.NewSnapshot(nil, false)
66 |
67 | elapsed := time.Since(start)
68 | log.Printf("***** RESULT : Docs Inserted %v Time Taken %v", numItems, elapsed)
69 | }
70 |
--------------------------------------------------------------------------------
/secondary/tools/loadgen/companies:
--------------------------------------------------------------------------------
1 | montalvo
2 | freescale
3 | wipro
4 |
--------------------------------------------------------------------------------
/secondary/tools/loadgen/projects.prod:
--------------------------------------------------------------------------------
1 | s : "{ " properties "}".
2 |
3 | properties : DQ "type" DQ ": " DQ "project" DQ ", " NL
4 | DQ "name" DQ ": " DQ projectname DQ ", " NL
5 | DQ "members" DQ ": " "[" members "]" ", " NL
6 | DQ "language" DQ ": " DQ language DQ NL.
7 |
8 | projectname : (bag "./propernames").
9 | members : DQ (bag "./propernames") DQ
10 | | members "," DQ (bag "./propernames") DQ.
11 | language : "python"
12 | | "haskell"
13 | | "lua"
14 | | "golang".
15 |
--------------------------------------------------------------------------------
/secondary/tools/loadgen/users.prod:
--------------------------------------------------------------------------------
1 | (let guid (uuid))
2 |
3 | s : "{ " properties "}".
4 |
5 | properties : type ",\n"
6 | docid ",\n"
7 | age ",\n"
8 | active ",\n"
9 | company ",\n"
10 | "\"first-name\": \"" fname DQ ",\n"
11 | lastname ",\n"
12 | emailid ",\n"
13 | gender.
14 |
15 | type : "\"type\": \"user\"".
16 | docid : "\"docid\": \"" (sprintf "User-%v" $guid) DQ.
17 | age : "\"age\": " (range 15 80).
18 | active : "\"isActive\": " (choice "true" "false").
19 | company : "\"company\": \"" (bag "./companies") DQ.
20 | fname : (bag "./propernames").
21 | lastname : "\"last-name\": \"" (bag "./propernames") DQ.
22 | emailid : "\"emailid\": \"" $fname "@gmail.com" DQ.
23 | gender : "\"gender\": \"" (choice "male" "female") DQ.
24 |
--------------------------------------------------------------------------------
/secondary/tools/loadgen/util.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 | import "time"
5 | import "math/rand"
6 |
7 | func ranget(starts, ends string) string {
8 | start, err := time.Parse(time.RFC3339, starts)
9 | if err != nil {
10 | panic(fmt.Errorf("parsing first argument %v: %v\n", starts, err))
11 | }
12 | end, err := time.Parse(time.RFC3339, ends)
13 | if err != nil {
14 | panic(fmt.Errorf("parsing second argument %v: %v\n", ends, err))
15 | }
16 | t := start.Add(time.Duration(rand.Int63n(int64(end.Sub(start)))))
17 | return t.Format(time.RFC3339)
18 | }
19 |
--------------------------------------------------------------------------------
/secondary/tools/n1qlexpr/doc.json:
--------------------------------------------------------------------------------
1 | { "age": 78, "friends": ["tom", "jerry"]}
2 |
--------------------------------------------------------------------------------
/secondary/tools/n1qlexpr/n1ql_expr.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "log"
4 | import "flag"
5 | import "io/ioutil"
6 | import "fmt"
7 | import "encoding/json"
8 |
9 | import "github.com/couchbase/query/parser/n1ql"
10 | import qexpr "github.com/couchbase/query/expression"
11 | import qvalue "github.com/couchbase/query/value"
12 |
13 | var options struct {
14 | expr string
15 | data string
16 | json bool
17 | }
18 |
19 | func argParse() {
20 | flag.StringVar(&options.expr, "expr", "",
21 | "input expression")
22 | flag.StringVar(&options.data, "data", "",
23 | "data similar to curl's --data")
24 | flag.BoolVar(&options.json, "json", false,
25 | "marshal parsed expression back to JSON")
26 | flag.Parse()
27 | }
28 |
29 | func main() {
30 | argParse()
31 | expr, err := n1ql.ParseExpression(options.expr)
32 | if err != nil {
33 | log.Fatal(err)
34 | }
35 |
36 | if options.json {
37 | exprb, err := json.Marshal(expr)
38 | if err != nil {
39 | log.Fatal(err)
40 | }
41 | exprstr := string(exprb)
42 | fmt.Printf("input: %v\n", options.expr)
43 | fmt.Printf("expr: %T %v\n", expr, expr)
44 | fmt.Printf("json: %T %v\n", exprstr, exprstr)
45 | } else {
46 | exprstr := qexpr.NewStringer().Visit(expr)
47 | fmt.Printf("input: %v\n", options.expr)
48 | fmt.Printf("expr: %T %v\n", expr, expr)
49 | fmt.Printf("output: %T %v\n", exprstr, exprstr)
50 | }
51 |
52 | if expr != nil && options.data != "" {
53 | if options.data[0] == '@' {
54 | docbytes, err := ioutil.ReadFile(options.data[1:])
55 | if err != nil {
56 | log.Fatal(err)
57 | }
58 | context := qexpr.NewIndexContext()
59 | doc := qvalue.NewAnnotatedValue(docbytes)
60 | v, err := expr.Evaluate(doc, context)
61 | fmsg := "Evaluate() scalar:%v err:%v"
62 | fmt.Printf(fmsg, v, err)
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/secondary/tools/n1qlperf/lookup.json:
--------------------------------------------------------------------------------
1 | {
2 | "Concurrency" : 1,
3 | "Clients": 1,
4 | "ScanSpecs" : [
5 | {
6 | "Type" : "Lookup",
7 | "Bucket" : "default",
8 | "Id" : 7962660343139546135,
9 | "Index" : "index_eyeColor",
10 | "Lookups" : [ ["blue"] ],
11 | "Limit" : 1,
12 | "Repeat" : 100000,
13 | "Consistency": false
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/secondary/tools/n1qlperf/n1qlperf.sh:
--------------------------------------------------------------------------------
1 | export NS_SERVER_CBAUTH_URL="http://127.0.0.1:9000/_cbauth"
2 | export NS_SERVER_CBAUTH_USER="Administrator"
3 | export NS_SERVER_CBAUTH_PWD="asdasd"
4 | export NS_SERVER_CBAUTH_RPC_URL="http://127.0.0.1:9000/cbauth-demo"
5 |
6 | export CBAUTH_REVRPC_URL="http://Administrator:asdasd@127.0.0.1:9000/query"
7 |
8 | ./n1qlperf "$@"
9 |
10 |
--------------------------------------------------------------------------------
/secondary/tools/querycmd/benchtimeit.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "time"
4 | import "fmt"
5 |
6 | import qclient "github.com/couchbase/indexing/secondary/queryport/client"
7 |
8 | func doBenchtimeit(cluster string, client *qclient.GsiClient) (err error) {
9 | start := time.Now()
10 | for i := 0; i < 1000000; i++ {
11 | client.Bridge().Timeit(0x1111, 1)
12 | }
13 | fmt.Printf("time take by Timeit(): %v\n", time.Since(start)/1000000)
14 | return
15 | }
16 |
--------------------------------------------------------------------------------
/secondary/tools/querycmd/bufferedscan.sh:
--------------------------------------------------------------------------------
1 | export NS_SERVER_CBAUTH_URL="http://127.0.0.1:9000/_cbauth"
2 | export NS_SERVER_CBAUTH_USER="Administrator"
3 | export NS_SERVER_CBAUTH_PWD="asdasd"
4 | export NS_SERVER_CBAUTH_RPC_URL="http://127.0.0.1:9000/cbauth-demo"
5 |
6 | export CBAUTH_REVRPC_URL="http://Administrator:asdasd@127.0.0.1:9000/query"
7 |
8 | ./querycmd "$@"
9 |
--------------------------------------------------------------------------------
/secondary/tools/querycmd/mb13339.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 | import "log"
5 | import "os"
6 |
7 | import qclient "github.com/couchbase/indexing/secondary/queryport/client"
8 | import "github.com/couchbase/indexing/secondary/querycmd"
9 |
10 | // test case to simulate
11 | // https://issues.couchbase.com/browse/MB-13339
12 |
13 | func doMB13339(
14 | cluster string, client *qclient.GsiClient) (err error) {
15 |
16 | for _, args := range mb13339Commands {
17 | cmd, _, _, err := querycmd.ParseArgs(args)
18 | if err != nil {
19 | log.Fatal(err)
20 | }
21 | err = querycmd.HandleCommand(client, cmd, true, os.Stdout)
22 | if err != nil {
23 | fmt.Printf("%#v\n", cmd)
24 | fmt.Printf(" %v\n", err)
25 | }
26 | fmt.Println()
27 | }
28 | return
29 | }
30 |
31 | var mb13339Commands = [][]string{
32 | []string{
33 | "-type", "create", "-bucket", "beer-sample", "-index", "index-city",
34 | "-fields", "city",
35 | },
36 | []string{
37 | "-type", "create", "-bucket", "beer-sample", "-index", "index-type",
38 | "-fields", "type",
39 | },
40 | []string{
41 | "-type", "count", "-bucket", "beer-sample", "-index", "index-city",
42 | "-low", "[\"A\"]", "-high", "[\"s\"]",
43 | },
44 | []string{"-type", "list", "-bucket", "beer-sample"},
45 | []string{ // FIXME: drop and then retry ?
46 | "-type", "drop", "-indexes", "beer-sample:index-type",
47 | },
48 | []string{ // retry
49 | "-type", "create", "-bucket", "beer-sample", "-index", "index-type",
50 | "-fields", "type",
51 | },
52 | []string{
53 | "-type", "count", "-bucket", "beer-sample", "-index", "index-type",
54 | "-equal", "[\"brewery\"]",
55 | },
56 | []string{"-type", "list", "-bucket", "beer-sample"},
57 | []string{
58 | "-type", "drop", "-indexes", "beer-sample:index-city",
59 | },
60 | []string{
61 | "-type", "drop", "-indexes", "beer-sample:index-type",
62 | },
63 | }
64 |
--------------------------------------------------------------------------------
/secondary/tools/querycmd/mb14786.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 | import "log"
5 | import "os"
6 |
7 | import qclient "github.com/couchbase/indexing/secondary/queryport/client"
8 | import "github.com/couchbase/indexing/secondary/querycmd"
9 |
10 | // test case to simulate
11 | // https://issues.couchbase.com/browse/MB-13339
12 |
13 | func doMB14786(
14 | cluster string, client *qclient.GsiClient) (err error) {
15 |
16 | for _, args := range mb14786Commands {
17 | cmd, _, _, err := querycmd.ParseArgs(args)
18 | if err != nil {
19 | log.Fatal(err)
20 | }
21 | err = querycmd.HandleCommand(client, cmd, true, os.Stdout)
22 | if err != nil {
23 | fmt.Printf("%#v\n", cmd)
24 | fmt.Printf(" %v\n", err)
25 | }
26 | fmt.Println()
27 | }
28 | return
29 | }
30 |
31 | var mb14786Commands = [][]string{
32 | []string{"-type", "drop", "-bucket", "beer-sample", "-index", "index_abv1"},
33 | []string{"-type", "drop", "-bucket", "beer-sample", "-index", "index_abv2"},
34 |
35 | []string{
36 | "-type", "create", "-bucket", "beer-sample", "-index", "index_abv1",
37 | "-fields", "abv",
38 | },
39 | []string{
40 | "-type", "create", "-bucket", "beer-sample", "-index", "index_abv2",
41 | "-fields", "abv",
42 | },
43 |
44 | []string{
45 | "-type", "count", "-bucket", "beer-sample", "-index", "index_abv1",
46 | "-low", "[1.0]", "-high", "[100.0]",
47 | },
48 | []string{
49 | "-type", "count", "-bucket", "beer-sample", "-index", "index_abv2",
50 | "-low", "[1.0]", "-high", "[100.0]",
51 | },
52 | []string{
53 | "-type", "count", "-bucket", "beer-sample", "-index", "index_abv1",
54 | "-low", "[1.0]", "-high", "[100.0]",
55 | },
56 | }
57 |
--------------------------------------------------------------------------------
/secondary/tools/querycmd/scan_retry.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "log"
6 | "os"
7 | "time"
8 |
9 | c "github.com/couchbase/indexing/secondary/common"
10 |
11 | "github.com/couchbase/indexing/secondary/querycmd"
12 | qclient "github.com/couchbase/indexing/secondary/queryport/client"
13 | )
14 |
15 | func doScanRetry(cluster string, client *qclient.GsiClient) (err error) {
16 |
17 | crArgs := retryCommands[0]
18 | cmd, _, _, err := querycmd.ParseArgs(crArgs)
19 | if err != nil {
20 | log.Fatal(err)
21 | }
22 | err = querycmd.HandleCommand(client, cmd, true, os.Stdout)
23 | if err != nil {
24 | fmt.Printf("%#v\n", cmd)
25 | fmt.Printf(" %v\n", err)
26 | }
27 | fmt.Println()
28 |
29 | for {
30 | index, _ := querycmd.GetIndex(client, cmd.Bucket, cmd.IndexName)
31 | if index == nil {
32 | time.Sleep(5 * time.Second)
33 | continue
34 | }
35 | defnID := uint64(index.Definition.DefnId)
36 |
37 | crArgs := retryCommands[1]
38 | cmd, _, _, err := querycmd.ParseArgs(crArgs)
39 | if err != nil {
40 | log.Fatal(err)
41 | }
42 | low, high, incl := cmd.Low, cmd.High, cmd.Inclusion
43 | cons := c.SessionConsistency
44 |
45 | fmt.Printf("CountRange:\n")
46 | count, err := client.CountRange(
47 | uint64(defnID), "requestId", low, high, incl, cons, nil)
48 | if err == nil {
49 | fmt.Printf(
50 | "Index %q/%q has %v entries\n", cmd.Bucket, cmd.IndexName, count)
51 | } else {
52 | fmt.Printf("fail: %v %v\n", defnID, err)
53 | }
54 | fmt.Println()
55 | time.Sleep(1 * time.Second)
56 | }
57 | return
58 | }
59 |
60 | var retryCommands = [][]string{
61 | []string{
62 | "-type", "create", "-bucket", "default", "-index", "iname",
63 | "-fields", "name",
64 | },
65 | []string{
66 | "-type", "count", "-bucket", "default", "-index", "iname",
67 | "-low", `["A"]`, "-high", `["Z"]`, "-limit", "10000",
68 | },
69 | }
70 |
--------------------------------------------------------------------------------
/secondary/tools/randdocs/Makefile:
--------------------------------------------------------------------------------
1 | all: clean comp run
2 |
3 | export GOPATH=$(PWD)/../../../../../../../../goproj:$(PWD)/../../../../../../../../godeps
4 | export GO111MODULE=auto
5 | export CGO_CFLAGS=-I$(PWD)/../../../../../../../../sigar/include -I$(PWD)/../../../../../../../../build/tlm/deps/zstd-cpp.exploded/include -I$(PWD)/../../../../../../../../build/tlm/deps/jemalloc.exploded/include -I$(PWD)/../../../../../../../../forestdb/include/ -DJEMALLOC=1
6 | export CGO_LDFLAGS=-L $(PWD)/../../../../../../../../install/lib -Wl,-rpath $(PWD)/../../../../../../../../install/lib
7 |
8 | clean:
9 | rm -rf ./randdocs
10 |
11 | comp:
12 | go build -o randdocs cmd/main.go
13 |
14 | run:
15 | ./randdocs -config ./cmd/config.json
16 |
17 | nomodcomp:
18 | env GO111MODULE=off go build -o randdocs cmd/main.go
19 |
20 | loadrandvecs:
21 | ./randdocs -config ./cmd/config.json -genVectors
22 |
23 | loadsiftsmall:
24 | ./randdocs -config ./cmd/config.json -useSIFTSmall -NumDocs 40000 -skipNormalData
25 |
--------------------------------------------------------------------------------
/secondary/tools/randdocs/cmd/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "ClusterAddr": "127.0.0.1:9000",
3 | "Bucket": "default",
4 | "Scope": "",
5 | "Collection": "",
6 | "NumDocs": 1000,
7 | "DocIdLen": 25,
8 | "FieldSize": 256,
9 | "ArrayLen": 0,
10 | "JunkFieldSize": 0,
11 | "Iterations": 1,
12 | "Threads": 8,
13 | "DocsNumOffset": 0,
14 | "OpsPerSec": 100000,
15 | "VecDimension": 128,
16 | "UseSIFTSmall": false
17 | }
18 |
--------------------------------------------------------------------------------
/secondary/tools/randdocs/siftsmall/siftsmall_base.fvecs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/indexing/ba752cd53c7865086c4d99f312eafbe3d23982a9/secondary/tools/randdocs/siftsmall/siftsmall_base.fvecs
--------------------------------------------------------------------------------
/secondary/tools/randdocs/siftsmall/siftsmall_groundtruth.ivecs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/indexing/ba752cd53c7865086c4d99f312eafbe3d23982a9/secondary/tools/randdocs/siftsmall/siftsmall_groundtruth.ivecs
--------------------------------------------------------------------------------
/secondary/tools/randdocs/siftsmall/siftsmall_learn.fvecs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/indexing/ba752cd53c7865086c4d99f312eafbe3d23982a9/secondary/tools/randdocs/siftsmall/siftsmall_learn.fvecs
--------------------------------------------------------------------------------
/secondary/tools/randdocs/siftsmall/siftsmall_query.fvecs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/couchbase/indexing/ba752cd53c7865086c4d99f312eafbe3d23982a9/secondary/tools/randdocs/siftsmall/siftsmall_query.fvecs
--------------------------------------------------------------------------------
/secondary/vector/faiss/autotune.go:
--------------------------------------------------------------------------------
1 | package faiss
2 |
3 | /*
4 | #include
5 | #include
6 | */
7 | import "C"
8 | import (
9 | "unsafe"
10 | )
11 |
12 | type ParameterSpace struct {
13 | ps *C.FaissParameterSpace
14 | }
15 |
16 | // NewParameterSpace creates a new ParameterSpace.
17 | func NewParameterSpace() (*ParameterSpace, error) {
18 | var ps *C.FaissParameterSpace
19 | if c := C.faiss_ParameterSpace_new(&ps); c != 0 {
20 | return nil, getLastError()
21 | }
22 | return &ParameterSpace{ps}, nil
23 | }
24 |
25 | // SetIndexParameter sets one of the parameters.
26 | func (p *ParameterSpace) SetIndexParameter(idx Index, name string, val float64) error {
27 | cname := C.CString(name)
28 |
29 | defer func() {
30 | C.free(unsafe.Pointer(cname))
31 | }()
32 |
33 | c := C.faiss_ParameterSpace_set_index_parameter(
34 | p.ps, idx.cPtr(), cname, C.double(val))
35 | if c != 0 {
36 | return getLastError()
37 | }
38 | return nil
39 | }
40 |
41 | // Delete frees the memory associated with p.
42 | func (p *ParameterSpace) Delete() {
43 | if p.ps != nil {
44 | C.faiss_ParameterSpace_free(p.ps)
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/secondary/vector/faiss/faiss.go:
--------------------------------------------------------------------------------
1 | // Package faiss provides bindings to Faiss, a library for vector similarity
2 | // search.
3 | // More detailed documentation can be found at the Faiss wiki:
4 | // https://github.com/facebookresearch/faiss/wiki.
5 | package faiss
6 |
7 | /*
8 | #cgo LDFLAGS: -lfaiss_c
9 |
10 | #include
11 | #include
12 | #include
13 | */
14 | import "C"
15 | import "errors"
16 |
17 | func getLastError() error {
18 | return errors.New(C.GoString(C.faiss_get_last_error()))
19 | }
20 |
21 | // Metric type
22 | const (
23 | MetricInnerProduct = C.METRIC_INNER_PRODUCT
24 | MetricL2 = C.METRIC_L2
25 | )
26 |
27 | //Quantizer type
28 | const (
29 | QT_8bit = C.QT_8bit
30 | QT_4bit = C.QT_4bit
31 | QT_8bit_uniform = C.QT_8bit_uniform
32 | QT_4bit_uniform = C.QT_4bit_uniform
33 | QT_fp16 = C.QT_fp16
34 | QT_8bit_direct = C.QT_8bit_direct
35 | QT_6bit = C.QT_6bit
36 | )
37 |
38 | const DEFAULT_EF_SEARCH = 16
39 |
--------------------------------------------------------------------------------
/secondary/vector/indexivf.go:
--------------------------------------------------------------------------------
1 | package vector
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/couchbase/indexing/secondary/common"
7 | faiss "github.com/couchbase/indexing/secondary/vector/faiss"
8 | )
9 |
10 | func NewIndexFlat(dim, metric int) (*faiss.IndexImpl, error) {
11 |
12 | description := "Flat"
13 | return faiss.IndexFactory(dim, description, metric)
14 | }
15 |
16 | func NewIndexIVFPQ(dim, nlist, nsub, nbits, metric int, useFastScan bool) (*faiss.IndexImpl, error) {
17 | fs := ""
18 | if useFastScan {
19 | fs = "fs"
20 | }
21 |
22 | description := fmt.Sprintf("IVF%v,PQ%vx%v%v", nlist, nsub, nbits, fs)
23 | return faiss.IndexFactory(dim, description, metric)
24 | }
25 |
26 | func NewIndexIVFPQ_HNSW(dim, nlist, nsub, nbits, metric int, useFastScan bool) (*faiss.IndexImpl, error) {
27 | fs := ""
28 | if useFastScan {
29 | fs = "fs"
30 | }
31 |
32 | description := fmt.Sprintf("IVF%v_HNSW,PQ%vx%v%v", nlist, nsub, nbits, fs)
33 | return faiss.IndexFactory(dim, description, metric)
34 |
35 | }
36 |
37 | func NewIndexIVFSQ(dim, nlist, metric int, sqRange common.ScalarQuantizerRange) (*faiss.IndexImpl, error) {
38 |
39 | description := fmt.Sprintf("IVF%v,%v", nlist, sqRange)
40 | return faiss.IndexFactory(dim, description, metric)
41 | }
42 |
43 | func NewIndexIVFSQ_HNSW(dim, nlist, metric int, sqRange common.ScalarQuantizerRange) (*faiss.IndexImpl, error) {
44 | if sqRange == common.SQ_FP16 {
45 | sqRange = "SQfp16"
46 | }
47 |
48 | description := fmt.Sprintf("IVF%v_HNSW,%v", nlist, sqRange)
49 | return faiss.IndexFactory(dim, description, metric)
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/secondary/vector/util/index_evaluator_test.go:
--------------------------------------------------------------------------------
1 | package vectorutil
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/couchbase/indexing/secondary/common"
7 | c "github.com/couchbase/indexing/secondary/common"
8 | )
9 |
10 | func SkipTestFetchSampleVectorsForIndexes(t *testing.T) {
11 |
12 | cluster := "127.0.0.1:8091"
13 | pool := "default"
14 | bucket := "default"
15 | scope := "_default"
16 | collection := "_default"
17 | cid := "0"
18 |
19 | dim := 128
20 |
21 | meta := &c.VectorMetadata{
22 | IsCompositeIndex: true,
23 | Dimension: dim,
24 | }
25 |
26 | idxDefn := c.IndexDefn{
27 | DefnId: c.IndexDefnId(200),
28 | Name: "index_evaluator",
29 | Using: common.PlasmaDB,
30 | Bucket: bucket,
31 | IsPrimary: false,
32 | SecExprs: []string{"description"},
33 | ExprType: c.N1QL,
34 | IsVectorIndex: true,
35 | HasVectorAttr: []bool{true},
36 | Scope: scope,
37 | Collection: collection,
38 | VectorMeta: meta,
39 | }
40 |
41 | indexInst := &common.IndexInst{
42 | InstId: c.IndexInstId(300),
43 | Defn: idxDefn,
44 | }
45 |
46 | indexInsts := []*c.IndexInst{indexInst}
47 |
48 | vectors, err := FetchSampleVectorsForIndexes(cluster, pool, bucket, scope, collection, cid, indexInsts, 800, 1)
49 |
50 | t.Logf("Vectors %v, Err %v", len(vectors[0])/dim, err)
51 |
52 | t.Logf("Sample Vector %v", vectors[0][:dim])
53 | }
54 |
--------------------------------------------------------------------------------
/secondary/vector/utils.go:
--------------------------------------------------------------------------------
1 | package vector
2 |
3 | import (
4 | "math/rand"
5 | "time"
6 | )
7 |
8 | func genRandomVecs(dims int, n int, seed int64) [][]float32 {
9 | if seed != 0 {
10 | rand.Seed(seed)
11 | } else {
12 | rand.Seed(time.Now().UnixNano())
13 | }
14 |
15 | vecs := make([][]float32, n)
16 | for i := 0; i < n; i++ {
17 | vecs[i] = make([]float32, dims)
18 | for j := 0; j < dims; j++ {
19 | vecs[i][j] = rand.Float32()
20 | }
21 | }
22 |
23 | return vecs
24 | }
25 |
26 | func convertTo1D(vecs [][]float32) []float32 {
27 |
28 | var vecs1D []float32
29 | for _, vec := range vecs {
30 | vecs1D = append(vecs1D, vec...)
31 | }
32 | return vecs1D
33 | }
34 |
35 | func compareVecs(vec1, vec2 []float32) bool {
36 | // Check if vectors have the same dimension
37 | if len(vec1) != len(vec2) {
38 | return false
39 | }
40 |
41 | // Iterate over each element and compare
42 | for i := 0; i < len(vec1); i++ {
43 | if vec1[i] != vec2[i] {
44 | return false
45 | }
46 | }
47 |
48 | return true
49 | }
50 |
--------------------------------------------------------------------------------