Skip to content

Commit

Permalink
Merge branch 'master' into pre-agg-status
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilev-alex committed Apr 30, 2021
2 parents 299bc1b + cd6fb93 commit d8242c0
Show file tree
Hide file tree
Showing 113 changed files with 1,498 additions and 398 deletions.
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,33 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.27.4](https://github.com/cube-js/cube.js/compare/v0.27.3...v0.27.4) (2021-04-29)


### Bug Fixes

* **@cubejs-client/playground:** cache pane crash ([#2635](https://github.com/cube-js/cube.js/issues/2635)) ([405b80b](https://github.com/cube-js/cube.js/commit/405b80b4f9b14b98eb6d47803b0f1e519ce1e0c9))
* **@cubejs-client/playground:** pass field, win host ([e3144e9](https://github.com/cube-js/cube.js/commit/e3144e9110f4d572aca56cf9393a558e4c0817d1))
* **cubestore:** make top-k scan less batches ([486ee32](https://github.com/cube-js/cube.js/commit/486ee328f7625fd9fb2c490ec68e1fcd2c4c8a50))
* **cubestore-driver:** Ping connection only when it's OPEN ([d80e157](https://github.com/cube-js/cube.js/commit/d80e157e5865318c14be534a7f8a1bc39b0ad851))
* Show warning for deprecated variables only once ([fecbda4](https://github.com/cube-js/cube.js/commit/fecbda456b2b66005fb230e093b117db76c4919e))





## [0.27.3](https://github.com/cube-js/cube.js/compare/v0.27.2...v0.27.3) (2021-04-29)


### Bug Fixes

* **@cubejs-backend/cloud:** Missed dependency ([#2626](https://github.com/cube-js/cube.js/issues/2626)) ([0d396bf](https://github.com/cube-js/cube.js/commit/0d396bf7bd41c5d9acb8d84ae62bdd4ee33fc2a3))
* **@cubejs-server/core:** env file path ([#2622](https://github.com/cube-js/cube.js/issues/2622)) ([b9abb19](https://github.com/cube-js/cube.js/commit/b9abb195b5c73b3a0077801302721bf8ae2bdaa0))





## [0.27.2](https://github.com/cube-js/cube.js/compare/v0.27.1...v0.27.2) (2021-04-28)


Expand Down
2 changes: 1 addition & 1 deletion DEPRECATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ features:

| Status | Feature | Deprecated | Remove |
| ---------- | ------------------------------------------------------------------------------------------------------------------ | ---------- | --------- |
| Deprecated | [Node.js 8](#nodejs-8) | v0.22.4 | v0.26.0 |
| Removed | [Node.js 8](#nodejs-8) | v0.22.4 | v0.26.0 |
| Deprecated | [`hearBeatInterval`](#hearbeatinterval) | v0.23.8 | June 2021 |
| Removed | [`CUBEJS_ENABLE_TLS`](#cubejs_enable_tls) | v0.23.11 | v0.26.0 |
| Deprecated | [Embedding Cube.js within Express](#embedding-cubejs-within-express) | v0.24.0 | June 2021 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ databases [in this guide][link-connecting-to-db].
| `CUBEJS_DB_BQ_CREDENTIALS` | BigQuery | A Base64 encoded JSON key file for connecting to Google BigQuery | A valid Google BigQuery JSON key file encoded as a Base64 string |
| `CUBEJS_DB_BQ_KEY_FILE` | BigQuery | The path to a JSON key file for connecting to Google BigQuery | A valid Google BigQuery JSON key file |
| `CUBEJS_DB_BQ_PROJECT_ID` | BigQuery | The Google BigQuery project ID to connect to | A valid Google BigQuery Project ID |
| `CUBEJS_DB_BQ_EXPORT_BUCKET` | BigQuery | GCS bucket to use for export pre-aggregation tables to Cube Store. Use it to achieve best Cube Store ingestion performance possible. | A valid Google Cloud Storage Bucket ID |
| `CUBEJS_DB_URL` | Druid, Elasticsearch | The URL for a database | A valid database URL for Druid/Elasticsearch |
| `CUBEJS_DB_ELASTIC_OPENDISTRO` | Elasticsearch | If `true`, then use the Open Distro for Elasticsearch | `true`, `false` |
| `CUBEJS_DB_ELASTIC_QUERY_FORMAT` | Elasticsearch | By default, queries return data in JDBC format, but you can also return data in standard Elasticsearch JDBC, JSON, CSV, YAML or raw formats (only JSON and JDBC are currently supported) | `json`, `jdbc` |
Expand Down
9 changes: 6 additions & 3 deletions docs/content/Schema/cube.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,14 @@ SELECT FLOOR(EXTRACT(EPOCH FROM NOW()) / 5)
### dataSource

Each cube in schema can have it's own `dataSource` name to support scenarios where data should be fetched from multiple databases.
Value of `dataSource` parameter will be passed to [dbType](@cubejs-backend-server-core#options-reference-db-type) and
[driverFactory](@cubejs-backend-server-core#options-reference-driver-factory) functions as part of context param.
By default each cube has a `default` value for it's `dataSource`.
Value of `dataSource` parameter will be passed to [`dbType`][ref-config-dbtype] and
[`driverFactory`][ref-config-driverfactory] functions as part of the context paramameter.
By default, each cube has a `default` value for it's `dataSource`.
To override it you can use:

[ref-config-dbtype]: /config#options-reference-db-type
[ref-config-driverfactory]: /config#options-reference-driver-factory

```javascript
cube(`OrderFacts`, {
sql: `SELECT * FROM orders`,
Expand Down
4 changes: 2 additions & 2 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7502,9 +7502,9 @@ fault@^1.0.0, fault@^1.0.1:
dependencies:
format "^0.2.0"

"favicons-webpack-plugin@git+https://github.com/Creatiwity/favicons-webpack-plugin.git#0872de414061baaad0a2853c77ae75bc38b8bbbf":
"favicons-webpack-plugin@https://github.com/Creatiwity/favicons-webpack-plugin.git#0872de414061baaad0a2853c77ae75bc38b8bbbf":
version "0.0.9"
resolved "git+https://github.com/Creatiwity/favicons-webpack-plugin.git#0872de414061baaad0a2853c77ae75bc38b8bbbf"
resolved "https://github.com/Creatiwity/favicons-webpack-plugin.git#0872de414061baaad0a2853c77ae75bc38b8bbbf"
dependencies:
core-js "^2.5.7"
favicons "^5.1.1"
Expand Down
2 changes: 2 additions & 0 deletions examples/cubestore-benchmark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.cubestore
.postgres
15 changes: 15 additions & 0 deletions examples/cubestore-benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Cube Store benchmark template

## Setting up

* Update `cubejs-cubestore/docker-compose.yml` and `cubejs-postgres/docker-compose.yml` with data source credentials (see `TODO` comments)
* Update `cubejs-cubestore/schema` and `cubejs-postgres/schema` with relevant data schema that matches your data source
* Update `loadtest/queries.js` with relevant queries

## Running

* Go to `cubejs-cubestore` and run `docker-compose -p cubejs-cubestore up`
* Go to `cubejs-postgres` and run `docker-compose -p cubejs-postgres up`
* Go to `loadtest` and run `npm install`
* Then, start the relay server using `npm start`
* Then, run the load test using `RPS=<requests per second> DURATION=<duration, seconds>s npm test` (e.g., `RPS=10 DURATION=10s npm test`)
13 changes: 13 additions & 0 deletions examples/cubestore-benchmark/cubejs-cubestore/cube.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
orchestratorOptions: {
rollupOnlyMode: !process.env.CUBEJS_SCHEDULED_REFRESH_TIMER,
queryCacheOptions: {
externalQueueOptions: {
concurrency: 20
}
},
preAggregationsOptions: {
externalRefresh: process.env.CUBEJS_SCHEDULED_REFRESH_TIMER !== 'true'
}
}
}
103 changes: 103 additions & 0 deletions examples/cubestore-benchmark/cubejs-cubestore/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
version: '2.2'

services:
cube:
image: cubejs/cube:latest
ports:
- 4001:4000
- 3001:3000
environment:
- CUBEJS_DB_TYPE=bigquery
# TODO: Fill in the values below
- CUBEJS_DB_BQ_PROJECT_ID=
- CUBEJS_DB_BQ_CREDENTIALS=
- CUBEJS_DB_BQ_EXPORT_BUCKET=

- CUBEJS_EXT_DB_TYPE=cubestore
- CUBEJS_EXT_DB_HOST=cubestore
- CUBEJS_EXT_DB_PORT=3030

- CUBEJS_REDIS_URL=redis://redis:6379

- CUBEJS_API_SECRET=SECRET
volumes:
- .:/cube/conf
depends_on:
- refresh_worker
- cubestore
- redis

refresh_worker:
image: cubejs/cube:latest
environment:
- CUBEJS_SCHEDULED_REFRESH_TIMER=true
- CUBEJS_DB_TYPE=bigquery
# TODO: Fill in the values below
- CUBEJS_DB_BQ_PROJECT_ID=
- CUBEJS_DB_BQ_CREDENTIALS=
- CUBEJS_DB_BQ_EXPORT_BUCKET=

- CUBEJS_EXT_DB_TYPE=cubestore
- CUBEJS_EXT_DB_HOST=cubestore
- CUBEJS_EXT_DB_PORT=3030

- CUBEJS_REDIS_URL=redis://redis:6379

- CUBEJS_API_SECRET=SECRET
volumes:
- .:/cube/conf
depends_on:
- cubestore
- redis

cubestore:
image: cubejs/cubestore:latest
environment:
- CUBESTORE_WORKERS=cubestore_worker_1:10001,cubestore_worker_2:10002,cubestore_worker_3:10003,cubestore_worker_4:10004
- CUBESTORE_REMOTE_DIR=/cube/data
volumes:
- .cubestore:/cube/data
depends_on:
- cubestore_worker_1
- cubestore_worker_2
- cubestore_worker_3
- cubestore_worker_4

cubestore_worker_1:
image: cubejs/cubestore:latest
environment:
- CUBESTORE_WORKER_PORT=10001
- CUBESTORE_REMOTE_DIR=/cube/data
volumes:
- .cubestore:/cube/data

cubestore_worker_2:
image: cubejs/cubestore:latest
environment:
- CUBESTORE_WORKER_PORT=10002
- CUBESTORE_REMOTE_DIR=/cube/data
volumes:
- .cubestore:/cube/data

cubestore_worker_3:
image: cubejs/cubestore:latest
environment:
- CUBESTORE_WORKER_PORT=10003
- CUBESTORE_REMOTE_DIR=/cube/data
volumes:
- .cubestore:/cube/data

cubestore_worker_4:
image: cubejs/cubestore:latest
environment:
- CUBESTORE_WORKER_PORT=10004
- CUBESTORE_REMOTE_DIR=/cube/data
volumes:
- .cubestore:/cube/data

redis:
image: bitnami/redis:latest
environment:
- ALLOW_EMPTY_PASSWORD=yes
logging:
driver: none
83 changes: 83 additions & 0 deletions examples/cubestore-benchmark/cubejs-cubestore/schema/Mobility.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
cube(`Mobility`, {
sql: `
SELECT *
FROM \`bigquery-public-data.covid19_google_mobility.mobility_report\`
`,

refreshKey: {
sql: `
SELECT COUNT(*)
FROM \`bigquery-public-data.covid19_google_mobility.mobility_report\`
`,
},

measures: {
grocery: {
sql: `grocery_and_pharmacy_percent_change_from_baseline`,
type: `max`,
format: 'percent',
},

park: {
sql: `parks_percent_change_from_baseline`,
type: `max`,
format: 'percent',
},

residential: {
sql: `residential_percent_change_from_baseline`,
type: `max`,
format: 'percent',
},

retail: {
sql: `retail_and_recreation_percent_change_from_baseline`,
type: `max`,
format: 'percent',
},

transit: {
sql: `transit_stations_percent_change_from_baseline`,
type: `max`,
format: 'percent',
},

workplace: {
sql: `workplaces_percent_change_from_baseline`,
type: `max`,
format: 'percent',
},
},

dimensions: {
key: {
sql: `CONCAT(country_region, '-', sub_region_1, '-', sub_region_2, '-', ${Mobility}.date)`,
type: `string`,
primaryKey: true
},

country: {
sql: `country_region`,
type: `string`
},

date: {
sql: `TIMESTAMP(${Mobility}.date)`,
type: `time`
},
},

preAggregations: {
main: {
type: `rollup`,
external: true,
scheduledRefresh: true,
refreshKey: { every: '1 hour' },
measureReferences: [ grocery, park, residential, retail, transit, workplace ],
dimensionReferences: [ country ],
timeDimensionReference: date,
granularity: 'day',
partitionGranularity: 'month',
},
},
});
13 changes: 13 additions & 0 deletions examples/cubestore-benchmark/cubejs-postgres/cube.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
orchestratorOptions: {
rollupOnlyMode: !process.env.CUBEJS_SCHEDULED_REFRESH_TIMER,
queryCacheOptions: {
externalQueueOptions: {
concurrency: 20
}
},
preAggregationsOptions: {
externalRefresh: process.env.CUBEJS_SCHEDULED_REFRESH_TIMER !== 'true'
}
}
}
73 changes: 73 additions & 0 deletions examples/cubestore-benchmark/cubejs-postgres/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
version: '2.2'

services:
cube:
image: cubejs/cube:latest
ports:
- 4002:4000
- 3002:3000
environment:
- CUBEJS_DB_TYPE=bigquery
# TODO: Fill in the values below
- CUBEJS_DB_BQ_PROJECT_ID=
- CUBEJS_DB_BQ_CREDENTIALS=
- CUBEJS_DB_BQ_EXPORT_BUCKET=

- CUBEJS_EXT_DB_TYPE=postgres
- CUBEJS_EXT_DB_HOST=postgres
- CUBEJS_EXT_DB_PORT=5432
- CUBEJS_EXT_DB_NAME=postgres
- CUBEJS_EXT_DB_USER=postgres
- CUBEJS_EXT_DB_PASS=postgres

- CUBEJS_REDIS_URL=redis://redis:6379

- CUBEJS_API_SECRET=SECRET
volumes:
- .:/cube/conf
depends_on:
- refresh_worker
- postgres
- redis

refresh_worker:
image: cubejs/cube:latest
environment:
- CUBEJS_SCHEDULED_REFRESH_TIMER=true
- CUBEJS_DB_TYPE=bigquery
# TODO: Fill in the values below
- CUBEJS_DB_BQ_PROJECT_ID=
- CUBEJS_DB_BQ_CREDENTIALS=
- CUBEJS_DB_BQ_EXPORT_BUCKET=

- CUBEJS_EXT_DB_TYPE=postgres
- CUBEJS_EXT_DB_HOST=postgres
- CUBEJS_EXT_DB_PORT=5432
- CUBEJS_EXT_DB_NAME=postgres
- CUBEJS_EXT_DB_USER=postgres
- CUBEJS_EXT_DB_PASS=postgres

- CUBEJS_REDIS_URL=redis://redis:6379

- CUBEJS_API_SECRET=SECRET
volumes:
- .:/cube/conf
depends_on:
- postgres
- redis

postgres:
image: postgres:latest
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /data/postgres
volumes:
- .postgres:/data/postgres

redis:
image: bitnami/redis:latest
environment:
- ALLOW_EMPTY_PASSWORD=yes
logging:
driver: none

0 comments on commit d8242c0

Please sign in to comment.