Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add possiblity to set is_sync=true in box.begin to enforce transaction to be synchronous #8650

Closed
ochaton opened this issue May 12, 2023 · 0 comments · Fixed by #8907
Assignees
Labels
feature A new functionality

Comments

@ochaton
Copy link
Member

ochaton commented May 12, 2023

Now we have is_sync-spaces, but most general use of Tarantool is still asynchronous spaces. Some operations with asynchronous spaces better be synchronous (ex. queue:put{ ... } or insert of some new data).

Only developer knows when to make this specific transaction synchronous. Now we only can :put{} with wait_lsn or box.atomic with update of garbage synchronous space, that looks odd.

It would be better, if we could write box.begin{is_sync=true} ... box.commit() and box.sync_atomic when we want to make this specific transaction to be synchronous. Of course, this means that replicaset must be configured in full-mesh topology, and instance must be the synchronous queue owner.

@ochaton ochaton added the feature A new functionality label May 12, 2023
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Jul 24, 2023
Added a new parameter `is_sync` to `box.begin()`, `box.commit()` and
`box.atomic`. Thanks to this parameter can make the transaction
synchronous. To do this set `is_sync = true`. `box.commit()` cannot change
`is_sync` to `false` if the transaction was opened as synchronous or has
writes to synchro spaces. By default, `is_sync = false`.
Examples:
```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = false})

box.begin({is_sync = false}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit({is_sync = true})

-- Async transactions
box.atomic({is_sync = false}, function() ... end)

box.begin({is_sync = false}) ... box.commit({is_sync = false})

box.begin() ... box.commit()

```

Closes tarantool#8650

NO_DOC=internal
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Jul 31, 2023
Added the new `is_sync` parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. `box.commit()` can't change `is_sync` to `false` if
the transaction was opened as synchronous or has writes to synchronous
spaces. By default, `is_sync = false`.
Examples:
```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = false})

box.begin({is_sync = false}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit({is_sync = true})

-- Async transactions
box.atomic({is_sync = false}, function() ... end)

box.begin({is_sync = false}) ... box.commit({is_sync = false})

box.begin() ... box.commit()

```

Closes tarantool#8650

NO_DOC=internal
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Jul 31, 2023
Added the new `is_sync` parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. `box.commit()` can't change `is_sync` to `false` if
the transaction was opened as synchronous or has writes to synchronous
spaces. By default, `is_sync = false`.
Examples:
```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = false})

box.begin({is_sync = false}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit({is_sync = true})

-- Async transactions
box.atomic({is_sync = false}, function() ... end)

box.begin({is_sync = false}) ... box.commit({is_sync = false})

box.begin() ... box.commit()

```

Closes tarantool#8650

NO_DOC=internal
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Jul 31, 2023
Added the new `is_sync` parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. `box.commit()` can't change `is_sync` to `false` if
the transaction was opened as synchronous or has writes to synchronous
spaces. By default, `is_sync = false`.
Examples:
```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = false})

box.begin({is_sync = false}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit({is_sync = true})

-- Async transactions
box.atomic({is_sync = false}, function() ... end)

box.begin({is_sync = false}) ... box.commit({is_sync = false})

box.begin() ... box.commit()

```

Closes tarantool#8650

NO_DOC=internal
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Jul 31, 2023
Added the new `is_sync` parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. `box.commit()` can't change `is_sync` to `false` if
the transaction was opened as synchronous or has writes to synchronous
spaces. By default, `is_sync = false`.
Examples:
```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = false})

box.begin({is_sync = false}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit({is_sync = true})

-- Async transactions
box.atomic({is_sync = false}, function() ... end)

box.begin({is_sync = false}) ... box.commit({is_sync = false})

box.begin() ... box.commit()

```

Closes tarantool#8650

NO_DOC=internal
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Sep 7, 2023
Added the new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If to set any value other than `true/nil`, for example
`is_sync = "some string"`, then an error will be thrown. Examples:
```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()

```

Closes tarantool#8650

NO_DOC=internal
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Sep 26, 2023
Added the new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If to set any value other than `true/nil`, for example
`is_sync = "some string"`, then an error will be thrown.

Example:

```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()
```

Closes tarantool#8650

@TarantoolBot document
Title: box.atomic({is_sync = true})

Added the new `is_sync` parameter to `box.atomic()`. To make the
transaction synchronous, set the `is_sync` option to `true`. Setting
`is_sync = false` is prohibited. If to set any value other than true
for example `is_sync = "some string"`, then an error will be thrown.
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Oct 4, 2023
Added the new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If to set any value other than `true/nil`, for example
`is_sync = "some string"`, then an error will be thrown.

Example:

```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()
```

Closes tarantool#8650

@TarantoolBot document
Title: box.atomic({is_sync = true})

Added the new `is_sync` parameter to `box.atomic()`. To make the
transaction synchronous, set the `is_sync` option to `true`. Setting
`is_sync = false` is prohibited. If to set any value other than true
for example `is_sync = "some string"`, then an error will be thrown.
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Oct 11, 2023
Added the new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If to set any value other than `true/nil`, for example
`is_sync = "some string"`, then an error will be thrown.

Example:

```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()
```

Closes tarantool#8650

@TarantoolBot document
Title: box.atomic({is_sync = true})

Added the new `is_sync` parameter to `box.atomic()`. To make the
transaction synchronous, set the `is_sync` option to `true`. Setting
`is_sync = false` is prohibited. If to set any value other than true
for example `is_sync = "some string"`, then an error will be thrown.
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Oct 11, 2023
Added the new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If to set any value other than `true/nil`, for example
`is_sync = "some string"`, then an error will be thrown.

Example:

```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()
```

Closes tarantool#8650

@TarantoolBot document
Title: box.atomic({is_sync = true})

Added the new `is_sync` parameter to `box.atomic()`. To make the
transaction synchronous, set the `is_sync` option to `true`. Setting
`is_sync = false` is prohibited. If to set any value other than true
for example `is_sync = "some string"`, then an error will be thrown.
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Oct 18, 2023
Added the new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If to set any value other than `true/nil`, for example
`is_sync = "some string"`, then an error will be thrown.

Example:

```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()
```

Closes tarantool#8650

@TarantoolBot document
Title: box.atomic({is_sync = true})

Added the new `is_sync` parameter to `box.atomic()`. To make the
transaction synchronous, set the `is_sync` option to `true`. Setting
`is_sync = false` is prohibited. If to set any value other than true
for example `is_sync = "some string"`, then an error will be thrown.
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Nov 2, 2023
Added the new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If to set any value other than `true/nil`, for example
`is_sync = "some string"`, then an error will be thrown.

Example:

```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()
```

Closes tarantool#8650

@TarantoolBot document
Title: box.atomic({is_sync = true})

Added the new `is_sync` parameter to `box.atomic()`. To make the
transaction synchronous, set the `is_sync` option to `true`. Setting
`is_sync = false` is prohibited. If to set any value other than true
for example `is_sync = "some string"`, then an error will be thrown.
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Nov 8, 2023
Added the new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If to set any value other than `true/nil`, for example
`is_sync = "some string"`, then an error will be thrown.

Example:

```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()
```

Closes tarantool#8650

@TarantoolBot document
Title: box.atomic({is_sync = true})

Added the new `is_sync` parameter to `box.atomic()`. To make the
transaction synchronous, set the `is_sync` option to `true`. Setting
`is_sync = false` is prohibited. If to set any value other than true
for example `is_sync = "some string"`, then an error will be thrown.
yanshtunder added a commit to yanshtunder/tarantool that referenced this issue Nov 20, 2023
Added a new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If any value other than `true/nil` is set, for example
`is_sync = "some string"`, then an error will be thrown.

Example:

```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()
```

Closes tarantool#8650

@TarantoolBot document
Title: box.atomic({is_sync = true})

Added the new `is_sync` parameter to `box.atomic()`. To make the
transaction synchronous, set the `is_sync` option to `true`. Setting
`is_sync = false` is prohibited. If to set any value other than true
for example `is_sync = "some string"`, then an error will be thrown.
sergepetrenko pushed a commit that referenced this issue Nov 29, 2023
Added a new is_sync parameter to `box.begin()`, `box.commit()`, and
`box.atomic()`. To make the transaction synchronous, set the `is_sync`
option to `true`. If any value other than `true/nil` is set, for example
`is_sync = "some string"`, then an error will be thrown.

Example:

```Lua
-- Sync transactions
box.atomic({is_sync = true}, function() ... end)

box.begin({is_sync = true}) ... box.commit({is_sync = true})

box.begin({is_sync = true}) ... box.commit()

box.begin() ... box.commit({is_sync = true})

-- Async transactions
box.atomic(function() ... end)

box.begin() ... box.commit()
```

Closes #8650

@TarantoolBot document
Title: box.atomic({is_sync = true})

Added the new `is_sync` parameter to `box.atomic()`. To make the
transaction synchronous, set the `is_sync` option to `true`. Setting
`is_sync = false` is prohibited. If to set any value other than true
for example `is_sync = "some string"`, then an error will be thrown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants