[MDEV-33169] Alter sequence 2nd ps fails while alter sequence 2nd time (no ps) succeeds Created: 2024-01-03  Updated: 2024-01-09  Resolved: 2024-01-09

Status: Closed
Project: MariaDB Server
Component/s: Sequences
Affects Version/s: 10.4, 11.4
Fix Version/s: 10.4.33, 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3

Type: Bug Priority: Critical
Reporter: Yuchen Pei Assignee: Yuchen Pei
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-33012 Alter sequence with second execution ... Open

 Description   

In the following case, statements 1 and 2 succeed, so is statement 3, but statement 4 fails. It should succeed because 2 succeeds.

11.4 3fad2b115569864d8c1b7ea90ce92aa895cfef08

create sequence s;
/* 1 */ alter sequence s maxvalue 123;
/* 2 */ alter sequence s maxvalue 123;
drop sequence s;
 
create sequence s;
prepare stmt from 'alter sequence s maxvalue 123';
/* 3 */ execute stmt;
/* 4 */ execute stmt;
deallocate prepare stmt;
drop sequence s;

Could also reprod at 10.4 9695974e4b212aa4820e0ccfeb164f5444c0d58e.

The error is

mysqltest: At line 10: query '/* 4 */ execute stmt' failed: 4085: Sequence 'test.s' has out of range value for options



 Comments   
Comment by Yuchen Pei [ 2024-01-04 ]

An initial patch, and it seems to fix MDEV-33012 too Local tests all look good. Waiting for the CI...

61aa9f81a1f upstream/bb-10.4-mdev-33169 MDEV-33169 Reset sequence used fields after check in alter sequence

Comment by Yuchen Pei [ 2024-01-04 ]

Hi sanja, ptal thanks:

bb-10.4-mdev-33169 a7e379d737a3aedbeedf816270527d903bb52b17
MDEV-33169 Reset sequence used fields after check in alter sequence
 
The bitmap is temporarily flipped to ~0 for the sake of checking all
fields. It needs to be restored because it will be reused in second
and subsequent ps execution.

Comment by Oleksandr Byelkin [ 2024-01-04 ]

Please make your editor avoid using <TAB> symbols and fix the patch (your editor things that tab is 2 spaces, by default it is 8 everywhere). That is why we avoid tabs and we are removing existing tabs if change something in that lines

Comment by Yuchen Pei [ 2024-01-04 ]

Thanks for the comment. I've fixed the tabs (no idea why my emacs config of using spaces rather than tabs was overriden in this particular file/buffer), ptal thanks

upstream/bb-10.4-mdev-33169 22e5e69426250a76d5e2c0b54f85bbc3699db021
MDEV-33169 Reset sequence used fields after check in alter sequence
 
The bitmap is temporarily flipped to ~0 for the sake of checking all
fields. It needs to be restored because it will be reused in second
and subsequent ps execution.

Comment by Oleksandr Byelkin [ 2024-01-08 ]

OK to push

Comment by Yuchen Pei [ 2024-01-09 ]

Thanks for the review. Pushed ca276a0f3fcb45ff0abc011e334c700e0c5d4315 to 10.4

Generated at Thu Feb 08 10:36:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.