Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] sequence: return correct error on using dropped sequence
@ 2020-02-26 16:13 Chris Sosnin
  2020-02-29 15:43 ` Vladislav Shpilevoy
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Sosnin @ 2020-02-26 16:13 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

This code is called from C, so it shouldn't throw.

Closes #4753
---
branch: https://github.com/tarantool/tarantool/tree/ksosnin/gh-4753-sequence-cpp-exception 
issue: https://github.com/tarantool/tarantool/issues/4753

 src/box/schema.cc          |  2 +-
 test/box/sequence.result   | 17 +++++++++++++++++
 test/box/sequence.test.lua |  8 ++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/box/schema.cc b/src/box/schema.cc
index fab7544f2..456eef429 100644
--- a/src/box/schema.cc
+++ b/src/box/schema.cc
@@ -646,7 +646,7 @@ sequence_cache_find(uint32_t id)
 {
 	struct sequence *seq = sequence_by_id(id);
 	if (seq == NULL)
-		tnt_raise(ClientError, ER_NO_SUCH_SEQUENCE, int2str(id));
+		diag_set(ClientError, ER_NO_SUCH_SEQUENCE, int2str(id));
 	return seq;
 }
 
diff --git a/test/box/sequence.result b/test/box/sequence.result
index 0a6cfee2c..32a094d6f 100644
--- a/test/box/sequence.result
+++ b/test/box/sequence.result
@@ -2102,6 +2102,23 @@ s:drop()
 ---
 ...
 --
+-- gh-4753: accessing dropped sequence should yield correct error
+--
+s = box.schema.sequence.create('s')
+---
+...
+s:drop()
+---
+...
+s:next()
+---
+- error: Sequence '1' does not exist
+...
+s:reset()
+---
+- error: Sequence '1' does not exist
+...
+--
 -- Check that altering parts of a primary index with a sequence
 -- attached requires sequence update. Renaming fields does not.
 --
diff --git a/test/box/sequence.test.lua b/test/box/sequence.test.lua
index 8e00571e5..d8a212fab 100644
--- a/test/box/sequence.test.lua
+++ b/test/box/sequence.test.lua
@@ -710,6 +710,14 @@ s.index.pk:alter{sequence = {field = 'x.a.b[1]'}}
 s:replace{{a = {b = {box.NULL}}}} -- ok
 s:drop()
 
+--
+-- gh-4753: accessing dropped sequence should yield correct error
+--
+s = box.schema.sequence.create('s')
+s:drop()
+s:next()
+s:reset()
+
 --
 -- Check that altering parts of a primary index with a sequence
 -- attached requires sequence update. Renaming fields does not.
-- 
2.21.1 (Apple Git-122.3)

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

* Re: [Tarantool-patches] [PATCH] sequence: return correct error on using dropped sequence
  2020-02-26 16:13 [Tarantool-patches] [PATCH] sequence: return correct error on using dropped sequence Chris Sosnin
@ 2020-02-29 15:43 ` Vladislav Shpilevoy
  2020-03-02 10:59   ` Nikita Pettik
  2020-03-16 13:43   ` Nikita Pettik
  0 siblings, 2 replies; 5+ messages in thread
From: Vladislav Shpilevoy @ 2020-02-29 15:43 UTC (permalink / raw)
  To: Chris Sosnin, tarantool-patches, Kirill Yukhin

LGTM.

On 26/02/2020 17:13, Chris Sosnin wrote:
> This code is called from C, so it shouldn't throw.
> 
> Closes #4753
> ---
> branch: https://github.com/tarantool/tarantool/tree/ksosnin/gh-4753-sequence-cpp-exception 
> issue: https://github.com/tarantool/tarantool/issues/4753
> 
>  src/box/schema.cc          |  2 +-
>  test/box/sequence.result   | 17 +++++++++++++++++
>  test/box/sequence.test.lua |  8 ++++++++
>  3 files changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/src/box/schema.cc b/src/box/schema.cc
> index fab7544f2..456eef429 100644
> --- a/src/box/schema.cc
> +++ b/src/box/schema.cc
> @@ -646,7 +646,7 @@ sequence_cache_find(uint32_t id)
>  {
>  	struct sequence *seq = sequence_by_id(id);
>  	if (seq == NULL)
> -		tnt_raise(ClientError, ER_NO_SUCH_SEQUENCE, int2str(id));
> +		diag_set(ClientError, ER_NO_SUCH_SEQUENCE, int2str(id));
>  	return seq;
>  }
>  
> diff --git a/test/box/sequence.result b/test/box/sequence.result
> index 0a6cfee2c..32a094d6f 100644
> --- a/test/box/sequence.result
> +++ b/test/box/sequence.result
> @@ -2102,6 +2102,23 @@ s:drop()
>  ---
>  ...
>  --
> +-- gh-4753: accessing dropped sequence should yield correct error
> +--
> +s = box.schema.sequence.create('s')
> +---
> +...
> +s:drop()
> +---
> +...
> +s:next()
> +---
> +- error: Sequence '1' does not exist
> +...
> +s:reset()
> +---
> +- error: Sequence '1' does not exist
> +...
> +--
>  -- Check that altering parts of a primary index with a sequence
>  -- attached requires sequence update. Renaming fields does not.
>  --
> diff --git a/test/box/sequence.test.lua b/test/box/sequence.test.lua
> index 8e00571e5..d8a212fab 100644
> --- a/test/box/sequence.test.lua
> +++ b/test/box/sequence.test.lua
> @@ -710,6 +710,14 @@ s.index.pk:alter{sequence = {field = 'x.a.b[1]'}}
>  s:replace{{a = {b = {box.NULL}}}} -- ok
>  s:drop()
>  
> +--
> +-- gh-4753: accessing dropped sequence should yield correct error
> +--
> +s = box.schema.sequence.create('s')
> +s:drop()
> +s:next()
> +s:reset()
> +
>  --
>  -- Check that altering parts of a primary index with a sequence
>  -- attached requires sequence update. Renaming fields does not.
> 

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

* Re: [Tarantool-patches] [PATCH] sequence: return correct error on using dropped sequence
  2020-02-29 15:43 ` Vladislav Shpilevoy
@ 2020-03-02 10:59   ` Nikita Pettik
  2020-03-02 15:25     ` Chris Sosnin
  2020-03-16 13:43   ` Nikita Pettik
  1 sibling, 1 reply; 5+ messages in thread
From: Nikita Pettik @ 2020-03-02 10:59 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

On 29 Feb 16:43, Vladislav Shpilevoy wrote:
> LGTM.
> 
> On 26/02/2020 17:13, Chris Sosnin wrote:
> > This code is called from C, so it shouldn't throw.
> > 
> > Closes #4753
> > ---
> > branch: https://github.com/tarantool/tarantool/tree/ksosnin/gh-4753-sequence-cpp-exception 
> > issue: https://github.com/tarantool/tarantool/issues/4753
> >

Patch LGTM as well, but I see that 3 out of 4 runs on travis result in fail:

https://travis-ci.org/tarantool/tarantool/builds/655369924?utm_source=github_status&utm_medium=notification

Are these known failures (box/access etc)?
 

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

* Re: [Tarantool-patches] [PATCH] sequence: return correct error on using dropped sequence
  2020-03-02 10:59   ` Nikita Pettik
@ 2020-03-02 15:25     ` Chris Sosnin
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Sosnin @ 2020-03-02 15:25 UTC (permalink / raw)
  To: Nikita Pettik; +Cc: tarantool-patches

Hi! Thank you for the review!

> 2 марта 2020 г., в 13:59, Nikita Pettik <korablev@tarantool.org> написал(а):
> 
> On 29 Feb 16:43, Vladislav Shpilevoy wrote:
>> LGTM.
>> 
>> On 26/02/2020 17:13, Chris Sosnin wrote:
>>> This code is called from C, so it shouldn't throw.
>>> 
>>> Closes #4753
>>> ---
>>> branch: https://github.com/tarantool/tarantool/tree/ksosnin/gh-4753-sequence-cpp-exception 
>>> issue: https://github.com/tarantool/tarantool/issues/4753
>>> 
> 
> Patch LGTM as well, but I see that 3 out of 4 runs on travis result in fail:
> 
> https://travis-ci.org/tarantool/tarantool/builds/655369924?utm_source=github_status&utm_medium=notification
> 
> Are these known failures (box/access etc)?
> 

I didn’t rebase the patch, I’m sorry.
This branch doesn’t have the fix for Masha’s patch, where credentials for user weren’t dropped at the and of the test.
Will fix it.

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

* Re: [Tarantool-patches] [PATCH] sequence: return correct error on using dropped sequence
  2020-02-29 15:43 ` Vladislav Shpilevoy
  2020-03-02 10:59   ` Nikita Pettik
@ 2020-03-16 13:43   ` Nikita Pettik
  1 sibling, 0 replies; 5+ messages in thread
From: Nikita Pettik @ 2020-03-16 13:43 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

On 29 Feb 16:43, Vladislav Shpilevoy wrote:
> LGTM.

Pushed to master, 2.3 and 2.2. Updated changelogs correspondingly.
 

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

end of thread, other threads:[~2020-03-16 13:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 16:13 [Tarantool-patches] [PATCH] sequence: return correct error on using dropped sequence Chris Sosnin
2020-02-29 15:43 ` Vladislav Shpilevoy
2020-03-02 10:59   ` Nikita Pettik
2020-03-02 15:25     ` Chris Sosnin
2020-03-16 13:43   ` Nikita Pettik

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