Skip to content

Conversation

@caiconghui
Copy link
Contributor

Proposed changes

Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request. If it fixes a bug or resolves a feature request, be sure to link to that issue.

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Code refactor (Modify the code structure, format the code, etc...)
  • Optimization. Including functional usability improvements and performance improvements.
  • Dependency. Such as changes related to third-party components.
  • Other.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@caiconghui caiconghui added the kind/fix Categorizes issue or PR as related to a bug. label Sep 14, 2021
@caiconghui
Copy link
Contributor Author

here, we only need to check state of meta object when get write lock except the following conditions,

  1. replay operation
  2. already get parent meta object lock

@caiconghui
Copy link
Contributor Author

caiconghui commented Sep 24, 2021

  1. If the table or db has been dropped,we will get write lock failed or just skip or throw exception,
  2. and if we recover table or db, we must ensure that unmark dropped state after writing recover journal.
  3. db.dropTable corresponds to db.createTable, I don't move table.markDropped method to the db.dropTable, for that all meta added to db or catalog must after writing recover journal, so we must invoke markDropped and unmarkDropped method outside the dropTable and createTable method.

} else {
// not swap, the origin table is not used anymore, need to drop all its tablets.
Catalog.getCurrentCatalog().onEraseOlapTable(origTable, isReplay);
origTable.markDropped();
Copy link
Contributor

Choose a reason for hiding this comment

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

How about moving markDropped() inside the db.dropTable() and catalog.onEraseOlapTable() method?
So that we don't need to call markDropped() every time along with these methods manually.

And also, add markUndropped() method to db.createTable() method to address the operation like modifyView or renameTable, etc.

Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Feb 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2022

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2022

PR approved by anyone and no changes requested.

@morningman morningman merged commit ecbd4bc into apache:master Feb 8, 2022
@caiconghui caiconghui deleted the writeLock branch March 12, 2022 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/metadata kind/fix Categorizes issue or PR as related to a bug. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] The MetaObject lock design of fe would cause some problems with consistent meta when catalog do replay operation

2 participants