@@ -74,10 +74,32 @@ function setup_single_m3db_node_long_namespaces {
7474 ]
7575 }'
7676
77+ echo " Updating aggregation options for agg namespace"
78+ curl -vvvsSf -X PUT 0.0.0.0:${coordinator_port} /api/v1/services/m3db/namespace -d ' {
79+ "name": "agg",
80+ "options": {
81+ "aggregationOptions": {
82+ "aggregations": [
83+ {
84+ "aggregated": true,
85+ "attributes": {
86+ "resolutionDuration": "30s",
87+ "downsampleOptions": { "all": false }
88+ }
89+ }
90+ ]
91+ }
92+ }
93+ }'
94+
7795 echo " Wait until placement is init'd"
7896 ATTEMPTS=10 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
7997 ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/placement | jq .placement.instances.' ${dbnode_id} ' .id)" == \"' ${dbnode_id} ' \" ]'
8098
99+ echo " Wait until agg namespace is ready"
100+ ATTEMPTS=20 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
101+ ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/namespace/ready -d "{ \"name\": \"agg\"}" | grep -c true)" -eq 1 ]'
102+
81103 wait_for_namespaces
82104
83105 echo " Adding agg2d namespace"
@@ -86,10 +108,31 @@ function setup_single_m3db_node_long_namespaces {
86108 "retentionTime": "48h"
87109 }'
88110
111+ echo " Updating aggregation options for agg namespace"
112+ curl -vvvsSf -X PUT 0.0.0.0:${coordinator_port} /api/v1/services/m3db/namespace -d ' {
113+ "name": "agg2d",
114+ "options": {
115+ "aggregationOptions": {
116+ "aggregations": [
117+ {
118+ "aggregated": true,
119+ "attributes": {
120+ "resolutionDuration": "1m",
121+ "downsampleOptions": { "all": false }
122+ }
123+ }
124+ ]
125+ }
126+ }
127+ }'
128+
89129 echo " Wait until agg2d namespace is init'd"
90130 ATTEMPTS=10 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
91131 ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/namespace | jq .registry.namespaces.agg2d.indexOptions.enabled)" == true ]'
92132
133+ echo " Wait until agg2d namespace is ready"
134+ ATTEMPTS=20 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
135+ ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/namespace/ready -d "{ \"name\": \"agg2d\"}" | grep -c true)" -eq 1 ]'
93136
94137 echo " Wait until bootstrapped"
95138 ATTEMPTS=100 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
@@ -103,6 +146,8 @@ function setup_single_m3db_node {
103146 local dbnode_id=${DBNODE_ID:- m3db_local}
104147 local coordinator_port=${COORDINATOR_PORT:- 7201}
105148 local zone=${ZONE:- embedded}
149+ local agg_resolution=${AGG_RESOLUTION:- 15s}
150+ local agg_retention=${AGG_RETENTION:- 10h}
106151
107152 echo " Wait for API to be available"
108153 ATTEMPTS=100 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
@@ -112,7 +157,7 @@ function setup_single_m3db_node {
112157 curl -vvvsSf -X POST 0.0.0.0:${coordinator_port} /api/v1/database/create -d ' {
113158 "type": "cluster",
114159 "namespaceName": "agg",
115- "retentionTime": "6h ",
160+ "retentionTime": "' ${agg_retention} ' ",
116161 "num_shards": 4,
117162 "replicationFactor": 1,
118163 "hosts": [
@@ -127,10 +172,31 @@ function setup_single_m3db_node {
127172 ]
128173 }'
129174
175+ echo " Updating aggregation options for agg namespace"
176+ curl -vvvsSf -X PUT 0.0.0.0:${coordinator_port} /api/v1/services/m3db/namespace -d ' {
177+ "name": "agg",
178+ "options": {
179+ "aggregationOptions": {
180+ "aggregations": [
181+ {
182+ "aggregated": true,
183+ "attributes": {
184+ "resolutionDuration": "' ${agg_resolution} ' "
185+ }
186+ }
187+ ]
188+ }
189+ }
190+ }'
191+
130192 echo " Wait until placement is init'd"
131193 ATTEMPTS=10 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
132194 ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/placement | jq .placement.instances.' ${dbnode_id} ' .id)" == \"' ${dbnode_id} ' \" ]'
133195
196+ echo " Wait until agg namespace is ready"
197+ ATTEMPTS=20 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
198+ ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/namespace/ready -d "{ \"name\": \"agg\"}" | grep -c true)" -eq 1 ]'
199+
134200 wait_for_namespaces
135201
136202 echo " Wait until bootstrapped"
@@ -147,6 +213,8 @@ function setup_two_m3db_nodes {
147213 local dbnode_host_1_health_port=${DBNODE_HEALTH_PORT_01:- 9012}
148214 local dbnode_host_2_health_port=${DBNODE_HEALTH_PORT_02:- 9022}
149215 local coordinator_port=${COORDINATOR_PORT:- 7201}
216+ local agg_resolution=${AGG_RESOLUTION:- 15s}
217+ local agg_retention=${AGG_RETENTION:- 10h}
150218
151219 echo " Wait for API to be available"
152220 ATTEMPTS=100 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
@@ -156,7 +224,7 @@ function setup_two_m3db_nodes {
156224 curl -vvvsSf -X POST 0.0.0.0:${coordinator_port} /api/v1/database/create -d ' {
157225 "type": "cluster",
158226 "namespaceName": "agg",
159- "retentionTime": "6h ",
227+ "retentionTime": "' ${agg_retention} ' ",
160228 "num_shards": 2,
161229 "replicationFactor": 2,
162230 "hosts": [
@@ -179,10 +247,31 @@ function setup_two_m3db_nodes {
179247 ]
180248 }'
181249
250+ echo " Updating aggregation options for agg namespace"
251+ curl -vvvsSf -X PUT 0.0.0.0:${coordinator_port} /api/v1/services/m3db/namespace -d ' {
252+ "name": "agg",
253+ "options": {
254+ "aggregationOptions": {
255+ "aggregations": [
256+ {
257+ "aggregated": true,
258+ "attributes": {
259+ "resolutionDuration": "' ${agg_resolution} ' "
260+ }
261+ }
262+ ]
263+ }
264+ }
265+ }'
266+
182267 echo " Wait until placement is init'd"
183268 ATTEMPTS=10 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
184269 ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/placement | jq .placement.instances.' " ${dbnode_id_1} " ' .id)" == \"' " ${dbnode_id_1} " ' \" ]'
185270
271+ echo " Wait until agg namespace is ready"
272+ ATTEMPTS=20 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
273+ ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/namespace/ready -d "{ \"name\": \"agg\"}" | grep -c true)" -eq 1 ]'
274+
186275 wait_for_namespaces
187276
188277 echo " Wait until bootstrapped"
@@ -194,6 +283,7 @@ function setup_two_m3db_nodes {
194283
195284function wait_for_namespaces {
196285 local coordinator_port=${COORDINATOR_PORT:- 7201}
286+ local unagg_retention=${UNAGG_RETENTION:- 10h}
197287
198288 echo " Wait until agg namespace is init'd"
199289 ATTEMPTS=10 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
@@ -202,13 +292,17 @@ function wait_for_namespaces {
202292 echo " Adding unagg namespace"
203293 curl -vvvsSf -X POST 0.0.0.0:${coordinator_port} /api/v1/database/namespace/create -d ' {
204294 "namespaceName": "unagg",
205- "retentionTime": "6h "
295+ "retentionTime": "' ${unagg_retention} ' "
206296 }'
207297
208298 echo " Wait until unagg namespace is init'd"
209299 ATTEMPTS=10 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
210300 ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/namespace | jq .registry.namespaces.unagg.indexOptions.enabled)" == true ]'
211301
302+ echo " Wait until unagg namespace is ready"
303+ ATTEMPTS=20 MAX_TIMEOUT=4 TIMEOUT=1 retry_with_backoff \
304+ ' [ "$(curl -sSf 0.0.0.0:' " ${coordinator_port} " ' /api/v1/services/m3db/namespace/ready -d "{ \"name\": \"unagg\"}" | grep -c true)" -eq 1 ]'
305+
212306 echo " Adding coldWritesRepairAndNoIndex namespace"
213307 curl -vvvsSf -X POST 0.0.0.0:${coordinator_port} /api/v1/services/m3db/namespace -d ' {
214308 "name": "coldWritesRepairAndNoIndex",
@@ -227,6 +321,11 @@ function wait_for_namespaces {
227321 "bufferPastDuration": "10m",
228322 "blockDataExpiry": true,
229323 "blockDataExpiryAfterNotAccessPeriodDuration": "5m"
324+ },
325+ "aggregationOptions": {
326+ "aggregations": [
327+ { "aggregated": false }
328+ ]
230329 }
231330 }
232331 }'
0 commit comments