ric-plt/sdl.git
4 years agoImprove installation instructions 95/1095/1
Rolf Badorek [Wed, 9 Oct 2019 07:58:22 +0000 (10:58 +0300)]
Improve installation instructions

Added two additional clarifications/tips to README.md file:

1) If SDL API is not installed to system default path, then
'PKG_CONFIG_PATH' needs to be adjusted.

2) In some cases dynamic linker cache needs to refreshed manually
after SDL API has been re-installed.

Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
Change-Id: Ib1b657e6e714c2c81b18a4ede7dfb01f539b29ca

4 years agoAdd standard stream logger 52/1052/2
Rolf Badorek [Wed, 2 Oct 2019 14:22:45 +0000 (17:22 +0300)]
Add standard stream logger

Added and activated logger implementation, which will write logs to
stdout and stderr.

This way SDL logs are included to 'kubectl logs' command output
of containerized application which is using SDL library.

SDL logs starts with "shareddatalayer: " prefix.

RIC has own logging library, which will be taken into use later as
a separate commit / merge request.

Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
Change-Id: I1b2d4085aa3112b02c4a2161e371712ea5ba2cb5

4 years agoAdd Sentinel configuration reading 50/1050/2
Rolf Badorek [Tue, 1 Oct 2019 15:33:58 +0000 (18:33 +0300)]
Add Sentinel configuration reading

Added reading Sentinel configuration from environment variables.

Sentinel address is configured via 'DBAAS_SERVICE_HOST' and
'DBAAS_SERVICE_SENTINEL_PORT' environment variables.

Sentinel master name is configured via 'DBAAS_MASTER_NAME' environment
variable.

Sentinel support is now activated.

Using Sentinel is optional. If Sentinel related environment variables
are not set, then static address for Redis server is used as before
(i.e. this change is backward compatible).

Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
Change-Id: I34031ac56268673996c6fecb00eeed6e5dda8b9a

4 years agoAdd Sentinel change notification handling logic 28/1028/1
Rolf Badorek [Mon, 23 Sep 2019 11:14:56 +0000 (14:14 +0300)]
Add Sentinel change notification handling logic

When new Redis master has been promoted, Sentinel publishes
notification to '+switch-master' channel.

Refer to below web page for further details:
https://redis.io/topics/sentinel

'AsyncSentinelDatabaseDiscovery' will now subscribe notifications for
above mentioned channel. Notification contains information of new Redis
master, which is parsed from message and sent to upper layer via
'StateChangedCb' callback (if callback is set).

When notifications are subscribed from Redis (from Sentinel this case),
connection will go to "subscribed state", and only some pub/sub related
commands are allowed.

Due the above reason, we have two connections (command dispatchers).
One to subscribe notifications and the other for Sentinel commands,
like master inquiry.

Refer to below web page for further details:
https://redis.io/topics/pubsub

In case that subscriber connection goes down, subscription for
notifications is renewed once connection to Sentinel is working again.
Extra master inquiry will be made because we might be missed
notifications during connection cut. Latest master address is refreshed
via 'StateChangedCb', even if has not changed compared to last informed
address. This could be optimized, but as being very rare situation
was not seen worth of extra logic.

In case that the other connection (used for Sentinel commands) is cut,
the related command dispatcher will re-connect in the background.
Possible Sentinel commands during connection cut will fail and trigger
retry after short delay (per already existing implementation).

If some notifications are missed due some other reason than connection
cut, SDL might go to the state that operations will made to Redis slave.
In this situation write operations will fail with a new internal
'AsyncRedisCommandDispatcherErrorCode::WRITING_TO_SLAVE' error code,
which is mapped to 'shareddatalayer::Error::BACKEND_FAILURE'. Recovery
instructions adjusted a bit, so that re-creating SDL API instance is
not optional recovery step (it is the only way to recover from above
mentioned situation currently).

Sentinel support is still disabled, missing implementation will be
added soon as a separate commit(s).

Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
Change-Id: I1bb9e121985ee22278e780e50ab13f88acdc65c5

4 years agoUse boolean expects in unit tests 88/988/1
Rolf Badorek [Fri, 20 Sep 2019 11:20:05 +0000 (14:20 +0300)]
Use boolean expects in unit tests

Certain gcc versions will give (per my understanding false positive)
warning when 'EXPECT_EQ' macro is used so that other argument is
'true' or 'false'.

For example, Ubuntu 16.04 has by default such a gcc version.

See some related discussion below:
https://github.com/google/googletest/issues/322

We have defined all compiler warning to be treated as errors, thus
above issue will lead to compilation error.

Simple fix is to use 'EXPECT_TRUE' or 'EXPECT_FALSE' instead. Those are
more readable, and thus better choice anyway.

Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
Change-Id: Ib0f3841c1b6fe2cf95eac3e4dc0cbcba9c3c8268

4 years agoAdd Redis Sentinel based database discovery 64/964/1
Rolf Badorek [Tue, 17 Sep 2019 13:47:20 +0000 (16:47 +0300)]
Add Redis Sentinel based database discovery

This is first step to support forthcoming Redis HA (Sentinel) DBaaS
deployment.

If sentinel-based database discovery is used (currently still disabled
by configure option), current master is asked from Sentinel.

In case that Sentinel can't be connected, re-try will be triggered
after one second delay. If reply parsing fails, it is considered as
non-recoverable bug and execution is aborted.

Currently, Sentinel address and Redis master name are still hard coded,
will be made configurable in a separate commit soon. Also ordering
change notifications from Sentinel will be implemented separately.

Added new discovery type "SENTINEL" to 'sdltool test-connectivity'
command output.

Refactoring for 'AsyncStorageImpl' class unit tests, so that those will
use database discovery mock implementation. Earlier implementation did
have assumptions for database discovery behavior, which were not
fulfilled any more when sentinel database discovery is used.

Added option to 'AsyncCommandDispatcher' which defines if commands
will be sent to Redis or to Sentinel. In latter case existence checking
for Redis module extension commands is skipped.

Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
Change-Id: Id7507844c9b74115e52d6f8eaf9cb18198c5dc63

4 years agoAdd first version 59/859/5
Rolf Badorek [Tue, 20 Aug 2019 08:17:15 +0000 (11:17 +0300)]
Add first version

First version of C++ SDL API.

Refer README file for instructions how to generate API documentation.

Current version will find database via environment variables, thus RIC
DBaaS service must be up and running before starting the application
pod which uses SDL C++ API.

Change-Id: Ia3c95ac856b293827b680a9f6451a229f69f35f9
Signed-off-by: Rolf Badorek <rolf.badorek@nokia.com>
5 years agoInitial empty repository
Andrew Grimberg [Thu, 21 Mar 2019 23:55:44 +0000 (23:55 +0000)]
Initial empty repository