Module: kamailio
Branch: master
Commit: 5e66ba23851f115bcb88d7e3f71f78ab33fc1e30
URL: https://github.com/kamailio/kamailio/commit/5e66ba23851f115bcb88d7e3f71f78a…
Author: Ostap <ostap_mal(a)hotmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2024-04-28T23:15:28+02:00
modules/statsd: ensure statsd failures do not stop execution (#3819)
* modules/statsd: avoid stopping flow when sending statsd metric fails
Currently statsd functions return bool: `true` or `false` depending when
the function succeeds or fails respectively.
This value gets implicitly converted to `int`: `true` -> `1`, `false` ->
`0`.
For Kamailio `1` means succesfull execution, but `0` means to stop
processing messages, which is not what we want as statsd should not impact
flow execution. Instead we want to return `-1` which signifies error,
but the flow continues.
* modules/statsd: do not fail module initilization when statsd init fails
statsd_init executes `statsd_connect` which tries to connect to statd
server.
If connection fails then kamailio fails to start.
This is not the desired behaviour as:
1. Kamailio should continue working even if statsd server is down,
metrics should not impact runtime.
2. `statsd_connect` is also re-executed each time we try to send the metric https://github.com/salemove/kamailio/blame/master/src/modules/statsd/lib_st…,
so it's initial result is not essential.
Note, that before 5.8 the result of init was already ignored due to
implicit conversion of `false` to `0`
until after
https://github.com/kamailio/kamailio/commit/0186246fce8f0e4bb46b30c05174983…
was introduced (which could be considered a breaking change even if it
seemingly fixes a bug in conversion).
---
Modified: src/modules/statsd/statsd.c
---
Diff: https://github.com/kamailio/kamailio/commit/5e66ba23851f115bcb88d7e3f71f78a…
Patch: https://github.com/kamailio/kamailio/commit/5e66ba23851f115bcb88d7e3f71f78a…
#### Pre-Submission Checklist
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
- add support for configuring the DB root host/port connection parameters separate from the ro/rw settings. This allows the user to authenticate over the specific socket configured (tcp/udp/unix) for each connection type (root/ro/rw).
- note that support is added for mysql and postgresql connections. no changes to the other DB engine connection parameters.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3830
-- Commit Summary --
* utils/kamctl: make root host/port configurable
-- File Changes --
M utils/kamctl/kamctlrc (8)
M utils/kamctl/kamdbctl.base (3)
M utils/kamctl/kamdbctl.mysql (23)
M utils/kamctl/kamdbctl.pgsql (10)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3830.patchhttps://github.com/kamailio/kamailio/pull/3830.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3830
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3830(a)github.com>
Module: kamailio
Branch: master
Commit: de23dc1035e4b885f45bc4150d282c26b294db64
URL: https://github.com/kamailio/kamailio/commit/de23dc1035e4b885f45bc4150d282c2…
Author: Tyler Moore <tmoore(a)goflyball.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-04-28T23:14:16+02:00
utils/kamctl: make root host/port configurable
- add support for configuring the DB root host/port connection
parameters separate from the ro/rw settings. This allows the
user to authenticate over the specific socket configured
(tcp/udp/unix) for each connection type (root/ro/rw).
- note that support is added for mysql and postgresql connections.
no changes to the other DB engine connection parameters.
---
Modified: utils/kamctl/kamctlrc
Modified: utils/kamctl/kamdbctl.base
Modified: utils/kamctl/kamdbctl.mysql
Modified: utils/kamctl/kamdbctl.pgsql
---
Diff: https://github.com/kamailio/kamailio/commit/de23dc1035e4b885f45bc4150d282c2…
Patch: https://github.com/kamailio/kamailio/commit/de23dc1035e4b885f45bc4150d282c2…
---
diff --git a/utils/kamctl/kamctlrc b/utils/kamctl/kamctlrc
index ce0bd9d93bc..67af483d9c6 100644
--- a/utils/kamctl/kamctlrc
+++ b/utils/kamctl/kamctlrc
@@ -44,6 +44,14 @@
## database access host (from where is kamctl used)
# DBACCESSHOST=192.168.0.1
+## database host for super user (useful for specifying a local socket or virtual hostname)
+# defaults to value of DBHOST when not set
+# DBROOTHOST="localhost"
+
+## database port for super user (on some DB specifying the port will force TCP connections)
+# default value will depend on client DB tool
+# DBROOTPORT=""
+
## database super user (for ORACLE this is 'scheme-creator' user)
# DBROOTUSER="root"
diff --git a/utils/kamctl/kamdbctl.base b/utils/kamctl/kamdbctl.base
index 4a3beccaef4..5579c9e8373 100644
--- a/utils/kamctl/kamdbctl.base
+++ b/utils/kamctl/kamdbctl.base
@@ -20,6 +20,9 @@ DBROUSER=${DBROUSER:-kamailioro}
# password for read-only user
DBROPW=${DBROPW:-kamailioro}
+# address of database server for root connections
+DBROOTHOST=${DBROOTHOST:-$DBHOST}
+
# user name column
USERCOL=${USERCOL:-username}
diff --git a/utils/kamctl/kamdbctl.mysql b/utils/kamctl/kamdbctl.mysql
index 81a730bbe65..49915dc7954 100644
--- a/utils/kamctl/kamdbctl.mysql
+++ b/utils/kamctl/kamdbctl.mysql
@@ -27,23 +27,22 @@ fi
# config vars
#################################################################
-# full privileges MySQL user
-if [ -z "$DBROOTUSER" ]; then
- DBROOTUSER="root"
-fi
-
# Set DBROOTPW in kamctlrc or via next line to set the database
# root password if you want to run this script without any user prompt.
# This is unsafe, but useful e.g. for automatic testing.
#DBROOTPW=""
-
-if [ -z "$DBPORT" ] ; then
- CMD="mysql -h $DBHOST -u$DBROOTUSER "
- DUMP_CMD="mysqldump -h $DBHOST -u$DBROOTUSER -c -t "
-else
- CMD="mysql -h $DBHOST -P $DBPORT -u$DBROOTUSER "
- DUMP_CMD="mysqldump -h $DBHOST -P $DBPORT -u$DBROOTUSER -c -t "
+# build the client base commands one param at a time
+# let the client choose defaults where not specified
+CMD="mysql -h $DBROOTHOST"
+DUMP_CMD="mysqldump -c -t -h $DBROOTHOST"
+if [ -n "$DBROOTPORT" ] ; then
+ CMD="$CMD -P $DBROOTPORT"
+ DUMP_CMD="$DUMP_CMD -P $DBROOTPORT"
+fi
+if [ -n "$DBROOTUSER" ]; then
+ CMD="$CMD -u $DBROOTUSER"
+ DUMP_CMD="mysqldump -u $DBROOTUSER"
fi
#################################################################
diff --git a/utils/kamctl/kamdbctl.pgsql b/utils/kamctl/kamdbctl.pgsql
index 1eb5d88d2b8..3b46c04294f 100644
--- a/utils/kamctl/kamdbctl.pgsql
+++ b/utils/kamctl/kamdbctl.pgsql
@@ -51,12 +51,12 @@ if [ -z "$DBROOTUSER" ]; then
fi
fi
-if [ -z "$DBPORT" ] ; then
- CMD="psql -q -h $DBHOST -U $DBROOTUSER "
- DUMP_CMD="pg_dump -h $DBHOST -U $DBROOTUSER -c"
+if [ -z "$DBROOTPORT" ] ; then
+ CMD="psql -q -h $DBROOTHOST -U $DBROOTUSER "
+ DUMP_CMD="pg_dump -h $DBROOTHOST -U $DBROOTUSER -c"
else
- CMD="psql -q -h $DBHOST -p $DBPORT -U $DBROOTUSER "
- DUMP_CMD="pg_dump -h $DBHOST -p $DBPORT -U $DBROOTUSER -c"
+ CMD="psql -q -h $DBROOTHOST -p $DBROOTPORT -U $DBROOTUSER "
+ DUMP_CMD="pg_dump -h $DBROOTHOST -p $DBROOTPORT -U $DBROOTUSER -c"
fi
#################################################################
- add natnum property, containing the nationally formatted number, to pv
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/3820
-- Commit Summary --
* phonenum: add national number
-- File Changes --
M src/modules/phonenum/cphonenumber.cpp (12)
M src/modules/phonenum/cphonenumber.h (1)
M src/modules/phonenum/doc/phonenum_admin.xml (5)
M src/modules/phonenum/phonenum_pv.c (6)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/3820.patchhttps://github.com/kamailio/kamailio/pull/3820.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/3820
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/pull/3820(a)github.com>