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

Issue #802: MyRocks: Statement rollback doesnt work correctly for nes… #804

Closed

Conversation

spetrunia
Copy link
Contributor

…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@@ -2449,6 +2453,10 @@ class Rdb_transaction_impl : public Rdb_transaction {
rocksdb::Transaction *m_rocksdb_tx = nullptr;
rocksdb::Transaction *m_rocksdb_reuse_tx = nullptr;

// Number of savepoints to roll back to get to the start of the
// "top-level" statement.
int m_n_savepoints;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably make more sense to have these variables and collapse_savepoint() call in Rdb_transaction instead?

… for nested statements

Variant#2: Use a different approach to taking RocksDB SavePoints.
- Take one at transaction start (so we can rollback to it)
- Take one when top-level statement completes (there is a place to do
  that. Detecting when a top-level statement starts is much harder)

- Also, don't make a new Savepoint if the previous statement didn't
  make any writes. This way, a long transaction doing lots of SELECTs
  will not create a lot of savepoints.

- Also, don't call get_or_create_tx() from
  ha_rocksdb::external_lock(F_UNLCK). This call is made right after
  rocksdb_commit(). We end up creating a new RocksDB transaction just
  to do cleanups and immediately discard it.
@spetrunia spetrunia force-pushed the fb-mysql-5.6.35-issue802 branch from f75f876 to 612ec75 Compare April 5, 2018 21:54
@facebook-github-bot
Copy link

@spetrunia has updated the pull request.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@@ -1854,6 +1854,17 @@ class Rdb_transaction {
bool m_is_delayed_snapshot = false;
bool m_is_two_phase = false;

private:
/* Number of RockDB savepoints taken */
int m_n_savepoints;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_n_savepoints and m_writes_at_last_savepoint need to be initialized at similar locations to m_write_count, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Lost that initialization when re-working the patch. Will now add it back

… for nested statements

Variant facebook#2: initialize m_n_savepoints and m_writes_at_last_savepoint
at transaction start.
@facebook-github-bot
Copy link

@spetrunia has updated the pull request. View: changes, changes since last import

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hermanlee is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

spetrunia added a commit to MariaDB/server that referenced this pull request Apr 12, 2018
Cherry-pick this fix from the upstream:
commit 6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
Author: Sergei Petrunia <psergey@askmonty.org>
Date:   Tue Apr 10 11:43:01 2018 -0700

    [mysql-5.6][PR] Issue #802: MyRocks: Statement rollback doesnt work correctly for nes�

    Summary:
    �ted statements

    Variant #1: When the statement fails, we should roll back to the latest
    savepoint taken at the top level.
    Closes facebook/mysql-5.6#804

    Differential Revision: D7509380

    Pulled By: hermanlee

    fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request May 22, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod--------

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request May 23, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod--------

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request May 23, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod--------

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request May 23, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod--------

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request May 24, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod--------

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request May 28, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod--------

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request May 29, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod--------

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request Jun 19, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod201801

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request Jun 19, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod201801

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request Jun 21, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod201801

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
george-lorch pushed a commit to george-lorch/percona-server that referenced this pull request Jun 22, 2018
… work correctly for nes…

Upstream commit ID : fb-mysql-5.6.35/6ddedd8f1e0ddcbc24e8f9a005636c5463799ab7
PS-4476 : Merge prod201801

Summary:
…ted statements

Variant percona#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 9a6f414
chouxi pushed a commit to chouxi/mysql-5.6 that referenced this pull request Jul 12, 2018
…t work correctly for nes…

Summary:
…ted statements

Variant facebook#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804
GitHub Author: Sergei Petrunia <psergey@askmonty.org>

Test Plan: Imported from GitHub, without a `Test Plan:` line.

Reviewers: svcscm, generatedunixname499836121

Reviewed By: svcscm

Subscribers: phabricatorlinter, webscalesql-eng@fb.com

Differential Revision: https://phabricator.intern.facebook.com/D7509380

Signature: 7509380:1523385571:df3dca173fe59bcf217d3a77f79eb085980149fc
facebook-github-bot pushed a commit that referenced this pull request Dec 23, 2019
#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes #804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 979fc37
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 12, 2020
… for nes… (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 979fc37
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Sep 9, 2020
… for nes… (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 979fc37
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Sep 16, 2020
… for nes… (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 979fc37
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Oct 5, 2020
… for nes… (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 979fc37
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Nov 11, 2020
… for nes… (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee

fbshipit-source-id: 979fc37
facebook-github-bot pushed a commit that referenced this pull request Mar 8, 2021
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(#804)?= (#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes #804

Differential Revision: D7509380 (6ddedd8)

Pulled By: hermanlee

fbshipit-source-id: be411bfae1b
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 16, 2021
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380 (facebook@6ddedd8)

Pulled By: hermanlee

fbshipit-source-id: be411bfae1b
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 17, 2021
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380 (facebook@6ddedd8)

Pulled By: hermanlee

fbshipit-source-id: be411bfae1b
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 30, 2021
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380 (facebook@6ddedd8)

Pulled By: hermanlee

fbshipit-source-id: be411bfae1b
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 30, 2021
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380 (facebook@6ddedd8)

Pulled By: hermanlee

fbshipit-source-id: be411bfae1b
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Aug 31, 2021
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380 (facebook@6ddedd8)

Pulled By: hermanlee

fbshipit-source-id: be411bfae1b
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Sep 1, 2021
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380 (facebook@6ddedd8)

Pulled By: hermanlee

fbshipit-source-id: be411bfae1b
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Sep 2, 2021
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380 (facebook@6ddedd8)

Pulled By: hermanlee

fbshipit-source-id: be411bfae1b
hermanlee pushed a commit that referenced this pull request Jan 10, 2022
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(#804)?= (#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes #804

Differential Revision: D7509380

Pulled By: hermanlee
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jan 17, 2022
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jan 17, 2022
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee
ldonoso pushed a commit to ldonoso/percona-server that referenced this pull request Mar 15, 2022
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(percona#804)?= (percona#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 20, 2022
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request May 23, 2022
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee
laurynas-biveinis pushed a commit to laurynas-biveinis/mysql-5.6 that referenced this pull request Aug 11, 2022
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant facebook#1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Mar 25, 2023
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Mar 28, 2023
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 1, 2023
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee
inikep pushed a commit to inikep/mysql-5.6 that referenced this pull request Jun 14, 2023
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(facebook#804)?= (facebook#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook#804

Differential Revision: D7509380

Pulled By: hermanlee
inikep pushed a commit to inikep/percona-server that referenced this pull request Apr 9, 2024
…?=20doesnt=20work=20correctly=20for=20nes=E2=80=A6=20(percona#804)?= (percona#804)

Summary:
…ted statements

Variant #1: When the statement fails, we should roll back to the latest
savepoint taken at the top level.
Closes facebook/mysql-5.6#804

Differential Revision: D7509380

Pulled By: hermanlee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants