Skip to content

Commit

Permalink
Merge branch 'fix/ensure_nameOnly_boolean' into task/upgrade_ci_mongo_6
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvaroVega committed Nov 28, 2023
2 parents 580bd06 + ad08b91 commit 07c6756
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 9 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ jobs:
strategy:
matrix:
node-version:
- 10.x
- 12.x
- 14.x
# FIXME: it seems problems with mongodb driver version preclude using Node 16+
# see details at https://github.com/telefonicaid/fiware-sth-comet/pull/580#issuecomment-1160353123
#- 16.x
#- 18.x
steps:
- name: Git checkout
uses: actions/checkout@v2
Expand Down
6 changes: 5 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"

mkdocs:
configuration: mkdocs.yml

python:
version: 3.8
install:
- requirements: doc/requirements.txt
3 changes: 3 additions & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
- Fix: ensure nameOnly flag of mongoDB is boolean
- Fix: TRUNCATION_EXPIRE_AFTER_SECONDS functionality (#606)
- Set Nodejs 14 as minimum version in packages.json (effectively removing Nodev12 from supported versions)
- Add: CORS_ENABLED env var (boolean) to enable the cors configuration (of config.js file) in your docker image (#608)
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

[![](https://nexus.lab.fiware.org/repository/raw/public/badges/chapters/core.svg)](https://www.fiware.org/developers/catalogue/)
[![License](https://img.shields.io/github/license/telefonicaid/fiware-sth-comet.svg)](https://opensource.org/licenses/AGPL-3.0)
[![Docker badge](https://img.shields.io/docker/pulls/fiware/sth-comet.svg)](https://hub.docker.com/r/fiware/sth-comet-ngsi/)
[![](https://img.shields.io/badge/tag-fiware--sth-comet-orange.svg?logo=stackoverflow)](http://stackoverflow.com/questions/tagged/fiware-sth-comet)
[![Support badge](https://img.shields.io/badge/support-askbot-yellowgreen.svg)](https://ask.fiware.org/questions/scope%3Aall/tags%3Asth-comet/)
[![Join the chat at https://gitter.im/telefonicaid/fiware-sth-comet](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/telefonicaid/fiware-sth-comet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
<br/>
[![Quay badge](https://img.shields.io/badge/quay.io-fiware%2Fsth--comet-grey?logo=red%20hat&labelColor=EE0000)](https://quay.io/repository/fiware/sth-comet)
[![Docker badge](https://img.shields.io/badge/docker-telefonicaiot%2Ffiware--sth--comet-blue?logo=docker)](https://registry.hub.docker.com/r/telefonicaiot/fiware-sth-comet)
<br/>
[![Documentation badge](https://readthedocs.org/projects/fiware-sth-comet/badge/?version=latest)](https://fiware-sth-comet.readthedocs.io)
[![CI](https://github.com/telefonicaid/fiware-sth-comet/workflows/CI/badge.svg)](https://github.com/telefonicaid/fiware-sth-comet/actions?query=workflow%3ACI)
[![Coverage Status](https://coveralls.io/repos/github/telefonicaid/fiware-sth-comet/badge.svg?branch=master)](https://coveralls.io/github/telefonicaid/fiware-sth-comet?branch=master)
Expand All @@ -25,8 +27,8 @@ interfaces.
This project is part of [FIWARE](https://www.fiware.org/). For more information check the FIWARE Catalogue entry for the
[Core Context Management](https://github.com/Fiware/catalogue/tree/master/core).

| :books: [Documentation](https://fiware-sth-comet.readthedocs.io) | :mortar_board: [Academy](https://fiware-academy.readthedocs.io/en/latest/core/sth-comet) | :whale: [Docker Hub](https://hub.docker.com/r/fiware/sth-comet/) | :dart: [Roadmap](https://github.com/telefonicaid/fiware-sth-comet/blob/master/doc/roadmap.md) |
| --------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| :books: [Documentation](https://fiware-sth-comet.readthedocs.io) | :mortar_board: [Academy](https://fiware-academy.readthedocs.io/en/latest/core/sth-comet) | <img style="height:1em" src="https://quay.io/static/img/quay_favicon.png"/> [quay.io](https://quay.io/repository/fiware/sth-comet) | :whale: [Docker Hub](https://registry.hub.docker.com/r/telefonicaiot/fiware-sth-comet) | :dart: [Roadmap](https://github.com/telefonicaid/fiware-sth-comet/blob/master/doc/roadmap.md) |
| --------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --- |


# Contents
Expand Down
20 changes: 20 additions & 0 deletions doc/manuals/db_indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ It is recommended to create the following index in this collection:
The performance difference can be dramatic for large sets of data. For instance, for a collection with around ~3000000
query execution time can drop from 3 seconds to 1 millisecond.

Since version 3.0.0 of cygnus an index named `cyg_raw_opt` is created in this way but depending on datamodel:

| datamodel | keys |
| :---------------- | :--------------------------------------------------------------- |
| dm-by-servicepath | recvTime, entityId, entityType, attrName, attrType, attrValue |
| dm-by-entity | recvTime, attrName, attrType, attrValue |
| dm-by-attribute | recvTime, attrType, attrValue |

Note that datamodel others that the ones above are not allowed by Cygnus.

## Indexes in the aggregated data collection

It is recommended to create the following index in this collection:
Expand All @@ -26,3 +36,13 @@ It is recommended to create the following index in this collection:

The performance difference can be dramatic for large sets of data. For instance, for a collection with around ~6000000
query execution time can drop from 28 seconds to 20 millisecond.

Since version 3.0.0 of cygnus index named `cyg_agg_opt` is created in this way but depending on datamodel:

| datamodel | keys |
| :----------------- | :------------------------------------------------- |
| dm-by-servicepath | entityId, entityType, attrName, resolution, origin |
| dm-by-entity | attrName, resolution, origin |
| dm-by-attribute | resolution, origin |

Note that datamodel others that the ones above are not allowed by Cygnus.
1 change: 1 addition & 0 deletions doc/manuals/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ The environment variables accepted by the script (for which there exists counter
- `PROOF_OF_LIFE_INTERVAL`: The time in seconds between proof of life logging messages informing that the server is up
and running normally. Default value: "60". `PROCESSED_REQUEST_LOG_STATISTICS_INTERVAL`: The time in seconds between
processed requests statistics appear in the logs. Default value: "60".
- `CORS_ENABLED`: Boolean attribute (`true`|`false`) to enable cors configuration. Optional. Default value: "false".

For example, to start the STH server listening on port 7777, connecting to a MongoDB instance listening on
mymongo.com:27777 and without filtering out the empty results, use:
Expand Down
5 changes: 4 additions & 1 deletion lib/configuration/sthConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ if (ENV.STH_PORT && !isNaN(ENV.STH_PORT)) {
);
}

if (config && config.cors && config.cors.enabled) {
if (ENV.CORS_ENABLED && !(ENV.CORS_ENABLED == null)) {
module.exports.corsEnabled = JSON.parse(ENV.CORS_ENABLED);
sthLogger.info(module.exports.LOGGING_CONTEXT.STARTUP, 'CORS value set to: ' + module.exports.corsEnabled);
} else if (config && config.cors && config.cors.enabled) {
module.exports.corsEnabled = JSON.parse(config.cors.enabled);
sthLogger.info(module.exports.LOGGING_CONTEXT.STARTUP, 'CORS value set to: ' + module.exports.corsEnabled);
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/database/model/sthDatabaseNameCodecTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ function copyDatabase(options, databaseName, callback) {
const adminDB = sthDatabase.connection.admin();
const listCommand = {
listCollections: 1,
nameOnly: 1
nameOnly: true
};
var sourceDB = databaseName;
var targetDB = options.encode
Expand Down
2 changes: 1 addition & 1 deletion lib/database/model/sthDatabaseNameMapperTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ function copyDatabase(options, databaseName, callback) {
const adminDB = sthDatabase.connection.admin();
const listCommand = {
listCollections: 1,
nameOnly: 1
nameOnly: true
};
var sourceDB = databaseName;
var targetDB = options.encode
Expand Down
2 changes: 1 addition & 1 deletion lib/database/sthDatabase.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ function isAggregated(collectionName) {
function setTTLPolicy(collection) {
// Set the TTL policy if required
if (sthConfig.TRUNCATION_EXPIRE_AFTER_SECONDS > 0) {
if (!isAggregated(collection)) {
if (!isAggregated(collection.collectionName)) {
if (sthConfig.TRUNCATION_SIZE === 0) {
collection.ensureIndex(
{
Expand Down

0 comments on commit 07c6756

Please sign in to comment.