Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Incorrect, off-spec MP Ext type: caused runtime errors on some platforms.
- Panic in coio test starting from 1.80 Rust.
- Impossible to use procedural macros(like `tarantool::proc`, `tarantool::test`) through reexporting tarantool.
- Error deleting sequence after calling next().

### Deprecated
- tlua::LuaTable::get_or_create_metatable is deprecated now in favor of tlua::LuaTable::metatable.
Expand Down
6 changes: 3 additions & 3 deletions tarantool/src/schema/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use crate::space::{Space, SystemSpace};
pub fn drop_sequence(seq_id: u32) -> Result<(), Error> {
schema::revoke_object_privileges("sequence", seq_id)?;

let sys_sequence: Space = SystemSpace::Sequence.into();
sys_sequence.delete(&(seq_id,))?;

let sys_sequence_data: Space = SystemSpace::SequenceData.into();
sys_sequence_data.delete(&(seq_id,))?;

let sys_sequence: Space = SystemSpace::Sequence.into();
sys_sequence.delete(&(seq_id,))?;

Ok(())
}
5 changes: 5 additions & 0 deletions tarantool/src/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ impl Sequence {
})
}

/// Get sequence id.
pub fn id(&self) -> u32 {
self.seq_id
}

#[allow(clippy::should_implement_trait)]
/// Generate the next value and return it.
///
Expand Down
1 change: 1 addition & 0 deletions tests/run_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ box.once('bootstrap_tests', function()
box.schema.user.grant('test_user', 'read,write,execute,create,drop', 'universe')

box.schema.sequence.create('test_seq')
box.schema.sequence.create('test_drop_seq')

box.schema.func.create('test_stored_proc')
box.schema.func.create('test_schema_update')
Expand Down
8 changes: 8 additions & 0 deletions tests/src/box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,14 @@ pub fn sequence_set() {
assert_eq!(seq.next().unwrap(), 100);
}

pub fn sequence_drop() {
let mut seq = Sequence::find("test_drop_seq").unwrap().unwrap();
assert_eq!(seq.next().unwrap(), 1);

tarantool::schema::sequence::drop_sequence(seq.id()).unwrap();
assert!(Sequence::find("test_drop_seq").unwrap().is_none())
}

pub fn space_create_opt_default() {
let opts = SpaceCreateOptions::default();

Expand Down
1 change: 1 addition & 0 deletions tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ fn run_tests(cfg: TestConfig) -> Result<bool, io::Error> {
r#box::sequence_get_by_name,
r#box::sequence_iterate,
r#box::sequence_set,
r#box::sequence_drop,
r#box::space_create_opt_default,
r#box::space_create_opt_if_not_exists,
r#box::space_create_id_increment,
Expand Down