Skip to content

[Feature] Support for querying the trash used capacity#6247

Merged
morningman merged 12 commits intoapache:masterfrom
BiteTheDDDDt:dev_show
Aug 10, 2021
Merged

[Feature] Support for querying the trash used capacity#6247
morningman merged 12 commits intoapache:masterfrom
BiteTheDDDDt:dev_show

Conversation

@BiteTheDDDDt
Copy link
Contributor

@BiteTheDDDDt BiteTheDDDDt commented Jul 15, 2021

Proposed changes

Support for querying the trash used capacity.
Now user can proactively scan trash directory.

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.

  • I have created an issue on (Fix [Feature] Support for querying the trash used capacity #6246) and described the bug/feature there in detail
  • Compiling and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • If these changes need document changes, I have updated the document
  • Any dependent changes have been merged

keywordMap.put("array", new Integer(SqlParserSymbols.KW_ARRAY));
keywordMap.put("backend", new Integer(SqlParserSymbols.KW_BACKEND));
keywordMap.put("backends", new Integer(SqlParserSymbols.KW_BACKENDS));
keywordMap.put("trash", new Integer(SqlParserSymbols.KW_TRASH));
Copy link
Member

Choose a reason for hiding this comment

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

keep the alpha order

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

trashUsedCapacityB, System.currentTimeMillis() - start);
ok = true;
} catch (Exception e) {
LOG.warn("task exec error. backend[{}]", backend.getId(), e);
Copy link
Member

Choose a reason for hiding this comment

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

Just a log without further processing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a log without further processing?

now will display null when program throw error


public ShowTrashStmt(List<String> backends) {
ImmutableMap<Long, Backend> backendsInfo = Catalog.getCurrentSystemInfo().getIdToBackend();
Map<String, Long> backendsID = new HashMap<String, Long>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use backend id directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean to directly use 'backend id' query instead of 'backend host':'backend heart beat port'?


public class ShowTrashStmt extends ShowStmt {
public static final ImmutableList<String> TITLE_NAMES = new ImmutableList.Builder<String>().add("BackendId")
.add("Backend").add("TrashUsedCapacity").build();
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better to add the trash information to show proc as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would it be better to add the trash information to show proc as well?

now support 'show proc '/trash''

{:
RESULT = new ShowBackendsStmt();
:}
| KW_TRASH KW_ON LPAREN string_list:backends RPAREN
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add document of show trash stmt

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please add document of show trash stmt

done.

@EmmyMiao87 EmmyMiao87 added api-review Categorizes an issue or PR as actively needing an API review. kind/feature Categorizes issue or PR as related to a new feature. area/metrics Issues or PRs related to the metrics area/storage Issues or PRs related to storage engine and removed area/metrics Issues or PRs related to the metrics labels Jul 15, 2021
BiteTheDDDDt and others added 5 commits July 15, 2021 19:15
2. display null when connect fail to client
3. trash information to show proc, and support show proc '/trash'
4. add document of show trash stmt
Co-authored-by: Zhengguo Yang <780531911@qq.com>
Co-authored-by: Zhengguo Yang <780531911@qq.com>
Pair<Double, String> trashUsedCapacity = DebugUtil.getByteUint(trashUsedCapacityB);
backendInfo.add(DebugUtil.DECIMAL_FORMAT_SCALE_3.format(trashUsedCapacity.first) + " " + trashUsedCapacity.second);
} else {
backendInfo.add("null");
Copy link
Member

Choose a reason for hiding this comment

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

not literal null

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

yangzhg
yangzhg previously approved these changes Aug 3, 2021
Copy link
Member

@yangzhg yangzhg 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
Copy link
Contributor

github-actions bot commented Aug 3, 2021

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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Aug 3, 2021
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2021

PR approved by anyone and no changes requested.

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.

ShowTrashDiskStmt and ShowTrashStmt can be unified

if (ConnectContext.get().getSessionVariable().getForwardToMaster()) {
return RedirectStatus.FORWARD_NO_SYNC;
} else {
return RedirectStatus.NO_FORWARD;
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to forward

if (ConnectContext.get().getSessionVariable().getForwardToMaster()) {
return RedirectStatus.FORWARD_NO_SYNC;
} else {
return RedirectStatus.NO_FORWARD;
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to forward

Copy link
Contributor Author

@BiteTheDDDDt BiteTheDDDDt Aug 5, 2021

Choose a reason for hiding this comment

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

No need to forward

I fix it at c3f7c7e

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Aug 5, 2021
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
Copy link
Contributor

github-actions bot commented Aug 7, 2021

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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Aug 7, 2021
@morningman morningman merged commit 236e0f1 into apache:master Aug 10, 2021
@morningman morningman mentioned this pull request Oct 10, 2021
@BiteTheDDDDt BiteTheDDDDt deleted the dev_show branch January 20, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by one committer. area/storage Issues or PRs related to storage engine kind/feature Categorizes issue or PR as related to a new feature. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support for querying the trash used capacity

4 participants