From f1d131c19dc2ccb8d9e30a585e3e447b0d381dc3 Mon Sep 17 00:00:00 2001 From: Stuart Mark James <stuart.james@esrf.fr> Date: Fri, 6 Dec 2019 15:53:08 +0100 Subject: [PATCH] Release preparation --- CHANGELOG.md | 14 +++++++++++--- CMakeLists.txt | 10 +++++----- README.md | 7 +++++++ doc/README.md | 7 ++++++- doc/build.md | 10 +++++++++- doc/configuration.md | 40 ++++++++++++++++++++++++++++++++++++++++ src/PqxxExtension.hpp | 8 +++++--- 7 files changed, 83 insertions(+), 13 deletions(-) create mode 100644 doc/configuration.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dcee8e..f19e88c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,25 +7,33 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [0.10.0] - 2019-12-06 + ### Added +- Configuration documentation - Added support for syslog logging. +- Added support for storing data via insert strings rather than prepared statements: + - Tango string spectrum types are always stored via insert strings to remove escape characters + - This work provides the basis for future batch saving of data events. ### Fixed - Close logging down in destructor so linked device server can be restarted. +- All unit tests now pass! ### Changed +- Completely redone DbConnectionTest unit tests + - Speeds up execution of tests + - Prevents database deadlock due to repeated rapid truncation of tables. - Build system correctly produces a major version shared object - Removed Clang path from build (CMake checks PATH) - Corrected static library build - Install now places header in include/hdb++/ - Entire library now uses the global default logger from spdlog. - -#### Submodules - - Updated spdlog submodule to release v1.4.2 +- Modern code via clang tidy ## [0.9.1] - 2019-07-18 diff --git a/CMakeLists.txt b/CMakeLists.txt index fd3f2a7..fc968d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,8 +19,8 @@ set(LIBHDBPP_TIMESCALE_NAME "libhdb++timescale") # Versioning set(VERSION_MAJOR "0") -set(VERSION_MINOR "9") -set(VERSION_PATCH "2") +set(VERSION_MINOR "10") +set(VERSION_PATCH "0") set(VERSION_METADATA "") set(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) @@ -38,9 +38,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # Build options -option(BUILD_UNIT_TESTS "Build unit tests" ON) -option(BUILD_BENCHMARK_TESTS "Build benchmarking tests (Forces RELEASE build)" ON) -option(ENABLE_CLANG "Enable clang code and layout analysis" ON) +option(BUILD_UNIT_TESTS "Build unit tests" OFF) +option(BUILD_BENCHMARK_TESTS "Build benchmarking tests (Forces RELEASE build)" OFF) +option(ENABLE_CLANG "Enable clang code and layout analysis" OFF) if(BUILD_UNIT_TESTS) message(STATUS "Unit tests will be built") diff --git a/README.md b/README.md index 7e97541..7e45147 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [](http://www.tango-controls.org) [](https://www.gnu.org/licenses/gpl-3.0) [](https://github.com/tango-controls-hdbpp/libhdbpp-timescale/releases) - [libhdbpp-timescale](#libhdbpp-timescale) + - [v0.9.0 To v0.10.0 Update](#v090-To-v0100-Update) - [Cloning](#Cloning) - [Bug Reports + Feature Requests](#Bug-Reports--Feature-Requests) - [Documentation](#Documentation) @@ -20,6 +21,12 @@ The library has been build against a number of other projects, these have been i * spdlog - Logging system * Catch2 - Unit test subsystem +## v0.9.0 To v0.10.0 Update + +This revision changes how both scalar and spectrum strings are stored. In 0.9.0 strings were escaped and quoted before being stored in the database. This had the effect that when the strings were retrieved they were still escaped/quoted. For consistency scalar strings were stored escaped/quoted. + +To fix this, spectrum's of strings are now stored via insert strings using both the ARRAY syntax and dollar escape method. This means when they are retrieved frm the database they are longer escaped/quoted. To match this, scalar strings are also no longer stored escaped/quoted. + ## Cloning Currently this project is configured to express its dependencies as submodules. This may change in future if there is time to explore, for example, the Meson build system. To successfully clone the project and all its dependencies use the following: diff --git a/doc/README.md b/doc/README.md index 73dbc15..d4368d9 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,6 +6,7 @@ The documentation is purely about getting the shared library running on a correc - [About](#About) - [Building and Installation](#Building-and-Installation) - [DB Schema](#DB-Schema) + - [Configuration](#Configuration) ## About @@ -18,4 +19,8 @@ The overview is in the main project [README](../README.md). ## DB Schema -* [Schema](db-schema-config) guidelines and setup. \ No newline at end of file +* [Schema](db-schema-config) guidelines and setup. + +## Configuration + +* [Configuration](configuration) parameter details. \ No newline at end of file diff --git a/doc/build.md b/doc/build.md index 451825a..3f64960 100644 --- a/doc/build.md +++ b/doc/build.md @@ -88,7 +88,15 @@ cmake -DBUILD_UNIT_TESTS=ON .. make ``` -To run all unit tests, a postgresql database node is required with the project schema loaded up. Also note the connection string to this database node needs setting in TestHelpers.hpp. To run all tests: +To run all unit tests, a postgresql database node is required with the project schema loaded up. There is a default connection string inside test/TestHelpers.hpp: + +``` +user=postgres host=localhost port=5432 dbname=hdb password=password +``` + +If you run the hdb timescale docker image associated with this project locally then this will connect automatically. If you wish to use a different database, edit the string in test/TestHelpers.hpp. + +To run all tests: ```bash ./test/unit-tests diff --git a/doc/configuration.md b/doc/configuration.md new file mode 100644 index 0000000..b515712 --- /dev/null +++ b/doc/configuration.md @@ -0,0 +1,40 @@ +# Configuration + +## Library Configuration Parameters + +Configuration parameters are as follows: + +| Parameter | Mandatory | Default | Description | +|------|-----|-----|-----| +| libname | true | None | Must be "libhdb++timescale.so" | +| connect_string | true | None | Postgres connection string, eg user=postgres host=localhost port=5432 dbname=hdb password=password | +| logging_level | false | error | Logging level. See table below | +| log_file | false | false | Enable logging to file | +| log_console | false | false | Enable logging to the console | +| log_syslog | false | false | Enable logging to syslog | +| log_file_name | false | None | When logging to file, this is the path and name of file to use | + +The logging_level parameter is case insensitive. Logging levels are as follows: + +| Level | Description | +|------|-----| +| error | Log only error level events (recommended unless debugging) | +| warning | Log only warning level events | +| info | Log only warning level events | +| debug | Log only warning level events. Good for early install debugging | +| trace | Trace level logging. Excessive level of debug, good for involved debugging | +| disabled | Disable logging subsystem | + +## Configuration Example + +Short example LibConfiguration property value on an EventSubscriber or ConfigManager. You will HAVE to change the various parts to match your system: + +``` +connect_string=user=hdb-user password=password host=hdb-database port=5432 dbname=hdb +logging_level=debug +log_file=true +log_syslog=false +log_console=false +libname=libhdb++timescale.so +log_file_name=/tmp/hdb/es-name.log +```` \ No newline at end of file diff --git a/src/PqxxExtension.hpp b/src/PqxxExtension.hpp index 2078748..fbaeaf3 100644 --- a/src/PqxxExtension.hpp +++ b/src/PqxxExtension.hpp @@ -199,14 +199,16 @@ public: value.clear(); std::pair<array_parser::juncture, std::string> output; - array_parser parser(str); + // use pqxx array parser features to get each element from the array + array_parser parser(str); output = parser.get_next(); if (output.first == array_parser::juncture::row_start) { output = parser.get_next(); + // loop and extract each string in turn while (output.first == array_parser::juncture::string_value) { value.push_back(output.second); @@ -221,10 +223,10 @@ public: } } - // unlike other types, when encoed to a string th static std::string to_string(const std::vector<std::string> &value) { - // simply use the pqxx utilities for this, rather than reinvent the wheel + // This function should not be used, so we do a simple basic conversion + // for testing only return "{" + separated_list(",", value.begin(), value.end()) + "}"; } }; -- GitLab