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

DDL for temporary and local spaces should not be replicated #4263

Closed
R-omk opened this issue May 31, 2019 · 1 comment
Closed

DDL for temporary and local spaces should not be replicated #4263

R-omk opened this issue May 31, 2019 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@R-omk
Copy link

R-omk commented May 31, 2019

Tarantool version:
2.2.0-343-gd07e3ac2f

When I perform truncate on temporary (and is_local) spaces, it is performed on all replicas.

engine = 'memtx',
is_local = true,
temporary = true,
@kyukhin kyukhin added the bug Something isn't working label Jun 4, 2019
@kyukhin kyukhin added this to the 2.1.3 milestone Jun 4, 2019
@GeorgyKirichenko
Copy link
Contributor

As truncate is used as fast shortcut for "table delete all" it should not be replicated across a cluster. Any other operation such as create/modify/drop should continue their working as before.

stanztt added a commit that referenced this issue Jun 19, 2019
Checks the flags of the affected space and marks the WAL record
as local if the affected space is_local and temporary.

Closes #4263
stanztt added a commit that referenced this issue Jun 19, 2019
Checks the flags of the affected space and marks the WAL record
as local if the affected space is_local and temporary.

Closes #4263
stanztt added a commit that referenced this issue Jun 19, 2019
Do not spread the space:truncate() to replicas if the
affected space is local and temporary.

Closes #4263
stanztt added a commit that referenced this issue Jun 20, 2019
Do not spread the space:truncate() to replicas if the
affected space is local and temporary.

Closes #4263
stanztt added a commit that referenced this issue Jun 20, 2019
Do not spread the space:truncate() to replicas if the
affected space is local or temporary.

Closes #4263
stanztt added a commit that referenced this issue Jun 20, 2019
Do not spread the space:truncate() to replicas if the
affected space is local or temporary.

Closes #4263
stanztt added a commit that referenced this issue Jun 24, 2019
Do not spread the space:truncate() to replicas if the
affected space is local or temporary.

Closes #4263
@locker locker closed this as completed in 564ba89 Jun 25, 2019
locker pushed a commit that referenced this issue Jun 25, 2019
Do not spread the space:truncate() to replicas if the
affected space is local or temporary.

Closes #4263

(cherry picked from commit 564ba89)
locker added a commit to locker/tarantool that referenced this issue Jul 14, 2023
To achieve that, we bypass the read-only check for the _truncate system
space in box_process1() and perform it in the on_replace system trigger
instead, when we know which space is truncated.

Closes tarantool#5616

@TarantoolBot document
Title: Mention that temp and local spaces can be truncated in ro mode

DML operations on temporary and local spaces can be performed even if
the instance is in the read-only mode, but DDL operations (such as
`alter`) are forbidden in this case [1]. Technically, `truncate` is
a DDL operation so initially it was forbidden as well. However, it
should be safe to perform this operation on a temporary or local space
because logically it only modifies the data stored in the space (like
DML) and it isn't replicated (see tarantool#4263). So starting
from Tarantool 3.0 we allow users to truncate temporary spaces in the
read-only mode.

[1]: https://www.tarantool.io/en/doc/latest/concepts/replication/repl_architecture/#replication-local
locker added a commit to locker/tarantool that referenced this issue Jul 14, 2023
To achieve that, we bypass the read-only check for the _truncate system
space in box_process1() and perform it in the on_replace system trigger
instead, when we know which space is truncated.

Closes tarantool#5616

@TarantoolBot document
Title: Mention that temp and local spaces can be truncated in ro mode

DML operations on temporary and local spaces can be performed even if
the instance is in the read-only mode, but DDL operations (such as
`alter`) are forbidden in this case[^1]. Technically, `truncate` is
a DDL operation so initially it was forbidden as well. However, it
should be safe to perform this operation on a temporary or local space
because logically it only modifies the data stored in the space (like
DML) and it isn't replicated (see tarantool#4263). So starting
from Tarantool 3.0 we allow users to truncate temporary spaces in the
read-only mode.

[^1]: https://www.tarantool.io/en/doc/latest/concepts/replication/repl_architecture/#replication-local
locker added a commit to locker/tarantool that referenced this issue Jul 14, 2023
To achieve that, we bypass the read-only check for the _truncate system
space in box_process1() and perform it in the on_replace system trigger
instead, when we know which space is truncated.

Note, we have to move the check for insertion of a new record into the
_truncate system space before the read-only check in the on_replace
trigger callback; this is needed for initial recovery with a non-empty
_truncate space to work. While we are at it, let's use recovery_state to
make the check explicit.

Closes tarantool#5616

@TarantoolBot document
Title: Mention that temp and local spaces can be truncated in ro mode

DML operations on temporary and local spaces can be performed even if
the instance is in the read-only mode, but DDL operations (such as
`alter`) are forbidden in this case[^1]. Technically, `truncate` is
a DDL operation so initially it was forbidden as well. However, it
should be safe to perform this operation on a temporary or local space
because logically it only modifies the data stored in the space (like
DML) and it isn't replicated (see tarantool#4263). So starting
from Tarantool 2.11.1 we allow users to truncate temporary spaces in the
read-only mode.

[^1]: https://www.tarantool.io/en/doc/latest/concepts/replication/repl_architecture/#replication-local
locker added a commit that referenced this issue Jul 14, 2023
To achieve that, we bypass the read-only check for the _truncate system
space in box_process1() and perform it in the on_replace system trigger
instead, when we know which space is truncated.

Note, we have to move the check for insertion of a new record into the
_truncate system space before the read-only check in the on_replace
trigger callback; this is needed for initial recovery with a non-empty
_truncate space to work. While we are at it, let's use recovery_state to
make the check explicit.

Closes #5616

@TarantoolBot document
Title: Mention that temp and local spaces can be truncated in ro mode

DML operations on temporary and local spaces can be performed even if
the instance is in the read-only mode, but DDL operations (such as
`alter`) are forbidden in this case[^1]. Technically, `truncate` is
a DDL operation so initially it was forbidden as well. However, it
should be safe to perform this operation on a temporary or local space
because logically it only modifies the data stored in the space (like
DML) and it isn't replicated (see #4263). So starting
from Tarantool 2.11.1 we allow users to truncate temporary spaces in the
read-only mode.

[^1]: https://www.tarantool.io/en/doc/latest/concepts/replication/repl_architecture/#replication-local
locker added a commit that referenced this issue Jul 14, 2023
To achieve that, we bypass the read-only check for the _truncate system
space in box_process1() and perform it in the on_replace system trigger
instead, when we know which space is truncated.

Note, we have to move the check for insertion of a new record into the
_truncate system space before the read-only check in the on_replace
trigger callback; this is needed for initial recovery with a non-empty
_truncate space to work. While we are at it, let's use recovery_state to
make the check explicit.

Closes #5616

@TarantoolBot document
Title: Mention that temp and local spaces can be truncated in ro mode

DML operations on temporary and local spaces can be performed even if
the instance is in the read-only mode, but DDL operations (such as
`alter`) are forbidden in this case[^1]. Technically, `truncate` is
a DDL operation so initially it was forbidden as well. However, it
should be safe to perform this operation on a temporary or local space
because logically it only modifies the data stored in the space (like
DML) and it isn't replicated (see #4263). So starting
from Tarantool 2.11.1 we allow users to truncate temporary spaces in the
read-only mode.

[^1]: https://www.tarantool.io/en/doc/latest/concepts/replication/repl_architecture/#replication-local

(cherry picked from commit 054526a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants