Skip to content

[Cache][Enhancement] Assure sql cache only one version#5793

Merged
morningman merged 1 commit intoapache:masterfrom
xinghuayu007:useless_cache
May 28, 2021
Merged

[Cache][Enhancement] Assure sql cache only one version#5793
morningman merged 1 commit intoapache:masterfrom
xinghuayu007:useless_cache

Conversation

@xinghuayu007
Copy link
Contributor

@xinghuayu007 xinghuayu007 commented May 11, 2021

Proposed changes

For PR #5792. This patch add a new param cache type to distinguish sql cache and partition cache. When update sql cache, we make assure one sql key only has one version cache.

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...)

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 #ISSUE) 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

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...

Copy link
Contributor

Choose a reason for hiding this comment

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

use optional to make it compatible with old version?

Copy link
Contributor

Choose a reason for hiding this comment

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

we need to make it compatible with old version

_data_size -= (*it)->get_data_size();
}
// clear old cache, and create new cache node
_partition_map.clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

The _partition_map save the pointer of PartitionRowBatch, so call clear() will not release to memory used by PartitionRowBatch.

And also I checked the origin code, it seems that the PartitionRowBatch in _partition_map is never released?

Copy link
Contributor Author

@xinghuayu007 xinghuayu007 May 24, 2021

Choose a reason for hiding this comment

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

When partition list size is bigger than config::query_cache_max_partition_count, it will call function prune_first() to release some PartitionRowBatch.

Copy link
Contributor

Choose a reason for hiding this comment

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

prune_first() is to handle _partition_list, but what ahout _partition_map?

Copy link
Contributor

Choose a reason for hiding this comment

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

Using debug level.

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

Copy link
Contributor

Choose a reason for hiding this comment

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

using debug level maybe better.

@xinghuayu007 xinghuayu007 force-pushed the useless_cache branch 2 times, most recently from 9eb6f8f to 61fdb40 Compare May 25, 2021 03:04
PartitionRowBatch* part_node = *_partition_list.begin();
size_t prune_size = part_node->get_data_size();
_partition_list.erase(_partition_list.begin());
_partition_map.erase(part_node->get_partition_key());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

To release _partition_map. @morningman

morningman
morningman previously approved these changes May 25, 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

@morningman morningman added approved Indicates a PR has been approved by one committer. area/sql/cache Issues or PRs related to sql cache kind/fix Categorizes issue or PR as related to a bug. labels May 25, 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

@morningman morningman merged commit 63c99eb into apache:master May 28, 2021
stdpain pushed a commit to stdpain/incubator-doris that referenced this pull request Jul 8, 2021
For PR apache#5792. This patch add a new param `cache type` to distinguish sql cache and partition cache.
When update sql cache,  we make assure one sql key only has one version cache.
w41ter pushed a commit to w41ter/incubator-doris that referenced this pull request Dec 26, 2025
## Proposed changes
pick from apache#58131

Previously, since clean tablet task was a lightweight operation on the
BE, it was assumed that dropping tablets would not cause task backlog.
However, online observations showed that tasks were still backlogged,
causing the BE to consume a lot of memory. Therefore, tablet
deduplication logic was added to prevent task backlog.
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/sql/cache Issues or PRs related to sql cache kind/fix Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments