Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] cfg: fix format in error message
@ 2020-12-26 21:38 Cyrill Gorcunov
  2020-12-26 22:00 ` Cyrill Gorcunov
  2020-12-28 11:03 ` Kirill Yukhin
  0 siblings, 2 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2020-12-26 21:38 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

Coverity pointed that quorum value is int64_t
wide and could be trimmed in error message. Fix
it using proper formatting.

CID 1500388
Part-of #5446

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
branch gorcunov/gh-5446-fixup
for 2.6 and 2.5

 src/box/box.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/box/box.cc b/src/box/box.cc
index e1d8305c8..3c5873e3c 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -623,10 +623,10 @@ box_eval_replication_synchro_quorum(int nr_replicas)
 	if (quorum <= 0 || quorum >= VCLOCK_MAX) {
 		const char *msg =
 			tt_sprintf("the formula is evaluated "
-				   "to the quorum %d for replica "
+				   "to the quorum %lld for replica "
 				   "number %d, which is out of range "
-				   "[%d;%d]",
-				   quorum, nr_replicas, 1, VCLOCK_MAX - 1);
+				   "[%d;%d]", (long long)quorum,
+				   nr_replicas, 1, VCLOCK_MAX - 1);
 		diag_set(ClientError, ER_CFG,
 			 "replication_synchro_quorum", msg);
 		return -1;
-- 
2.26.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH] cfg: fix format in error message
  2020-12-26 21:38 [Tarantool-patches] [PATCH] cfg: fix format in error message Cyrill Gorcunov
@ 2020-12-26 22:00 ` Cyrill Gorcunov
  2020-12-28  7:47   ` Alexander V. Tikhonov
  2020-12-28 11:03 ` Kirill Yukhin
  1 sibling, 1 reply; 5+ messages in thread
From: Cyrill Gorcunov @ 2020-12-26 22:00 UTC (permalink / raw)
  To: tml; +Cc: Vladislav Shpilevoy

On Sun, Dec 27, 2020 at 12:38:09AM +0300, Cyrill Gorcunov wrote:
> Coverity pointed that quorum value is int64_t
> wide and could be trimmed in error message. Fix
> it using proper formatting.

Forgot to update the tests. Force pushed
---
Coverity pointed that quorum value is int64_t
and could be trimmed in error message. Fix it
using a proper formatting.

CID 1500388
Part-of #5446

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
 src/box/box.cc                                    | 6 +++---
 test/replication/gh-5446-qsync-eval-quorum.result | 6 ++++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/box/box.cc b/src/box/box.cc
index e1d8305c8..3c5873e3c 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -623,10 +623,10 @@ box_eval_replication_synchro_quorum(int nr_replicas)
 	if (quorum <= 0 || quorum >= VCLOCK_MAX) {
 		const char *msg =
 			tt_sprintf("the formula is evaluated "
-				   "to the quorum %d for replica "
+				   "to the quorum %lld for replica "
 				   "number %d, which is out of range "
-				   "[%d;%d]",
-				   quorum, nr_replicas, 1, VCLOCK_MAX - 1);
+				   "[%d;%d]", (long long)quorum,
+				   nr_replicas, 1, VCLOCK_MAX - 1);
 		diag_set(ClientError, ER_CFG,
 			 "replication_synchro_quorum", msg);
 		return -1;
diff --git a/test/replication/gh-5446-qsync-eval-quorum.result b/test/replication/gh-5446-qsync-eval-quorum.result
index f33b20a8e..1d13f26db 100644
--- a/test/replication/gh-5446-qsync-eval-quorum.result
+++ b/test/replication/gh-5446-qsync-eval-quorum.result
@@ -41,12 +41,14 @@ box.cfg{replication_synchro_quorum = "N-1"}
 box.cfg{replication_synchro_quorum = '4294967296 + 1'}
  | ---
  | - error: 'Incorrect value for option ''replication_synchro_quorum'': the formula is
- |     evaluated to the quorum 1 for replica number 1, which is out of range [1;31]'
+ |     evaluated to the quorum 4294967297 for replica number 1, which is out of range
+ |     [1;31]'
  | ...
 box.cfg{replication_synchro_quorum = 'N + 4294967296'}
  | ---
  | - error: 'Incorrect value for option ''replication_synchro_quorum'': the formula is
- |     evaluated to the quorum 1 for replica number 1, which is out of range [1;31]'
+ |     evaluated to the quorum 4294967297 for replica number 1, which is out of range
+ |     [1;31]'
  | ...
 box.cfg{replication_synchro_quorum = 4294967297}
  | ---
-- 
2.26.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH] cfg: fix format in error message
  2020-12-26 22:00 ` Cyrill Gorcunov
@ 2020-12-28  7:47   ` Alexander V. Tikhonov
  2020-12-28  7:53     ` Cyrill Gorcunov
  0 siblings, 1 reply; 5+ messages in thread
From: Alexander V. Tikhonov @ 2020-12-28  7:47 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tarantool-patches

Hi Cyrill, thanks for the patch, as I see no new degradation found in
gitlab-ci testing commit criteria pipeline [1], patch LGTM.

[1] - https://gitlab.com/tarantool/tarantool/-/pipelines/234670684
p.s. failed test 'engine_long/delete_replace_update.test.lua' fixed
with timeout increase in one of the latest commit in trunk.

On Sun, Dec 27, 2020 at 01:00:00AM +0300, Cyrill Gorcunov via Tarantool-patches wrote:
> On Sun, Dec 27, 2020 at 12:38:09AM +0300, Cyrill Gorcunov wrote:
> > Coverity pointed that quorum value is int64_t
> > wide and could be trimmed in error message. Fix
> > it using proper formatting.
> 
> Forgot to update the tests. Force pushed
> ---
> Coverity pointed that quorum value is int64_t
> and could be trimmed in error message. Fix it
> using a proper formatting.
> 
> CID 1500388
> Part-of #5446
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
>  src/box/box.cc                                    | 6 +++---
>  test/replication/gh-5446-qsync-eval-quorum.result | 6 ++++--
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/src/box/box.cc b/src/box/box.cc
> index e1d8305c8..3c5873e3c 100644
> --- a/src/box/box.cc
> +++ b/src/box/box.cc
> @@ -623,10 +623,10 @@ box_eval_replication_synchro_quorum(int nr_replicas)
>  	if (quorum <= 0 || quorum >= VCLOCK_MAX) {
>  		const char *msg =
>  			tt_sprintf("the formula is evaluated "
> -				   "to the quorum %d for replica "
> +				   "to the quorum %lld for replica "
>  				   "number %d, which is out of range "
> -				   "[%d;%d]",
> -				   quorum, nr_replicas, 1, VCLOCK_MAX - 1);
> +				   "[%d;%d]", (long long)quorum,
> +				   nr_replicas, 1, VCLOCK_MAX - 1);
>  		diag_set(ClientError, ER_CFG,
>  			 "replication_synchro_quorum", msg);
>  		return -1;
> diff --git a/test/replication/gh-5446-qsync-eval-quorum.result b/test/replication/gh-5446-qsync-eval-quorum.result
> index f33b20a8e..1d13f26db 100644
> --- a/test/replication/gh-5446-qsync-eval-quorum.result
> +++ b/test/replication/gh-5446-qsync-eval-quorum.result
> @@ -41,12 +41,14 @@ box.cfg{replication_synchro_quorum = "N-1"}
>  box.cfg{replication_synchro_quorum = '4294967296 + 1'}
>   | ---
>   | - error: 'Incorrect value for option ''replication_synchro_quorum'': the formula is
> - |     evaluated to the quorum 1 for replica number 1, which is out of range [1;31]'
> + |     evaluated to the quorum 4294967297 for replica number 1, which is out of range
> + |     [1;31]'
>   | ...
>  box.cfg{replication_synchro_quorum = 'N + 4294967296'}
>   | ---
>   | - error: 'Incorrect value for option ''replication_synchro_quorum'': the formula is
> - |     evaluated to the quorum 1 for replica number 1, which is out of range [1;31]'
> + |     evaluated to the quorum 4294967297 for replica number 1, which is out of range
> + |     [1;31]'
>   | ...
>  box.cfg{replication_synchro_quorum = 4294967297}
>   | ---
> -- 
> 2.26.2
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH] cfg: fix format in error message
  2020-12-28  7:47   ` Alexander V. Tikhonov
@ 2020-12-28  7:53     ` Cyrill Gorcunov
  0 siblings, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2020-12-28  7:53 UTC (permalink / raw)
  To: Alexander V. Tikhonov; +Cc: tarantool-patches

On Mon, Dec 28, 2020 at 10:47:44AM +0300, Alexander V. Tikhonov wrote:
> Hi Cyrill, thanks for the patch, as I see no new degradation found in
> gitlab-ci testing commit criteria pipeline [1], patch LGTM.
> 
> [1] - https://gitlab.com/tarantool/tarantool/-/pipelines/234670684
> p.s. failed test 'engine_long/delete_replace_update.test.lua' fixed
> with timeout increase in one of the latest commit in trunk.
>

Thanks! Kirill, merge it please. 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Tarantool-patches] [PATCH] cfg: fix format in error message
  2020-12-26 21:38 [Tarantool-patches] [PATCH] cfg: fix format in error message Cyrill Gorcunov
  2020-12-26 22:00 ` Cyrill Gorcunov
@ 2020-12-28 11:03 ` Kirill Yukhin
  1 sibling, 0 replies; 5+ messages in thread
From: Kirill Yukhin @ 2020-12-28 11:03 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: tml, Vladislav Shpilevoy

Hello,

On 27 Dec 00:38, Cyrill Gorcunov wrote:
> Coverity pointed that quorum value is int64_t
> wide and could be trimmed in error message. Fix
> it using proper formatting.
> 
> CID 1500388
> Part-of #5446
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
> branch gorcunov/gh-5446-fixup
> for 2.6 and 2.5

I've checked your patch into 2.5, 2.6 and master as obvious.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-28 11:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-26 21:38 [Tarantool-patches] [PATCH] cfg: fix format in error message Cyrill Gorcunov
2020-12-26 22:00 ` Cyrill Gorcunov
2020-12-28  7:47   ` Alexander V. Tikhonov
2020-12-28  7:53     ` Cyrill Gorcunov
2020-12-28 11:03 ` Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox