-
Notifications
You must be signed in to change notification settings - Fork 3.9k
branch-4.1: [feat](cache-memory) add external metadata cache memory governance #66717
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
Draft
CalvinKirs
wants to merge
13
commits into
apache:branch-4.1
Choose a base branch
from
CalvinKirs:4.1-cache_memory
base: branch-4.1
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
b89e044
branch-4.1: add external metadata cache memory governance
CalvinKirs 41e63e0
[fix](fe) Harden external metadata cache memory governance
CalvinKirs 6443730
[fix](fe) Make external metadata cache size estimators structural and…
CalvinKirs 3d97895
[fix](fe) Address review findings on cache property lifecycle, statis…
CalvinKirs 053a91a
[fix](fe) Address review findings on statistics upgrade tolerance, ev…
CalvinKirs c302b68
[fix](fe) Keep query-scoped Iceberg tables writable through live oper…
CalvinKirs b8fcc6d
[fix](fe) Put the Paimon base table entry under the meta cache weight…
CalvinKirs ec807ce
[fix](fe) Charge Iceberg range width for surviving merged partitions …
CalvinKirs f5b9250
[fix](fe) Rebind Iceberg projections on operational refresh and retir…
CalvinKirs 29ffdd6
[fix](fe) Queue removal tokens only, revalidate Iceberg projections o…
CalvinKirs b6e8939
Merge branch 'branch-4.1' into 4.1-cache_memory
CalvinKirs 950d87d
[fix](fe) Charge shared Paimon partition column names once and drop l…
CalvinKirs f681235
[fix](fe) Charge the Hive partition-value key width and retire catalo…
CalvinKirs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one | ||
| or more contributor license agreements. See the NOTICE file | ||
| distributed with this work for additional information | ||
| regarding copyright ownership. The ASF licenses this file | ||
| to you under the Apache License, Version 2.0 (the | ||
| "License"); you may not use this file except in compliance | ||
| with the License. You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, | ||
| software distributed under the License is distributed on an | ||
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| KIND, either express or implied. See the License for the | ||
| specific language governing permissions and limitations | ||
| under the License. | ||
| --> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>org.apache.doris</groupId> | ||
| <artifactId>fe</artifactId> | ||
| <version>${revision}</version> | ||
| <relativePath>../pom.xml</relativePath> | ||
| </parent> | ||
|
|
||
| <artifactId>fe-benchmark</artifactId> | ||
| <name>Doris FE Benchmarks</name> | ||
|
|
||
| <dependencies> | ||
| <dependency> | ||
| <groupId>${project.groupId}</groupId> | ||
| <artifactId>fe-core</artifactId> | ||
| <version>${project.version}</version> | ||
| </dependency> | ||
| </dependencies> | ||
| </project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| BENCHMARK_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) | ||
| FE_DIR=$(cd -- "${BENCHMARK_DIR}/.." && pwd) | ||
| CLASSPATH_FILE=$(mktemp) | ||
| trap 'rm -f "${CLASSPATH_FILE}"' EXIT | ||
|
|
||
| ( | ||
| cd "${FE_DIR}" | ||
| mvn -Pbenchmark -pl fe-benchmark -am compile -DskipTests -Dskip.clean=true | ||
| mvn -Pbenchmark -pl fe-benchmark -am dependency:build-classpath \ | ||
| -Dskip.clean=true \ | ||
| -DincludeScope=test \ | ||
| -Dmdep.outputFile="${CLASSPATH_FILE}" | ||
| ) | ||
|
|
||
| REACTOR_CLASSES= | ||
| while IFS= read -r -d '' CLASSES_DIR; do | ||
| REACTOR_CLASSES+="${CLASSES_DIR}:" | ||
| done < <(find "${FE_DIR}" -type d -path '*/target/classes' -print0) | ||
| DEPENDENCY_CLASSES=$(tr -d '\n' < "${CLASSPATH_FILE}") | ||
| BENCHMARK_FILTER=${BENCHMARK_FILTER:-'HivePartitionValuesSizeBenchmark|IcebergCacheSizeBenchmark|PaimonCacheSizeBenchmark|MetaCacheSoftValueBenchmark'} | ||
|
|
||
| BENCHMARK_CLASSES=( | ||
| org.apache.doris.datasource.hive.HivePartitionValuesSizeBenchmark | ||
| org.apache.doris.datasource.iceberg.IcebergCacheSizeBenchmark | ||
| org.apache.doris.datasource.paimon.PaimonCacheSizeBenchmark | ||
| org.apache.doris.datasource.metacache.MetaCacheSoftValueBenchmark | ||
| ) | ||
|
|
||
| for BENCHMARK_CLASS in "${BENCHMARK_CLASSES[@]}"; do | ||
| if [[ "${BENCHMARK_CLASS##*.}" =~ ${BENCHMARK_FILTER} ]]; then | ||
| java \ | ||
| -Xms1g \ | ||
| -Xmx4g \ | ||
| -classpath "${REACTOR_CLASSES}${DEPENDENCY_CLASSES}" \ | ||
| "${BENCHMARK_CLASS}" \ | ||
| "$@" | ||
| fi | ||
| done |
101 changes: 101 additions & 0 deletions
101
fe/fe-benchmark/src/main/java/org/apache/doris/benchmark/BenchmarkHarness.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package org.apache.doris.benchmark; | ||
|
|
||
| import java.util.Locale; | ||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| /** Small dependency-free harness for opt-in FE microbenchmarks. */ | ||
| public final class BenchmarkHarness { | ||
| private static final long WARMUP_MILLIS = Long.getLong("benchmark.warmup.millis", 500L); | ||
| private static final long MEASUREMENT_MILLIS = Long.getLong("benchmark.measurement.millis", 500L); | ||
| private static final int MEASUREMENT_ITERATIONS = Integer.getInteger("benchmark.iterations", 3); | ||
| private static final boolean PRINT_RESULT = Boolean.getBoolean("benchmark.print.result"); | ||
| private static volatile Object sink; | ||
|
|
||
| private BenchmarkHarness() { | ||
| } | ||
|
|
||
| @FunctionalInterface | ||
| public interface Operation { | ||
| Object run() throws Exception; | ||
| } | ||
|
|
||
| public static void measure(String name, TimeUnit outputUnit, Operation operation) throws Exception { | ||
| runWindow(operation, WARMUP_MILLIS); | ||
| double totalNanosPerOperation = 0.0D; | ||
| long totalOperations = 0L; | ||
| for (int iteration = 0; iteration < MEASUREMENT_ITERATIONS; iteration++) { | ||
| Window result = runWindow(operation, MEASUREMENT_MILLIS); | ||
| totalNanosPerOperation += result.nanosPerOperation; | ||
| totalOperations += result.operations; | ||
| } | ||
| double averageNanos = totalNanosPerOperation / MEASUREMENT_ITERATIONS; | ||
| String result = PRINT_RESULT ? ", result=" + sink : ""; | ||
| System.out.printf(Locale.ROOT, "%-72s %12.3f %s/op (%d ops%s)%n", | ||
| name, convertFromNanos(averageNanos, outputUnit), unitName(outputUnit), totalOperations, result); | ||
| } | ||
|
|
||
| private static Window runWindow(Operation operation, long minimumMillis) throws Exception { | ||
| long start = System.nanoTime(); | ||
| long deadline = start + TimeUnit.MILLISECONDS.toNanos(minimumMillis); | ||
| long operations = 0L; | ||
| do { | ||
| sink = operation.run(); | ||
| operations++; | ||
| } while (System.nanoTime() < deadline); | ||
| long elapsed = System.nanoTime() - start; | ||
| return new Window(operations, (double) elapsed / operations); | ||
| } | ||
|
|
||
| private static double convertFromNanos(double nanos, TimeUnit outputUnit) { | ||
| if (outputUnit == TimeUnit.NANOSECONDS) { | ||
| return nanos; | ||
| } else if (outputUnit == TimeUnit.MICROSECONDS) { | ||
| return nanos / 1_000.0D; | ||
| } else if (outputUnit == TimeUnit.MILLISECONDS) { | ||
| return nanos / 1_000_000.0D; | ||
| } else if (outputUnit == TimeUnit.SECONDS) { | ||
| return nanos / 1_000_000_000.0D; | ||
| } | ||
| throw new IllegalArgumentException("unsupported benchmark time unit: " + outputUnit); | ||
| } | ||
|
|
||
| private static String unitName(TimeUnit outputUnit) { | ||
| if (outputUnit == TimeUnit.NANOSECONDS) { | ||
| return "ns"; | ||
| } else if (outputUnit == TimeUnit.MICROSECONDS) { | ||
| return "us"; | ||
| } else if (outputUnit == TimeUnit.MILLISECONDS) { | ||
| return "ms"; | ||
| } else if (outputUnit == TimeUnit.SECONDS) { | ||
| return "s"; | ||
| } | ||
| return outputUnit.name().toLowerCase(Locale.ROOT); | ||
| } | ||
|
|
||
| private static final class Window { | ||
| private final long operations; | ||
| private final double nanosPerOperation; | ||
|
|
||
| private Window(long operations, double nanosPerOperation) { | ||
| this.operations = operations; | ||
| this.nanosPerOperation = nanosPerOperation; | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] Preserve this RPC across a rolling upgrade
A new BE sends every local column name to fetchSchemaTableData, but an old FE's META_CACHE_STATS_COLUMN_TO_INDEX has none of this appended suffix; its filterColumns() looks up a null index and throws. The inverse pair also cannot execute a new-column projection on an old BE descriptor. Please add a version-gated legacy request/fallback that fills unsupported cells with NULL/defaults (and gate new-column planning as needed), with mixed-version tests in both directions.