mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-23 06:30:05 +00:00
Compare commits
27 Commits
feature/df
...
poc/create
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e79b4b2f6 | ||
|
|
4ad40af468 | ||
|
|
e4b048e788 | ||
|
|
ecbf372de3 | ||
|
|
3d81a17360 | ||
|
|
025cae3679 | ||
|
|
68409e28ea | ||
|
|
699406ae32 | ||
|
|
344006deca | ||
|
|
63803f2b43 | ||
|
|
cf62767b98 | ||
|
|
4e53c1531d | ||
|
|
892cb66c53 | ||
|
|
8b392477c8 | ||
|
|
905593dc16 | ||
|
|
6c04cb9b19 | ||
|
|
24da3367c1 | ||
|
|
80b14965a6 | ||
|
|
5da3f86d0c | ||
|
|
151273d1df | ||
|
|
b0289dbdde | ||
|
|
c51730a954 | ||
|
|
207709c727 | ||
|
|
deca8c44fa | ||
|
|
2edd861ce9 | ||
|
|
14f3a4ab05 | ||
|
|
34875c0346 |
@@ -2,7 +2,7 @@
|
|||||||
linker = "aarch64-linux-gnu-gcc"
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
|
|
||||||
[alias]
|
[alias]
|
||||||
sqlness = "run --bin sqlness-runner --target-dir target/sqlness --"
|
sqlness = "run --bin sqlness-runner --"
|
||||||
|
|
||||||
[unstable.git]
|
[unstable.git]
|
||||||
shallow_index = true
|
shallow_index = true
|
||||||
@@ -12,6 +12,3 @@ fetch = true
|
|||||||
checkout = true
|
checkout = true
|
||||||
list_files = true
|
list_files = true
|
||||||
internal_use_git2 = false
|
internal_use_git2 = false
|
||||||
|
|
||||||
[env]
|
|
||||||
CARGO_WORKSPACE_DIR = { value = "", relative = true }
|
|
||||||
|
|||||||
22
.github/CODEOWNERS
vendored
22
.github/CODEOWNERS
vendored
@@ -5,23 +5,23 @@
|
|||||||
* @GreptimeTeam/db-approver
|
* @GreptimeTeam/db-approver
|
||||||
|
|
||||||
## [Module] Database Engine
|
## [Module] Database Engine
|
||||||
/src/index @evenyag @discord9 @WenyXu
|
/src/index @zhongzc
|
||||||
/src/mito2 @evenyag @v0y4g3r @waynexia
|
/src/mito2 @evenyag @v0y4g3r @waynexia
|
||||||
/src/query @evenyag @waynexia @discord9
|
/src/query @evenyag
|
||||||
|
|
||||||
## [Module] Distributed
|
## [Module] Distributed
|
||||||
/src/common/meta @MichaelScofield @WenyXu
|
/src/common/meta @MichaelScofield
|
||||||
/src/common/procedure @MichaelScofield @WenyXu
|
/src/common/procedure @MichaelScofield
|
||||||
/src/meta-client @MichaelScofield @WenyXu
|
/src/meta-client @MichaelScofield
|
||||||
/src/meta-srv @MichaelScofield @WenyXu
|
/src/meta-srv @MichaelScofield
|
||||||
|
|
||||||
## [Module] Write Ahead Log
|
## [Module] Write Ahead Log
|
||||||
/src/log-store @v0y4g3r @WenyXu
|
/src/log-store @v0y4g3r
|
||||||
/src/store-api @v0y4g3r @evenyag
|
/src/store-api @v0y4g3r
|
||||||
|
|
||||||
## [Module] Metrics Engine
|
## [Module] Metrics Engine
|
||||||
/src/metric-engine @waynexia @WenyXu
|
/src/metric-engine @waynexia
|
||||||
/src/promql @waynexia @evenyag @discord9
|
/src/promql @waynexia
|
||||||
|
|
||||||
## [Module] Flow
|
## [Module] Flow
|
||||||
/src/flow @discord9 @waynexia
|
/src/flow @zhongzc @waynexia
|
||||||
|
|||||||
17
.github/actions/build-greptime-binary/action.yml
vendored
17
.github/actions/build-greptime-binary/action.yml
vendored
@@ -32,23 +32,9 @@ inputs:
|
|||||||
description: Image Registry
|
description: Image Registry
|
||||||
required: false
|
required: false
|
||||||
default: 'docker.io'
|
default: 'docker.io'
|
||||||
large-page-size:
|
|
||||||
description: Build GreptimeDB with large page size (65536).
|
|
||||||
required: false
|
|
||||||
default: 'false'
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
- name: Set extra build environment variables
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
if [[ '${{ inputs.large-page-size }}' == 'true' ]]; then
|
|
||||||
echo 'EXTRA_BUILD_ENVS="JEMALLOC_SYS_WITH_LG_PAGE=16"' >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo 'EXTRA_BUILD_ENVS=' >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build greptime binary
|
- name: Build greptime binary
|
||||||
shell: bash
|
shell: bash
|
||||||
if: ${{ inputs.build-android-artifacts == 'false' }}
|
if: ${{ inputs.build-android-artifacts == 'false' }}
|
||||||
@@ -59,8 +45,7 @@ runs:
|
|||||||
FEATURES=${{ inputs.features }} \
|
FEATURES=${{ inputs.features }} \
|
||||||
BASE_IMAGE=${{ inputs.base-image }} \
|
BASE_IMAGE=${{ inputs.base-image }} \
|
||||||
IMAGE_NAMESPACE=${{ inputs.image-namespace }} \
|
IMAGE_NAMESPACE=${{ inputs.image-namespace }} \
|
||||||
IMAGE_REGISTRY=${{ inputs.image-registry }} \
|
IMAGE_REGISTRY=${{ inputs.image-registry }}
|
||||||
EXTRA_BUILD_ENVS=$EXTRA_BUILD_ENVS
|
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: ./.github/actions/upload-artifacts
|
uses: ./.github/actions/upload-artifacts
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ inputs:
|
|||||||
description: Working directory to build the artifacts
|
description: Working directory to build the artifacts
|
||||||
required: false
|
required: false
|
||||||
default: .
|
default: .
|
||||||
large-page-size:
|
|
||||||
description: Build GreptimeDB with large page size (65536).
|
|
||||||
required: false
|
|
||||||
default: 'false'
|
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
@@ -63,7 +59,6 @@ runs:
|
|||||||
working-dir: ${{ inputs.working-dir }}
|
working-dir: ${{ inputs.working-dir }}
|
||||||
image-registry: ${{ inputs.image-registry }}
|
image-registry: ${{ inputs.image-registry }}
|
||||||
image-namespace: ${{ inputs.image-namespace }}
|
image-namespace: ${{ inputs.image-namespace }}
|
||||||
large-page-size: ${{ inputs.large-page-size }}
|
|
||||||
|
|
||||||
- name: Clean up the target directory # Clean up the target directory for the centos7 base image, or it will still use the objects of last build.
|
- name: Clean up the target directory # Clean up the target directory for the centos7 base image, or it will still use the objects of last build.
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -82,7 +77,6 @@ runs:
|
|||||||
working-dir: ${{ inputs.working-dir }}
|
working-dir: ${{ inputs.working-dir }}
|
||||||
image-registry: ${{ inputs.image-registry }}
|
image-registry: ${{ inputs.image-registry }}
|
||||||
image-namespace: ${{ inputs.image-namespace }}
|
image-namespace: ${{ inputs.image-namespace }}
|
||||||
large-page-size: ${{ inputs.large-page-size }}
|
|
||||||
|
|
||||||
- name: Build greptime on android base image
|
- name: Build greptime on android base image
|
||||||
uses: ./.github/actions/build-greptime-binary
|
uses: ./.github/actions/build-greptime-binary
|
||||||
@@ -95,4 +89,3 @@ runs:
|
|||||||
build-android-artifacts: true
|
build-android-artifacts: true
|
||||||
image-registry: ${{ inputs.image-registry }}
|
image-registry: ${{ inputs.image-registry }}
|
||||||
image-namespace: ${{ inputs.image-namespace }}
|
image-namespace: ${{ inputs.image-namespace }}
|
||||||
large-page-size: ${{ inputs.large-page-size }}
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Install Etcd cluster
|
- name: Install Etcd cluster
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
helm upgrade \
|
helm upgrade \
|
||||||
--install etcd oci://registry-1.docker.io/bitnamicharts/etcd \
|
--install etcd oci://registry-1.docker.io/bitnamicharts/etcd \
|
||||||
--set replicaCount=${{ inputs.etcd-replicas }} \
|
--set replicaCount=${{ inputs.etcd-replicas }} \
|
||||||
@@ -24,9 +24,4 @@ runs:
|
|||||||
--set auth.rbac.token.enabled=false \
|
--set auth.rbac.token.enabled=false \
|
||||||
--set persistence.size=2Gi \
|
--set persistence.size=2Gi \
|
||||||
--create-namespace \
|
--create-namespace \
|
||||||
--set global.security.allowInsecureImages=true \
|
|
||||||
--set image.registry=docker.io \
|
|
||||||
--set image.repository=greptime/etcd \
|
|
||||||
--set image.tag=3.6.1-debian-12-r3 \
|
|
||||||
--version 12.0.8 \
|
|
||||||
-n ${{ inputs.namespace }}
|
-n ${{ inputs.namespace }}
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
logging:
|
|
||||||
level: "info"
|
|
||||||
format: "json"
|
|
||||||
filters:
|
|
||||||
- log_store=debug
|
|
||||||
meta:
|
meta:
|
||||||
configData: |-
|
configData: |-
|
||||||
[runtime]
|
[runtime]
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ runs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Install Kafka cluster
|
- name: Install Kafka cluster
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
helm upgrade \
|
helm upgrade \
|
||||||
--install kafka oci://registry-1.docker.io/bitnamicharts/kafka \
|
--install kafka oci://registry-1.docker.io/bitnamicharts/kafka \
|
||||||
--set controller.replicaCount=${{ inputs.controller-replicas }} \
|
--set controller.replicaCount=${{ inputs.controller-replicas }} \
|
||||||
@@ -23,8 +23,4 @@ runs:
|
|||||||
--set listeners.controller.protocol=PLAINTEXT \
|
--set listeners.controller.protocol=PLAINTEXT \
|
||||||
--set listeners.client.protocol=PLAINTEXT \
|
--set listeners.client.protocol=PLAINTEXT \
|
||||||
--create-namespace \
|
--create-namespace \
|
||||||
--set image.registry=docker.io \
|
|
||||||
--set image.repository=greptime/kafka \
|
|
||||||
--set image.tag=3.9.0-debian-12-r1 \
|
|
||||||
--version 31.0.0 \
|
|
||||||
-n ${{ inputs.namespace }}
|
-n ${{ inputs.namespace }}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ inputs:
|
|||||||
description: "Number of PostgreSQL replicas"
|
description: "Number of PostgreSQL replicas"
|
||||||
namespace:
|
namespace:
|
||||||
default: "postgres-namespace"
|
default: "postgres-namespace"
|
||||||
description: "The PostgreSQL namespace"
|
postgres-version:
|
||||||
|
default: "14.2"
|
||||||
|
description: "PostgreSQL version"
|
||||||
storage-size:
|
storage-size:
|
||||||
default: "1Gi"
|
default: "1Gi"
|
||||||
description: "Storage size for PostgreSQL"
|
description: "Storage size for PostgreSQL"
|
||||||
@@ -20,11 +22,7 @@ runs:
|
|||||||
helm upgrade \
|
helm upgrade \
|
||||||
--install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql \
|
--install postgresql oci://registry-1.docker.io/bitnamicharts/postgresql \
|
||||||
--set replicaCount=${{ inputs.postgres-replicas }} \
|
--set replicaCount=${{ inputs.postgres-replicas }} \
|
||||||
--set global.security.allowInsecureImages=true \
|
--set image.tag=${{ inputs.postgres-version }} \
|
||||||
--set image.registry=docker.io \
|
|
||||||
--set image.repository=greptime/postgresql \
|
|
||||||
--set image.tag=17.5.0-debian-12-r3 \
|
|
||||||
--version 16.7.4 \
|
|
||||||
--set persistence.size=${{ inputs.storage-size }} \
|
--set persistence.size=${{ inputs.storage-size }} \
|
||||||
--set postgresql.username=greptimedb \
|
--set postgresql.username=greptimedb \
|
||||||
--set postgresql.password=admin \
|
--set postgresql.password=admin \
|
||||||
|
|||||||
42
.github/scripts/check-version.sh
vendored
42
.github/scripts/check-version.sh
vendored
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Get current version
|
|
||||||
CURRENT_VERSION=$1
|
|
||||||
if [ -z "$CURRENT_VERSION" ]; then
|
|
||||||
echo "Error: Failed to get current version"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the latest version from GitHub Releases
|
|
||||||
API_RESPONSE=$(curl -s "https://api.github.com/repos/GreptimeTeam/greptimedb/releases/latest")
|
|
||||||
|
|
||||||
if [ -z "$API_RESPONSE" ] || [ "$(echo "$API_RESPONSE" | jq -r '.message')" = "Not Found" ]; then
|
|
||||||
echo "Error: Failed to fetch latest version from GitHub"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the latest version
|
|
||||||
LATEST_VERSION=$(echo "$API_RESPONSE" | jq -r '.tag_name')
|
|
||||||
|
|
||||||
if [ -z "$LATEST_VERSION" ] || [ "$LATEST_VERSION" = "null" ]; then
|
|
||||||
echo "Error: No valid version found in GitHub releases"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Cleaned up version number format (removed possible 'v' prefix and -nightly suffix)
|
|
||||||
CLEAN_CURRENT=$(echo "$CURRENT_VERSION" | sed 's/^v//' | sed 's/-nightly-.*//')
|
|
||||||
CLEAN_LATEST=$(echo "$LATEST_VERSION" | sed 's/^v//' | sed 's/-nightly-.*//')
|
|
||||||
|
|
||||||
echo "Current version: $CLEAN_CURRENT"
|
|
||||||
echo "Latest release version: $CLEAN_LATEST"
|
|
||||||
|
|
||||||
# Use sort -V to compare versions
|
|
||||||
HIGHER_VERSION=$(printf "%s\n%s" "$CLEAN_CURRENT" "$CLEAN_LATEST" | sort -V | tail -n1)
|
|
||||||
|
|
||||||
if [ "$HIGHER_VERSION" = "$CLEAN_CURRENT" ]; then
|
|
||||||
echo "Current version ($CLEAN_CURRENT) is NEWER than or EQUAL to latest ($CLEAN_LATEST)"
|
|
||||||
echo "is-current-version-latest=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "Current version ($CLEAN_CURRENT) is OLDER than latest ($CLEAN_LATEST)"
|
|
||||||
echo "is-current-version-latest=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
46
.github/scripts/deploy-greptimedb.sh
vendored
46
.github/scripts/deploy-greptimedb.sh
vendored
@@ -3,16 +3,12 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KUBERNETES_VERSION="${KUBERNETES_VERSION:-v1.32.0}"
|
KUBERNETES_VERSION="${KUBERNETES_VERSION:-v1.24.0}"
|
||||||
ENABLE_STANDALONE_MODE="${ENABLE_STANDALONE_MODE:-true}"
|
ENABLE_STANDALONE_MODE="${ENABLE_STANDALONE_MODE:-true}"
|
||||||
DEFAULT_INSTALL_NAMESPACE=${DEFAULT_INSTALL_NAMESPACE:-default}
|
DEFAULT_INSTALL_NAMESPACE=${DEFAULT_INSTALL_NAMESPACE:-default}
|
||||||
GREPTIMEDB_IMAGE_TAG=${GREPTIMEDB_IMAGE_TAG:-latest}
|
GREPTIMEDB_IMAGE_TAG=${GREPTIMEDB_IMAGE_TAG:-latest}
|
||||||
GREPTIMEDB_OPERATOR_IMAGE_TAG=${GREPTIMEDB_OPERATOR_IMAGE_TAG:-v0.5.1}
|
|
||||||
GREPTIMEDB_INITIALIZER_IMAGE_TAG="${GREPTIMEDB_OPERATOR_IMAGE_TAG}"
|
|
||||||
GREPTIME_CHART="https://greptimeteam.github.io/helm-charts/"
|
|
||||||
ETCD_CHART="oci://registry-1.docker.io/bitnamicharts/etcd"
|
ETCD_CHART="oci://registry-1.docker.io/bitnamicharts/etcd"
|
||||||
ETCD_CHART_VERSION="${ETCD_CHART_VERSION:-12.0.8}"
|
GREPTIME_CHART="https://greptimeteam.github.io/helm-charts/"
|
||||||
ETCD_IMAGE_TAG="${ETCD_IMAGE_TAG:-3.6.1-debian-12-r3}"
|
|
||||||
|
|
||||||
# Create a cluster with 1 control-plane node and 5 workers.
|
# Create a cluster with 1 control-plane node and 5 workers.
|
||||||
function create_kind_cluster() {
|
function create_kind_cluster() {
|
||||||
@@ -39,16 +35,10 @@ function add_greptime_chart() {
|
|||||||
function deploy_etcd_cluster() {
|
function deploy_etcd_cluster() {
|
||||||
local namespace="$1"
|
local namespace="$1"
|
||||||
|
|
||||||
helm upgrade --install etcd "$ETCD_CHART" \
|
helm install etcd "$ETCD_CHART" \
|
||||||
--version "$ETCD_CHART_VERSION" \
|
|
||||||
--create-namespace \
|
|
||||||
--set replicaCount=3 \
|
--set replicaCount=3 \
|
||||||
--set auth.rbac.create=false \
|
--set auth.rbac.create=false \
|
||||||
--set auth.rbac.token.enabled=false \
|
--set auth.rbac.token.enabled=false \
|
||||||
--set global.security.allowInsecureImages=true \
|
|
||||||
--set image.registry=docker.io \
|
|
||||||
--set image.repository=greptime/etcd \
|
|
||||||
--set image.tag="$ETCD_IMAGE_TAG" \
|
|
||||||
-n "$namespace"
|
-n "$namespace"
|
||||||
|
|
||||||
# Wait for etcd cluster to be ready.
|
# Wait for etcd cluster to be ready.
|
||||||
@@ -58,9 +48,8 @@ function deploy_etcd_cluster() {
|
|||||||
# Deploy greptimedb-operator.
|
# Deploy greptimedb-operator.
|
||||||
function deploy_greptimedb_operator() {
|
function deploy_greptimedb_operator() {
|
||||||
# Use the latest chart and image.
|
# Use the latest chart and image.
|
||||||
helm upgrade --install greptimedb-operator greptime/greptimedb-operator \
|
helm install greptimedb-operator greptime/greptimedb-operator \
|
||||||
--create-namespace \
|
--set image.tag=latest \
|
||||||
--set image.tag="$GREPTIMEDB_OPERATOR_IMAGE_TAG" \
|
|
||||||
-n "$DEFAULT_INSTALL_NAMESPACE"
|
-n "$DEFAULT_INSTALL_NAMESPACE"
|
||||||
|
|
||||||
# Wait for greptimedb-operator to be ready.
|
# Wait for greptimedb-operator to be ready.
|
||||||
@@ -77,12 +66,9 @@ function deploy_greptimedb_cluster() {
|
|||||||
|
|
||||||
deploy_etcd_cluster "$install_namespace"
|
deploy_etcd_cluster "$install_namespace"
|
||||||
|
|
||||||
helm upgrade --install "$cluster_name" greptime/greptimedb-cluster \
|
helm install "$cluster_name" greptime/greptimedb-cluster \
|
||||||
--create-namespace \
|
|
||||||
--set image.tag="$GREPTIMEDB_IMAGE_TAG" \
|
--set image.tag="$GREPTIMEDB_IMAGE_TAG" \
|
||||||
--set initializer.tag="$GREPTIMEDB_INITIALIZER_IMAGE_TAG" \
|
|
||||||
--set meta.backendStorage.etcd.endpoints="etcd.$install_namespace:2379" \
|
--set meta.backendStorage.etcd.endpoints="etcd.$install_namespace:2379" \
|
||||||
--set meta.backendStorage.etcd.storeKeyPrefix="$cluster_name" \
|
|
||||||
-n "$install_namespace"
|
-n "$install_namespace"
|
||||||
|
|
||||||
# Wait for greptimedb cluster to be ready.
|
# Wait for greptimedb cluster to be ready.
|
||||||
@@ -115,18 +101,15 @@ function deploy_greptimedb_cluster_with_s3_storage() {
|
|||||||
|
|
||||||
deploy_etcd_cluster "$install_namespace"
|
deploy_etcd_cluster "$install_namespace"
|
||||||
|
|
||||||
helm upgrade --install "$cluster_name" greptime/greptimedb-cluster -n "$install_namespace" \
|
helm install "$cluster_name" greptime/greptimedb-cluster -n "$install_namespace" \
|
||||||
--create-namespace \
|
|
||||||
--set image.tag="$GREPTIMEDB_IMAGE_TAG" \
|
--set image.tag="$GREPTIMEDB_IMAGE_TAG" \
|
||||||
--set initializer.tag="$GREPTIMEDB_INITIALIZER_IMAGE_TAG" \
|
|
||||||
--set meta.backendStorage.etcd.endpoints="etcd.$install_namespace:2379" \
|
--set meta.backendStorage.etcd.endpoints="etcd.$install_namespace:2379" \
|
||||||
--set meta.backendStorage.etcd.storeKeyPrefix="$cluster_name" \
|
--set storage.s3.bucket="$AWS_CI_TEST_BUCKET" \
|
||||||
--set objectStorage.s3.bucket="$AWS_CI_TEST_BUCKET" \
|
--set storage.s3.region="$AWS_REGION" \
|
||||||
--set objectStorage.s3.region="$AWS_REGION" \
|
--set storage.s3.root="$DATA_ROOT" \
|
||||||
--set objectStorage.s3.root="$DATA_ROOT" \
|
--set storage.credentials.secretName=s3-credentials \
|
||||||
--set objectStorage.credentials.secretName=s3-credentials \
|
--set storage.credentials.accessKeyId="$AWS_ACCESS_KEY_ID" \
|
||||||
--set objectStorage.credentials.accessKeyId="$AWS_ACCESS_KEY_ID" \
|
--set storage.credentials.secretAccessKey="$AWS_SECRET_ACCESS_KEY"
|
||||||
--set objectStorage.credentials.secretAccessKey="$AWS_SECRET_ACCESS_KEY"
|
|
||||||
|
|
||||||
# Wait for greptimedb cluster to be ready.
|
# Wait for greptimedb cluster to be ready.
|
||||||
while true; do
|
while true; do
|
||||||
@@ -151,8 +134,7 @@ function deploy_greptimedb_cluster_with_s3_storage() {
|
|||||||
# Deploy standalone greptimedb.
|
# Deploy standalone greptimedb.
|
||||||
# It will expose cluster service ports as '34000', '34001', '34002', '34003' to local access.
|
# It will expose cluster service ports as '34000', '34001', '34002', '34003' to local access.
|
||||||
function deploy_standalone_greptimedb() {
|
function deploy_standalone_greptimedb() {
|
||||||
helm upgrade --install greptimedb-standalone greptime/greptimedb-standalone \
|
helm install greptimedb-standalone greptime/greptimedb-standalone \
|
||||||
--create-namespace \
|
|
||||||
--set image.tag="$GREPTIMEDB_IMAGE_TAG" \
|
--set image.tag="$GREPTIMEDB_IMAGE_TAG" \
|
||||||
-n "$DEFAULT_INSTALL_NAMESPACE"
|
-n "$DEFAULT_INSTALL_NAMESPACE"
|
||||||
|
|
||||||
|
|||||||
507
.github/scripts/package-lock.json
generated
vendored
507
.github/scripts/package-lock.json
generated
vendored
@@ -1,507 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "greptimedb-github-scripts",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"name": "greptimedb-github-scripts",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/rest": "^21.0.0",
|
|
||||||
"axios": "^1.7.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/auth-token": {
|
|
||||||
"version": "5.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-5.1.2.tgz",
|
|
||||||
"integrity": "sha512-JcQDsBdg49Yky2w2ld20IHAlwr8d/d8N6NiOXbtuoPCqzbsiJgF633mVUw3x4mo0H5ypataQIX7SFu3yy44Mpw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/core": {
|
|
||||||
"version": "6.1.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-6.1.6.tgz",
|
|
||||||
"integrity": "sha512-kIU8SLQkYWGp3pVKiYzA5OSaNF5EE03P/R8zEmmrG6XwOg5oBjXyQVVIauQ0dgau4zYhpZEhJrvIYt6oM+zZZA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/auth-token": "^5.0.0",
|
|
||||||
"@octokit/graphql": "^8.2.2",
|
|
||||||
"@octokit/request": "^9.2.3",
|
|
||||||
"@octokit/request-error": "^6.1.8",
|
|
||||||
"@octokit/types": "^14.0.0",
|
|
||||||
"before-after-hook": "^3.0.2",
|
|
||||||
"universal-user-agent": "^7.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/endpoint": {
|
|
||||||
"version": "10.1.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-10.1.4.tgz",
|
|
||||||
"integrity": "sha512-OlYOlZIsfEVZm5HCSR8aSg02T2lbUWOsCQoPKfTXJwDzcHQBrVBGdGXb89dv2Kw2ToZaRtudp8O3ZIYoaOjKlA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/types": "^14.0.0",
|
|
||||||
"universal-user-agent": "^7.0.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/graphql": {
|
|
||||||
"version": "8.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-8.2.2.tgz",
|
|
||||||
"integrity": "sha512-Yi8hcoqsrXGdt0yObxbebHXFOiUA+2v3n53epuOg1QUgOB6c4XzvisBNVXJSl8RYA5KrDuSL2yq9Qmqe5N0ryA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/request": "^9.2.3",
|
|
||||||
"@octokit/types": "^14.0.0",
|
|
||||||
"universal-user-agent": "^7.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/openapi-types": {
|
|
||||||
"version": "25.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-25.1.0.tgz",
|
|
||||||
"integrity": "sha512-idsIggNXUKkk0+BExUn1dQ92sfysJrje03Q0bv0e+KPLrvyqZF8MnBpFz8UNfYDwB3Ie7Z0TByjWfzxt7vseaA==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-paginate-rest": {
|
|
||||||
"version": "11.6.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.6.0.tgz",
|
|
||||||
"integrity": "sha512-n5KPteiF7pWKgBIBJSk8qzoZWcUkza2O6A0za97pMGVrGfPdltxrfmfF5GucHYvHGZD8BdaZmmHGz5cX/3gdpw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/types": "^13.10.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@octokit/core": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/openapi-types": {
|
|
||||||
"version": "24.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
|
|
||||||
"integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-paginate-rest/node_modules/@octokit/types": {
|
|
||||||
"version": "13.10.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
|
|
||||||
"integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/openapi-types": "^24.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-request-log": {
|
|
||||||
"version": "5.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-5.3.1.tgz",
|
|
||||||
"integrity": "sha512-n/lNeCtq+9ofhC15xzmJCNKP2BWTv8Ih2TTy+jatNCCq/gQP/V7rK3fjIfuz0pDWDALO/o/4QY4hyOF6TQQFUw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@octokit/core": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-rest-endpoint-methods": {
|
|
||||||
"version": "13.5.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.5.0.tgz",
|
|
||||||
"integrity": "sha512-9Pas60Iv9ejO3WlAX3maE1+38c5nqbJXV5GrncEfkndIpZrJ/WPMRd2xYDcPPEt5yzpxcjw9fWNoPhsSGzqKqw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/types": "^13.10.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
},
|
|
||||||
"peerDependencies": {
|
|
||||||
"@octokit/core": ">=6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/openapi-types": {
|
|
||||||
"version": "24.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
|
|
||||||
"integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/plugin-rest-endpoint-methods/node_modules/@octokit/types": {
|
|
||||||
"version": "13.10.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
|
|
||||||
"integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/openapi-types": "^24.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/request": {
|
|
||||||
"version": "9.2.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-9.2.4.tgz",
|
|
||||||
"integrity": "sha512-q8ybdytBmxa6KogWlNa818r0k1wlqzNC+yNkcQDECHvQo8Vmstrg18JwqJHdJdUiHD2sjlwBgSm9kHkOKe2iyA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/endpoint": "^10.1.4",
|
|
||||||
"@octokit/request-error": "^6.1.8",
|
|
||||||
"@octokit/types": "^14.0.0",
|
|
||||||
"fast-content-type-parse": "^2.0.0",
|
|
||||||
"universal-user-agent": "^7.0.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/request-error": {
|
|
||||||
"version": "6.1.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-6.1.8.tgz",
|
|
||||||
"integrity": "sha512-WEi/R0Jmq+IJKydWlKDmryPcmdYSVjL3ekaiEL1L9eo1sUnqMJ+grqmC9cjk7CA7+b2/T397tO5d8YLOH3qYpQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/types": "^14.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/rest": {
|
|
||||||
"version": "21.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-21.1.1.tgz",
|
|
||||||
"integrity": "sha512-sTQV7va0IUVZcntzy1q3QqPm/r8rWtDCqpRAmb8eXXnKkjoQEtFe3Nt5GTVsHft+R6jJoHeSiVLcgcvhtue/rg==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/core": "^6.1.4",
|
|
||||||
"@octokit/plugin-paginate-rest": "^11.4.2",
|
|
||||||
"@octokit/plugin-request-log": "^5.3.1",
|
|
||||||
"@octokit/plugin-rest-endpoint-methods": "^13.3.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 18"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@octokit/types": {
|
|
||||||
"version": "14.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-14.1.0.tgz",
|
|
||||||
"integrity": "sha512-1y6DgTy8Jomcpu33N+p5w58l6xyt55Ar2I91RPiIA0xCJBXyUAhXCcmZaDWSANiha7R9a6qJJ2CRomGPZ6f46g==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/openapi-types": "^25.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/asynckit": {
|
|
||||||
"version": "0.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
|
||||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/axios": {
|
|
||||||
"version": "1.12.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
|
||||||
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"follow-redirects": "^1.15.6",
|
|
||||||
"form-data": "^4.0.4",
|
|
||||||
"proxy-from-env": "^1.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/before-after-hook": {
|
|
||||||
"version": "3.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-3.0.2.tgz",
|
|
||||||
"integrity": "sha512-Nik3Sc0ncrMK4UUdXQmAnRtzmNQTAAXmXIopizwZ1W1t8QmfJj+zL4OA2I7XPTPW5z5TDqv4hRo/JzouDJnX3A==",
|
|
||||||
"license": "Apache-2.0"
|
|
||||||
},
|
|
||||||
"node_modules/call-bind-apply-helpers": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"es-errors": "^1.3.0",
|
|
||||||
"function-bind": "^1.1.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/combined-stream": {
|
|
||||||
"version": "1.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
|
||||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"delayed-stream": "~1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/delayed-stream": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.4.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/dunder-proto": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"call-bind-apply-helpers": "^1.0.1",
|
|
||||||
"es-errors": "^1.3.0",
|
|
||||||
"gopd": "^1.2.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/es-define-property": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/es-errors": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/es-object-atoms": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"es-errors": "^1.3.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/es-set-tostringtag": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"es-errors": "^1.3.0",
|
|
||||||
"get-intrinsic": "^1.2.6",
|
|
||||||
"has-tostringtag": "^1.0.2",
|
|
||||||
"hasown": "^2.0.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/fast-content-type-parse": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-nGqtvLrj5w0naR6tDPfB4cUmYCqouzyQiz6C5y/LtcDllJdrcc6WaWW6iXyIIOErTa/XRybj28aasdn4LkVk6Q==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/fastify"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/fastify"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/follow-redirects": {
|
|
||||||
"version": "1.15.11",
|
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
|
|
||||||
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "individual",
|
|
||||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">=4.0"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"debug": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/form-data": {
|
|
||||||
"version": "4.0.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
|
|
||||||
"integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"asynckit": "^0.4.0",
|
|
||||||
"combined-stream": "^1.0.8",
|
|
||||||
"es-set-tostringtag": "^2.1.0",
|
|
||||||
"hasown": "^2.0.2",
|
|
||||||
"mime-types": "^2.1.12"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/function-bind": {
|
|
||||||
"version": "1.1.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
|
||||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/get-intrinsic": {
|
|
||||||
"version": "1.3.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
|
||||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"call-bind-apply-helpers": "^1.0.2",
|
|
||||||
"es-define-property": "^1.0.1",
|
|
||||||
"es-errors": "^1.3.0",
|
|
||||||
"es-object-atoms": "^1.1.1",
|
|
||||||
"function-bind": "^1.1.2",
|
|
||||||
"get-proto": "^1.0.1",
|
|
||||||
"gopd": "^1.2.0",
|
|
||||||
"has-symbols": "^1.1.0",
|
|
||||||
"hasown": "^2.0.2",
|
|
||||||
"math-intrinsics": "^1.1.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/get-proto": {
|
|
||||||
"version": "1.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
|
||||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"dunder-proto": "^1.0.1",
|
|
||||||
"es-object-atoms": "^1.0.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/gopd": {
|
|
||||||
"version": "1.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
|
||||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/has-symbols": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
|
||||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/has-tostringtag": {
|
|
||||||
"version": "1.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
|
|
||||||
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"has-symbols": "^1.0.3"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/hasown": {
|
|
||||||
"version": "2.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
|
||||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"function-bind": "^1.1.2"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/math-intrinsics": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
|
||||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mime-db": {
|
|
||||||
"version": "1.52.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
|
||||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mime-types": {
|
|
||||||
"version": "2.1.35",
|
|
||||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
|
||||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"mime-db": "1.52.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/proxy-from-env": {
|
|
||||||
"version": "1.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
|
||||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/universal-user-agent": {
|
|
||||||
"version": "7.0.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
|
|
||||||
"integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
|
|
||||||
"license": "ISC"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
10
.github/scripts/package.json
vendored
10
.github/scripts/package.json
vendored
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "greptimedb-github-scripts",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"type": "module",
|
|
||||||
"description": "GitHub automation scripts for GreptimeDB",
|
|
||||||
"dependencies": {
|
|
||||||
"@octokit/rest": "^21.0.0",
|
|
||||||
"axios": "^1.7.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
152
.github/scripts/pr-review-reminder.js
vendored
152
.github/scripts/pr-review-reminder.js
vendored
@@ -1,152 +0,0 @@
|
|||||||
// Daily PR Review Reminder Script
|
|
||||||
// Fetches open PRs from GreptimeDB repository and sends Slack notifications
|
|
||||||
// to PR owners and assigned reviewers to keep review process moving.
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
const { Octokit } = await import("@octokit/rest");
|
|
||||||
const { default: axios } = await import('axios');
|
|
||||||
|
|
||||||
// Configuration
|
|
||||||
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
|
|
||||||
const SLACK_WEBHOOK_URL = process.env.SLACK_PR_REVIEW_WEBHOOK_URL;
|
|
||||||
const REPO_OWNER = "GreptimeTeam";
|
|
||||||
const REPO_NAME = "greptimedb";
|
|
||||||
const GITHUB_TO_SLACK = JSON.parse(process.env.GITHUBID_SLACKID_MAPPING || '{}');
|
|
||||||
|
|
||||||
// Debug: Print environment variable status
|
|
||||||
console.log("=== Environment Variables Debug ===");
|
|
||||||
console.log(`GITHUB_TOKEN: ${GITHUB_TOKEN ? 'Set ✓' : 'NOT SET ✗'}`);
|
|
||||||
console.log(`SLACK_PR_REVIEW_WEBHOOK_URL: ${SLACK_WEBHOOK_URL ? 'Set ✓' : 'NOT SET ✗'}`);
|
|
||||||
console.log(`GITHUBID_SLACKID_MAPPING: ${process.env.GITHUBID_SLACKID_MAPPING ? `Set ✓ (${Object.keys(GITHUB_TO_SLACK).length} mappings)` : 'NOT SET ✗'}`);
|
|
||||||
console.log("===================================\n");
|
|
||||||
|
|
||||||
const octokit = new Octokit({
|
|
||||||
auth: GITHUB_TOKEN
|
|
||||||
});
|
|
||||||
|
|
||||||
// Fetch all open PRs from the repository
|
|
||||||
async function fetchOpenPRs() {
|
|
||||||
try {
|
|
||||||
const prs = await octokit.pulls.list({
|
|
||||||
owner: REPO_OWNER,
|
|
||||||
repo: REPO_NAME,
|
|
||||||
state: "open",
|
|
||||||
per_page: 100,
|
|
||||||
sort: "created",
|
|
||||||
direction: "asc"
|
|
||||||
});
|
|
||||||
return prs.data.filter((pr) => !pr.draft);
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error fetching PRs:", error);
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert GitHub username to Slack mention or fallback to GitHub username
|
|
||||||
function toSlackMention(githubUser) {
|
|
||||||
const slackUserId = GITHUB_TO_SLACK[githubUser];
|
|
||||||
return slackUserId ? `<@${slackUserId}>` : `@${githubUser}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate days since PR was opened
|
|
||||||
function getDaysOpen(createdAt) {
|
|
||||||
const created = new Date(createdAt);
|
|
||||||
const now = new Date();
|
|
||||||
const diffMs = now - created;
|
|
||||||
const days = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
|
||||||
return days;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build Slack notification message from PR list
|
|
||||||
function buildSlackMessage(prs) {
|
|
||||||
if (prs.length === 0) {
|
|
||||||
return "*🎉 Great job! No pending PRs for review.*";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Separate PRs by age threshold (14 days)
|
|
||||||
const criticalPRs = [];
|
|
||||||
const recentPRs = [];
|
|
||||||
|
|
||||||
prs.forEach(pr => {
|
|
||||||
const daysOpen = getDaysOpen(pr.created_at);
|
|
||||||
if (daysOpen >= 14) {
|
|
||||||
criticalPRs.push(pr);
|
|
||||||
} else {
|
|
||||||
recentPRs.push(pr);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const lines = [
|
|
||||||
`*🔍 Daily PR Review Reminder 🔍*`,
|
|
||||||
`Found *${criticalPRs.length}* critical PR(s) (14+ days old)\n`
|
|
||||||
];
|
|
||||||
|
|
||||||
// Show critical PRs (14+ days) in detail
|
|
||||||
if (criticalPRs.length > 0) {
|
|
||||||
criticalPRs.forEach((pr, index) => {
|
|
||||||
const owner = toSlackMention(pr.user.login);
|
|
||||||
const reviewers = pr.requested_reviewers || [];
|
|
||||||
const reviewerMentions = reviewers.map(r => toSlackMention(r.login)).join(", ");
|
|
||||||
const daysOpen = getDaysOpen(pr.created_at);
|
|
||||||
|
|
||||||
const prInfo = `${index + 1}. <${pr.html_url}|#${pr.number}: ${pr.title}>`;
|
|
||||||
const ageInfo = ` 🔴 Opened *${daysOpen}* day(s) ago`;
|
|
||||||
const ownerInfo = ` 👤 Owner: ${owner}`;
|
|
||||||
const reviewerInfo = reviewers.length > 0
|
|
||||||
? ` 👁️ Reviewers: ${reviewerMentions}`
|
|
||||||
: ` 👁️ Reviewers: _Not assigned yet_`;
|
|
||||||
|
|
||||||
lines.push(prInfo);
|
|
||||||
lines.push(ageInfo);
|
|
||||||
lines.push(ownerInfo);
|
|
||||||
lines.push(reviewerInfo);
|
|
||||||
lines.push(""); // Empty line between PRs
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
lines.push("_Let's keep the code review process moving! 🚀_");
|
|
||||||
|
|
||||||
return lines.join("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send notification to Slack webhook
|
|
||||||
async function sendSlackNotification(message) {
|
|
||||||
if (!SLACK_WEBHOOK_URL) {
|
|
||||||
console.log("⚠️ SLACK_PR_REVIEW_WEBHOOK_URL not configured. Message preview:");
|
|
||||||
console.log("=".repeat(60));
|
|
||||||
console.log(message);
|
|
||||||
console.log("=".repeat(60));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await axios.post(SLACK_WEBHOOK_URL, {
|
|
||||||
text: message
|
|
||||||
});
|
|
||||||
|
|
||||||
if (response.status !== 200) {
|
|
||||||
throw new Error(`Slack API returned status ${response.status}`);
|
|
||||||
}
|
|
||||||
console.log("Slack notification sent successfully.");
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error sending Slack notification:", error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Main execution flow
|
|
||||||
async function run() {
|
|
||||||
console.log(`Fetching open PRs from ${REPO_OWNER}/${REPO_NAME}...`);
|
|
||||||
const prs = await fetchOpenPRs();
|
|
||||||
console.log(`Found ${prs.length} open PR(s).`);
|
|
||||||
|
|
||||||
const message = buildSlackMessage(prs);
|
|
||||||
console.log("Sending Slack notification...");
|
|
||||||
await sendSlackNotification(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
run().catch(error => {
|
|
||||||
console.error("Script execution failed:", error);
|
|
||||||
process.exit(1);
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
34
.github/scripts/pull-test-deps-images.sh
vendored
34
.github/scripts/pull-test-deps-images.sh
vendored
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# This script is used to pull the test dependency images that are stored in public ECR one by one to avoid rate limiting.
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
MAX_RETRIES=3
|
|
||||||
|
|
||||||
IMAGES=(
|
|
||||||
"greptime/zookeeper:3.7"
|
|
||||||
"greptime/kafka:3.9.0-debian-12-r1"
|
|
||||||
"greptime/etcd:3.6.1-debian-12-r3"
|
|
||||||
"greptime/minio:2024"
|
|
||||||
"greptime/mysql:5.7"
|
|
||||||
)
|
|
||||||
|
|
||||||
for image in "${IMAGES[@]}"; do
|
|
||||||
for ((attempt=1; attempt<=MAX_RETRIES; attempt++)); do
|
|
||||||
if docker pull "$image"; then
|
|
||||||
# Successfully pulled the image.
|
|
||||||
break
|
|
||||||
else
|
|
||||||
# Use some simple exponential backoff to avoid rate limiting.
|
|
||||||
if [ $attempt -lt $MAX_RETRIES ]; then
|
|
||||||
sleep_seconds=$((attempt * 5))
|
|
||||||
echo "Attempt $attempt failed for $image, waiting $sleep_seconds seconds"
|
|
||||||
sleep $sleep_seconds # 5s, 10s delays
|
|
||||||
else
|
|
||||||
echo "Failed to pull $image after $MAX_RETRIES attempts"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
|
||||||
@@ -21,7 +21,7 @@ update_dev_builder_version() {
|
|||||||
|
|
||||||
# Commit the changes.
|
# Commit the changes.
|
||||||
git add Makefile
|
git add Makefile
|
||||||
git commit -s -m "ci: update dev-builder image tag"
|
git commit -m "ci: update dev-builder image tag"
|
||||||
git push origin $BRANCH_NAME
|
git push origin $BRANCH_NAME
|
||||||
|
|
||||||
# Create a Pull Request.
|
# Create a Pull Request.
|
||||||
|
|||||||
@@ -39,11 +39,8 @@ update_helm_charts_version() {
|
|||||||
--body "This PR updates the GreptimeDB version." \
|
--body "This PR updates the GreptimeDB version." \
|
||||||
--base main \
|
--base main \
|
||||||
--head $BRANCH_NAME \
|
--head $BRANCH_NAME \
|
||||||
--reviewer sunng87 \
|
--reviewer zyy17 \
|
||||||
--reviewer daviderli614 \
|
--reviewer daviderli614
|
||||||
--reviewer killme2008 \
|
|
||||||
--reviewer evenyag \
|
|
||||||
--reviewer fengjiachun
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_helm_charts_version
|
update_helm_charts_version
|
||||||
|
|||||||
@@ -35,11 +35,8 @@ update_homebrew_greptime_version() {
|
|||||||
--body "This PR updates the GreptimeDB version." \
|
--body "This PR updates the GreptimeDB version." \
|
||||||
--base main \
|
--base main \
|
||||||
--head $BRANCH_NAME \
|
--head $BRANCH_NAME \
|
||||||
--reviewer sunng87 \
|
--reviewer zyy17 \
|
||||||
--reviewer daviderli614 \
|
--reviewer daviderli614
|
||||||
--reviewer killme2008 \
|
|
||||||
--reviewer evenyag \
|
|
||||||
--reviewer fengjiachun
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_homebrew_greptime_version
|
update_homebrew_greptime_version
|
||||||
|
|||||||
9
.github/workflows/dev-build.yml
vendored
9
.github/workflows/dev-build.yml
vendored
@@ -4,11 +4,10 @@ name: GreptimeDB Development Build
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch: # Allows you to run this workflow manually.
|
workflow_dispatch: # Allows you to run this workflow manually.
|
||||||
inputs:
|
inputs:
|
||||||
large-page-size:
|
repository:
|
||||||
description: Build GreptimeDB with large page size (65536).
|
description: The public repository to build
|
||||||
type: boolean
|
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: GreptimeTeam/greptimedb
|
||||||
commit: # Note: We only pull the source code and use the current workflow to build the artifacts.
|
commit: # Note: We only pull the source code and use the current workflow to build the artifacts.
|
||||||
description: The commit to build
|
description: The commit to build
|
||||||
required: true
|
required: true
|
||||||
@@ -182,7 +181,6 @@ jobs:
|
|||||||
working-dir: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
|
working-dir: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
|
||||||
image-registry: ${{ vars.ECR_IMAGE_REGISTRY }}
|
image-registry: ${{ vars.ECR_IMAGE_REGISTRY }}
|
||||||
image-namespace: ${{ vars.ECR_IMAGE_NAMESPACE }}
|
image-namespace: ${{ vars.ECR_IMAGE_NAMESPACE }}
|
||||||
large-page-size: ${{ inputs.large-page-size }}
|
|
||||||
|
|
||||||
build-linux-arm64-artifacts:
|
build-linux-arm64-artifacts:
|
||||||
name: Build linux-arm64 artifacts
|
name: Build linux-arm64 artifacts
|
||||||
@@ -216,7 +214,6 @@ jobs:
|
|||||||
working-dir: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
|
working-dir: ${{ env.CHECKOUT_GREPTIMEDB_PATH }}
|
||||||
image-registry: ${{ vars.ECR_IMAGE_REGISTRY }}
|
image-registry: ${{ vars.ECR_IMAGE_REGISTRY }}
|
||||||
image-namespace: ${{ vars.ECR_IMAGE_NAMESPACE }}
|
image-namespace: ${{ vars.ECR_IMAGE_NAMESPACE }}
|
||||||
large-page-size: ${{ inputs.large-page-size }}
|
|
||||||
|
|
||||||
release-images-to-dockerhub:
|
release-images-to-dockerhub:
|
||||||
name: Build and push images to DockerHub
|
name: Build and push images to DockerHub
|
||||||
|
|||||||
52
.github/workflows/develop.yml
vendored
52
.github/workflows/develop.yml
vendored
@@ -12,7 +12,6 @@ on:
|
|||||||
- 'docker/**'
|
- 'docker/**'
|
||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
- 'grafana/**'
|
- 'grafana/**'
|
||||||
- 'Makefile'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
name: CI
|
name: CI
|
||||||
@@ -613,20 +612,15 @@ jobs:
|
|||||||
- name: "MySQL Kvbackend"
|
- name: "MySQL Kvbackend"
|
||||||
opts: "--setup-mysql"
|
opts: "--setup-mysql"
|
||||||
kafka: false
|
kafka: false
|
||||||
- name: "Flat format"
|
|
||||||
opts: "--enable-flat-format"
|
|
||||||
kafka: false
|
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
|
||||||
- if: matrix.mode.kafka
|
- if: matrix.mode.kafka
|
||||||
name: Setup kafka server
|
name: Setup kafka server
|
||||||
working-directory: tests-integration/fixtures
|
working-directory: tests-integration/fixtures
|
||||||
run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait kafka
|
run: docker compose up -d --wait kafka
|
||||||
|
|
||||||
- name: Download pre-built binaries
|
- name: Download pre-built binaries
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -635,7 +629,7 @@ jobs:
|
|||||||
- name: Unzip binaries
|
- name: Unzip binaries
|
||||||
run: tar -xvf ./bins.tar.gz
|
run: tar -xvf ./bins.tar.gz
|
||||||
- name: Run sqlness
|
- name: Run sqlness
|
||||||
run: RUST_BACKTRACE=1 ./bins/sqlness-runner bare ${{ matrix.mode.opts }} -c ./tests/cases --bins-dir ./bins --preserve-state
|
run: RUST_BACKTRACE=1 ./bins/sqlness-runner ${{ matrix.mode.opts }} -c ./tests/cases --bins-dir ./bins --preserve-state
|
||||||
- name: Upload sqlness logs
|
- name: Upload sqlness logs
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -688,30 +682,6 @@ jobs:
|
|||||||
- name: Run cargo clippy
|
- name: Run cargo clippy
|
||||||
run: make clippy
|
run: make clippy
|
||||||
|
|
||||||
check-udeps:
|
|
||||||
if: ${{ github.repository == 'GreptimeTeam/greptimedb' }}
|
|
||||||
name: Check Unused Dependencies
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 60
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
- uses: arduino/setup-protoc@v3
|
|
||||||
with:
|
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
||||||
- name: Rust Cache
|
|
||||||
uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
shared-key: "check-udeps"
|
|
||||||
cache-all-crates: "true"
|
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
||||||
- name: Install cargo-udeps
|
|
||||||
run: cargo install cargo-udeps --locked
|
|
||||||
- name: Check unused dependencies
|
|
||||||
run: make check-udeps
|
|
||||||
|
|
||||||
conflict-check:
|
conflict-check:
|
||||||
if: ${{ github.repository == 'GreptimeTeam/greptimedb' }}
|
if: ${{ github.repository == 'GreptimeTeam/greptimedb' }}
|
||||||
name: Check for conflict
|
name: Check for conflict
|
||||||
@@ -727,7 +697,7 @@ jobs:
|
|||||||
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && github.event_name != 'merge_group' }}
|
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && github.event_name != 'merge_group' }}
|
||||||
runs-on: ubuntu-22.04-arm
|
runs-on: ubuntu-22.04-arm
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
needs: [conflict-check, clippy, fmt, check-udeps]
|
needs: [conflict-check, clippy, fmt]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@@ -739,7 +709,7 @@ jobs:
|
|||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
cache: false
|
cache: false
|
||||||
- name: Rust Cache
|
- name: Rust Cache
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
@@ -749,11 +719,9 @@ jobs:
|
|||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
- name: Install latest nextest release
|
- name: Install latest nextest release
|
||||||
uses: taiki-e/install-action@nextest
|
uses: taiki-e/install-action@nextest
|
||||||
|
|
||||||
- name: Setup external services
|
- name: Setup external services
|
||||||
working-directory: tests-integration/fixtures
|
working-directory: tests-integration/fixtures
|
||||||
run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait
|
run: docker compose up -d --wait
|
||||||
|
|
||||||
- name: Run nextest cases
|
- name: Run nextest cases
|
||||||
run: cargo nextest run --workspace -F dashboard -F pg_kvbackend -F mysql_kvbackend
|
run: cargo nextest run --workspace -F dashboard -F pg_kvbackend -F mysql_kvbackend
|
||||||
env:
|
env:
|
||||||
@@ -770,11 +738,8 @@ jobs:
|
|||||||
GT_MINIO_ACCESS_KEY: superpower_password
|
GT_MINIO_ACCESS_KEY: superpower_password
|
||||||
GT_MINIO_REGION: us-west-2
|
GT_MINIO_REGION: us-west-2
|
||||||
GT_MINIO_ENDPOINT_URL: http://127.0.0.1:9000
|
GT_MINIO_ENDPOINT_URL: http://127.0.0.1:9000
|
||||||
GT_ETCD_TLS_ENDPOINTS: https://127.0.0.1:2378
|
|
||||||
GT_ETCD_ENDPOINTS: http://127.0.0.1:2379
|
GT_ETCD_ENDPOINTS: http://127.0.0.1:2379
|
||||||
GT_POSTGRES_ENDPOINTS: postgres://greptimedb:admin@127.0.0.1:5432/postgres
|
GT_POSTGRES_ENDPOINTS: postgres://greptimedb:admin@127.0.0.1:5432/postgres
|
||||||
GT_POSTGRES15_ENDPOINTS: postgres://test_user:test_password@127.0.0.1:5433/postgres
|
|
||||||
GT_POSTGRES15_SCHEMA: test_schema
|
|
||||||
GT_MYSQL_ENDPOINTS: mysql://greptimedb:admin@127.0.0.1:3306/mysql
|
GT_MYSQL_ENDPOINTS: mysql://greptimedb:admin@127.0.0.1:3306/mysql
|
||||||
GT_KAFKA_ENDPOINTS: 127.0.0.1:9092
|
GT_KAFKA_ENDPOINTS: 127.0.0.1:9092
|
||||||
GT_KAFKA_SASL_ENDPOINTS: 127.0.0.1:9093
|
GT_KAFKA_SASL_ENDPOINTS: 127.0.0.1:9093
|
||||||
@@ -807,11 +772,9 @@ jobs:
|
|||||||
uses: taiki-e/install-action@nextest
|
uses: taiki-e/install-action@nextest
|
||||||
- name: Install cargo-llvm-cov
|
- name: Install cargo-llvm-cov
|
||||||
uses: taiki-e/install-action@cargo-llvm-cov
|
uses: taiki-e/install-action@cargo-llvm-cov
|
||||||
|
|
||||||
- name: Setup external services
|
- name: Setup external services
|
||||||
working-directory: tests-integration/fixtures
|
working-directory: tests-integration/fixtures
|
||||||
run: ../../.github/scripts/pull-test-deps-images.sh && docker compose up -d --wait
|
run: docker compose up -d --wait
|
||||||
|
|
||||||
- name: Run nextest cases
|
- name: Run nextest cases
|
||||||
run: cargo llvm-cov nextest --workspace --lcov --output-path lcov.info -F dashboard -F pg_kvbackend -F mysql_kvbackend
|
run: cargo llvm-cov nextest --workspace --lcov --output-path lcov.info -F dashboard -F pg_kvbackend -F mysql_kvbackend
|
||||||
env:
|
env:
|
||||||
@@ -827,11 +790,8 @@ jobs:
|
|||||||
GT_MINIO_ACCESS_KEY: superpower_password
|
GT_MINIO_ACCESS_KEY: superpower_password
|
||||||
GT_MINIO_REGION: us-west-2
|
GT_MINIO_REGION: us-west-2
|
||||||
GT_MINIO_ENDPOINT_URL: http://127.0.0.1:9000
|
GT_MINIO_ENDPOINT_URL: http://127.0.0.1:9000
|
||||||
GT_ETCD_TLS_ENDPOINTS: https://127.0.0.1:2378
|
|
||||||
GT_ETCD_ENDPOINTS: http://127.0.0.1:2379
|
GT_ETCD_ENDPOINTS: http://127.0.0.1:2379
|
||||||
GT_POSTGRES_ENDPOINTS: postgres://greptimedb:admin@127.0.0.1:5432/postgres
|
GT_POSTGRES_ENDPOINTS: postgres://greptimedb:admin@127.0.0.1:5432/postgres
|
||||||
GT_POSTGRES15_ENDPOINTS: postgres://test_user:test_password@127.0.0.1:5433/postgres
|
|
||||||
GT_POSTGRES15_SCHEMA: test_schema
|
|
||||||
GT_MYSQL_ENDPOINTS: mysql://greptimedb:admin@127.0.0.1:3306/mysql
|
GT_MYSQL_ENDPOINTS: mysql://greptimedb:admin@127.0.0.1:3306/mysql
|
||||||
GT_KAFKA_ENDPOINTS: 127.0.0.1:9092
|
GT_KAFKA_ENDPOINTS: 127.0.0.1:9092
|
||||||
GT_KAFKA_SASL_ENDPOINTS: 127.0.0.1:9093
|
GT_KAFKA_SASL_ENDPOINTS: 127.0.0.1:9093
|
||||||
|
|||||||
9
.github/workflows/docs.yml
vendored
9
.github/workflows/docs.yml
vendored
@@ -10,7 +10,6 @@ on:
|
|||||||
- 'docker/**'
|
- 'docker/**'
|
||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
- 'grafana/**'
|
- 'grafana/**'
|
||||||
- 'Makefile'
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
@@ -22,7 +21,6 @@ on:
|
|||||||
- 'docker/**'
|
- 'docker/**'
|
||||||
- '.gitignore'
|
- '.gitignore'
|
||||||
- 'grafana/**'
|
- 'grafana/**'
|
||||||
- 'Makefile'
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
name: CI
|
name: CI
|
||||||
@@ -67,12 +65,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- run: 'echo "No action required"'
|
- run: 'echo "No action required"'
|
||||||
|
|
||||||
check-udeps:
|
|
||||||
name: Unused Dependencies
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- run: 'echo "No action required"'
|
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -92,6 +84,5 @@ jobs:
|
|||||||
mode:
|
mode:
|
||||||
- name: "Basic"
|
- name: "Basic"
|
||||||
- name: "Remote WAL"
|
- name: "Remote WAL"
|
||||||
- name: "Flat format"
|
|
||||||
steps:
|
steps:
|
||||||
- run: 'echo "No action required"'
|
- run: 'echo "No action required"'
|
||||||
|
|||||||
57
.github/workflows/multi-lang-tests.yml
vendored
57
.github/workflows/multi-lang-tests.yml
vendored
@@ -1,57 +0,0 @@
|
|||||||
name: Multi-language Integration Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-greptimedb:
|
|
||||||
if: ${{ github.repository == 'GreptimeTeam/greptimedb' }}
|
|
||||||
name: Build GreptimeDB binary
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 60
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
- uses: arduino/setup-protoc@v3
|
|
||||||
with:
|
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
shared-key: "multi-lang-build"
|
|
||||||
cache-all-crates: "true"
|
|
||||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
||||||
- name: Install cargo-gc-bin
|
|
||||||
shell: bash
|
|
||||||
run: cargo install cargo-gc-bin --force
|
|
||||||
- name: Build greptime binary
|
|
||||||
shell: bash
|
|
||||||
run: cargo gc -- --bin greptime --features "pg_kvbackend,mysql_kvbackend"
|
|
||||||
- name: Pack greptime binary
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
mkdir bin && \
|
|
||||||
mv ./target/debug/greptime bin
|
|
||||||
- name: Print greptime binary info
|
|
||||||
run: ls -lh bin
|
|
||||||
- name: Upload greptime binary
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: greptime-bin
|
|
||||||
path: bin/
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
run-multi-lang-tests:
|
|
||||||
name: Run Multi-language SDK Tests
|
|
||||||
needs: build-greptimedb
|
|
||||||
uses: ./.github/workflows/run-multi-lang-tests.yml
|
|
||||||
with:
|
|
||||||
artifact-name: greptime-bin
|
|
||||||
21
.github/workflows/nightly-build.yml
vendored
21
.github/workflows/nightly-build.yml
vendored
@@ -174,18 +174,6 @@ jobs:
|
|||||||
image-registry: ${{ vars.ECR_IMAGE_REGISTRY }}
|
image-registry: ${{ vars.ECR_IMAGE_REGISTRY }}
|
||||||
image-namespace: ${{ vars.ECR_IMAGE_NAMESPACE }}
|
image-namespace: ${{ vars.ECR_IMAGE_NAMESPACE }}
|
||||||
|
|
||||||
run-multi-lang-tests:
|
|
||||||
name: Run Multi-language SDK Tests
|
|
||||||
if: ${{ inputs.build_linux_amd64_artifacts || github.event_name == 'schedule' }}
|
|
||||||
needs: [
|
|
||||||
allocate-runners,
|
|
||||||
build-linux-amd64-artifacts,
|
|
||||||
]
|
|
||||||
uses: ./.github/workflows/run-multi-lang-tests.yml
|
|
||||||
with:
|
|
||||||
artifact-name: greptime-linux-amd64-${{ needs.allocate-runners.outputs.version }}
|
|
||||||
artifact-is-tarball: true
|
|
||||||
|
|
||||||
release-images-to-dockerhub:
|
release-images-to-dockerhub:
|
||||||
name: Build and push images to DockerHub
|
name: Build and push images to DockerHub
|
||||||
if: ${{ inputs.release_images || github.event_name == 'schedule' }}
|
if: ${{ inputs.release_images || github.event_name == 'schedule' }}
|
||||||
@@ -313,8 +301,7 @@ jobs:
|
|||||||
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && always() }} # Not requiring successful dependent jobs, always run.
|
if: ${{ github.repository == 'GreptimeTeam/greptimedb' && always() }} # Not requiring successful dependent jobs, always run.
|
||||||
name: Send notification to Greptime team
|
name: Send notification to Greptime team
|
||||||
needs: [
|
needs: [
|
||||||
release-images-to-dockerhub,
|
release-images-to-dockerhub
|
||||||
run-multi-lang-tests,
|
|
||||||
]
|
]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
@@ -332,17 +319,17 @@ jobs:
|
|||||||
run: pnpm tsx bin/report-ci-failure.ts
|
run: pnpm tsx bin/report-ci-failure.ts
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CI_REPORT_STATUS: ${{ needs.release-images-to-dockerhub.outputs.nightly-build-result == 'success' && (needs.run-multi-lang-tests.result == 'success' || needs.run-multi-lang-tests.result == 'skipped') }}
|
CI_REPORT_STATUS: ${{ needs.release-images-to-dockerhub.outputs.nightly-build-result == 'success' }}
|
||||||
- name: Notify nightly build successful result
|
- name: Notify nightly build successful result
|
||||||
uses: slackapi/slack-github-action@v1.23.0
|
uses: slackapi/slack-github-action@v1.23.0
|
||||||
if: ${{ needs.release-images-to-dockerhub.outputs.nightly-build-result == 'success' && (needs.run-multi-lang-tests.result == 'success' || needs.run-multi-lang-tests.result == 'skipped') }}
|
if: ${{ needs.release-images-to-dockerhub.outputs.nightly-build-result == 'success' }}
|
||||||
with:
|
with:
|
||||||
payload: |
|
payload: |
|
||||||
{"text": "GreptimeDB's ${{ env.NEXT_RELEASE_VERSION }} build has completed successfully."}
|
{"text": "GreptimeDB's ${{ env.NEXT_RELEASE_VERSION }} build has completed successfully."}
|
||||||
|
|
||||||
- name: Notify nightly build failed result
|
- name: Notify nightly build failed result
|
||||||
uses: slackapi/slack-github-action@v1.23.0
|
uses: slackapi/slack-github-action@v1.23.0
|
||||||
if: ${{ needs.release-images-to-dockerhub.outputs.nightly-build-result != 'success' || needs.run-multi-lang-tests.result == 'failure' }}
|
if: ${{ needs.release-images-to-dockerhub.outputs.nightly-build-result != 'success' }}
|
||||||
with:
|
with:
|
||||||
payload: |
|
payload: |
|
||||||
{"text": "GreptimeDB's ${{ env.NEXT_RELEASE_VERSION }} build has failed, please check ${{ steps.report-ci-status.outputs.html_url }}."}
|
{"text": "GreptimeDB's ${{ env.NEXT_RELEASE_VERSION }} build has failed, please check ${{ steps.report-ci-status.outputs.html_url }}."}
|
||||||
|
|||||||
36
.github/workflows/pr-review-reminder.yml
vendored
36
.github/workflows/pr-review-reminder.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
name: PR Review Reminder
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
# Run at 9:00 AM UTC+8 (01:00 AM UTC) on Monday, Wednesday, Friday
|
|
||||||
- cron: '0 1 * * 1,3,5'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
pr-review-reminder:
|
|
||||||
name: Send PR Review Reminders
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: read
|
|
||||||
if: ${{ github.repository == 'GreptimeTeam/greptimedb' }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
working-directory: .github/scripts
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run PR review reminder
|
|
||||||
working-directory: .github/scripts
|
|
||||||
run: node pr-review-reminder.js
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
SLACK_PR_REVIEW_WEBHOOK_URL: ${{ vars.SLACK_PR_REVIEW_WEBHOOK_URL }}
|
|
||||||
GITHUBID_SLACKID_MAPPING: ${{ vars.GITHUBID_SLACKID_MAPPING }}
|
|
||||||
32
.github/workflows/release.yml
vendored
32
.github/workflows/release.yml
vendored
@@ -110,9 +110,6 @@ jobs:
|
|||||||
|
|
||||||
# The 'version' use as the global tag name of the release workflow.
|
# The 'version' use as the global tag name of the release workflow.
|
||||||
version: ${{ steps.create-version.outputs.version }}
|
version: ${{ steps.create-version.outputs.version }}
|
||||||
|
|
||||||
# The 'is-current-version-latest' determines whether to update 'latest' Docker tags and downstream repositories.
|
|
||||||
is-current-version-latest: ${{ steps.check-version.outputs.is-current-version-latest }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -138,11 +135,6 @@ jobs:
|
|||||||
GITHUB_REF_NAME: ${{ github.ref_name }}
|
GITHUB_REF_NAME: ${{ github.ref_name }}
|
||||||
NIGHTLY_RELEASE_PREFIX: ${{ env.NIGHTLY_RELEASE_PREFIX }}
|
NIGHTLY_RELEASE_PREFIX: ${{ env.NIGHTLY_RELEASE_PREFIX }}
|
||||||
|
|
||||||
- name: Check version
|
|
||||||
id: check-version
|
|
||||||
run: |
|
|
||||||
./.github/scripts/check-version.sh "${{ steps.create-version.outputs.version }}"
|
|
||||||
|
|
||||||
- name: Allocate linux-amd64 runner
|
- name: Allocate linux-amd64 runner
|
||||||
if: ${{ inputs.build_linux_amd64_artifacts || github.event_name == 'push' || github.event_name == 'schedule' }}
|
if: ${{ inputs.build_linux_amd64_artifacts || github.event_name == 'push' || github.event_name == 'schedule' }}
|
||||||
uses: ./.github/actions/start-runner
|
uses: ./.github/actions/start-runner
|
||||||
@@ -215,18 +207,6 @@ jobs:
|
|||||||
image-registry: ${{ vars.ECR_IMAGE_REGISTRY }}
|
image-registry: ${{ vars.ECR_IMAGE_REGISTRY }}
|
||||||
image-namespace: ${{ vars.ECR_IMAGE_NAMESPACE }}
|
image-namespace: ${{ vars.ECR_IMAGE_NAMESPACE }}
|
||||||
|
|
||||||
run-multi-lang-tests:
|
|
||||||
name: Run Multi-language SDK Tests
|
|
||||||
if: ${{ inputs.build_linux_amd64_artifacts || github.event_name == 'push' || github.event_name == 'schedule' }}
|
|
||||||
needs: [
|
|
||||||
allocate-runners,
|
|
||||||
build-linux-amd64-artifacts,
|
|
||||||
]
|
|
||||||
uses: ./.github/workflows/run-multi-lang-tests.yml
|
|
||||||
with:
|
|
||||||
artifact-name: greptime-linux-amd64-${{ needs.allocate-runners.outputs.version }}
|
|
||||||
artifact-is-tarball: true
|
|
||||||
|
|
||||||
build-macos-artifacts:
|
build-macos-artifacts:
|
||||||
name: Build macOS artifacts
|
name: Build macOS artifacts
|
||||||
strategy:
|
strategy:
|
||||||
@@ -315,7 +295,6 @@ jobs:
|
|||||||
allocate-runners,
|
allocate-runners,
|
||||||
build-linux-amd64-artifacts,
|
build-linux-amd64-artifacts,
|
||||||
build-linux-arm64-artifacts,
|
build-linux-arm64-artifacts,
|
||||||
run-multi-lang-tests,
|
|
||||||
]
|
]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
@@ -335,7 +314,7 @@ jobs:
|
|||||||
image-registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
image-registry-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
image-registry-password: ${{ secrets.DOCKERHUB_TOKEN }}
|
image-registry-password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
version: ${{ needs.allocate-runners.outputs.version }}
|
version: ${{ needs.allocate-runners.outputs.version }}
|
||||||
push-latest-tag: ${{ needs.allocate-runners.outputs.is-current-version-latest == 'true' && github.ref_type == 'tag' && !contains(github.ref_name, 'nightly') && github.event_name != 'schedule' }}
|
push-latest-tag: ${{ github.ref_type == 'tag' && !contains(github.ref_name, 'nightly') && github.event_name != 'schedule' }}
|
||||||
|
|
||||||
- name: Set build image result
|
- name: Set build image result
|
||||||
id: set-build-image-result
|
id: set-build-image-result
|
||||||
@@ -353,7 +332,7 @@ jobs:
|
|||||||
build-windows-artifacts,
|
build-windows-artifacts,
|
||||||
release-images-to-dockerhub,
|
release-images-to-dockerhub,
|
||||||
]
|
]
|
||||||
runs-on: ubuntu-latest-16-cores
|
runs-on: ubuntu-latest
|
||||||
# When we push to ACR, it's easy to fail due to some unknown network issues.
|
# When we push to ACR, it's easy to fail due to some unknown network issues.
|
||||||
# However, we don't want to fail the whole workflow because of this.
|
# However, we don't want to fail the whole workflow because of this.
|
||||||
# The ACR have daily sync with DockerHub, so don't worry about the image not being updated.
|
# The ACR have daily sync with DockerHub, so don't worry about the image not being updated.
|
||||||
@@ -382,7 +361,7 @@ jobs:
|
|||||||
dev-mode: false
|
dev-mode: false
|
||||||
upload-to-s3: true
|
upload-to-s3: true
|
||||||
update-version-info: true
|
update-version-info: true
|
||||||
push-latest-tag: ${{ needs.allocate-runners.outputs.is-current-version-latest == 'true' && github.ref_type == 'tag' && !contains(github.ref_name, 'nightly') && github.event_name != 'schedule' }}
|
push-latest-tag: ${{ github.ref_type == 'tag' && !contains(github.ref_name, 'nightly') && github.event_name != 'schedule' }}
|
||||||
|
|
||||||
publish-github-release:
|
publish-github-release:
|
||||||
name: Create GitHub release and upload artifacts
|
name: Create GitHub release and upload artifacts
|
||||||
@@ -394,7 +373,6 @@ jobs:
|
|||||||
build-macos-artifacts,
|
build-macos-artifacts,
|
||||||
build-windows-artifacts,
|
build-windows-artifacts,
|
||||||
release-images-to-dockerhub,
|
release-images-to-dockerhub,
|
||||||
run-multi-lang-tests,
|
|
||||||
]
|
]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -491,7 +469,7 @@ jobs:
|
|||||||
|
|
||||||
bump-helm-charts-version:
|
bump-helm-charts-version:
|
||||||
name: Bump helm charts version
|
name: Bump helm charts version
|
||||||
if: ${{ github.ref_type == 'tag' && !contains(github.ref_name, 'nightly') && github.event_name != 'schedule' && needs.allocate-runners.outputs.is-current-version-latest == 'true' }}
|
if: ${{ github.ref_type == 'tag' && !contains(github.ref_name, 'nightly') && github.event_name != 'schedule' }}
|
||||||
needs: [allocate-runners, publish-github-release]
|
needs: [allocate-runners, publish-github-release]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
@@ -512,7 +490,7 @@ jobs:
|
|||||||
|
|
||||||
bump-homebrew-greptime-version:
|
bump-homebrew-greptime-version:
|
||||||
name: Bump homebrew greptime version
|
name: Bump homebrew greptime version
|
||||||
if: ${{ github.ref_type == 'tag' && !contains(github.ref_name, 'nightly') && github.event_name != 'schedule' && needs.allocate-runners.outputs.is-current-version-latest == 'true' }}
|
if: ${{ github.ref_type == 'tag' && !contains(github.ref_name, 'nightly') && github.event_name != 'schedule' }}
|
||||||
needs: [allocate-runners, publish-github-release]
|
needs: [allocate-runners, publish-github-release]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
|
|||||||
194
.github/workflows/run-multi-lang-tests.yml
vendored
194
.github/workflows/run-multi-lang-tests.yml
vendored
@@ -1,194 +0,0 @@
|
|||||||
# Reusable workflow for running multi-language SDK tests against GreptimeDB
|
|
||||||
# Used by: multi-lang-tests.yml, release.yml, nightly-build.yml
|
|
||||||
# Supports both direct binary artifacts and tarball artifacts
|
|
||||||
|
|
||||||
name: Run Multi-language SDK Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
artifact-name:
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
description: 'Name of the artifact containing greptime binary'
|
|
||||||
http-port:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: '4000'
|
|
||||||
description: 'HTTP server port'
|
|
||||||
mysql-port:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: '4002'
|
|
||||||
description: 'MySQL server port'
|
|
||||||
postgres-port:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: '4003'
|
|
||||||
description: 'PostgreSQL server port'
|
|
||||||
db-name:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: 'test_db'
|
|
||||||
description: 'Test database name'
|
|
||||||
username:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: 'greptime_user'
|
|
||||||
description: 'Authentication username'
|
|
||||||
password:
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
default: 'greptime_pwd'
|
|
||||||
description: 'Authentication password'
|
|
||||||
timeout-minutes:
|
|
||||||
required: false
|
|
||||||
type: number
|
|
||||||
default: 30
|
|
||||||
description: 'Job timeout in minutes'
|
|
||||||
artifact-is-tarball:
|
|
||||||
required: false
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
description: 'Whether the artifact is a tarball (tar.gz) that needs to be extracted'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run-tests:
|
|
||||||
name: Run Multi-language SDK Tests
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: ${{ inputs.timeout-minutes }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout greptimedb-tests repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
repository: GreptimeTeam/greptimedb-tests
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Download pre-built greptime binary
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ inputs.artifact-name }}
|
|
||||||
path: artifact
|
|
||||||
|
|
||||||
- name: Setup greptime binary
|
|
||||||
run: |
|
|
||||||
mkdir -p bin
|
|
||||||
if [ "${{ inputs.artifact-is-tarball }}" = "true" ]; then
|
|
||||||
# Extract tarball and find greptime binary
|
|
||||||
tar -xzf artifact/*.tar.gz -C artifact
|
|
||||||
find artifact -name "greptime" -type f -exec cp {} bin/greptime \;
|
|
||||||
else
|
|
||||||
# Direct binary format
|
|
||||||
if [ -f artifact/greptime ]; then
|
|
||||||
cp artifact/greptime bin/greptime
|
|
||||||
else
|
|
||||||
cp artifact/* bin/greptime
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
chmod +x ./bin/greptime
|
|
||||||
ls -lh ./bin/greptime
|
|
||||||
./bin/greptime --version
|
|
||||||
|
|
||||||
- name: Setup Java 17
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: '17'
|
|
||||||
cache: 'maven'
|
|
||||||
|
|
||||||
- name: Setup Python 3.8
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
|
|
||||||
- name: Setup Go 1.24
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: '1.24'
|
|
||||||
cache: true
|
|
||||||
cache-dependency-path: go-tests/go.sum
|
|
||||||
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '18'
|
|
||||||
|
|
||||||
- name: Install Python dependencies
|
|
||||||
run: |
|
|
||||||
pip install mysql-connector-python psycopg2-binary
|
|
||||||
python3 -c "import mysql.connector; print(f'mysql-connector-python {mysql.connector.__version__}')"
|
|
||||||
python3 -c "import psycopg2; print(f'psycopg2 {psycopg2.__version__}')"
|
|
||||||
|
|
||||||
- name: Install Go dependencies
|
|
||||||
working-directory: go-tests
|
|
||||||
run: |
|
|
||||||
go mod download
|
|
||||||
go mod verify
|
|
||||||
go version
|
|
||||||
|
|
||||||
- name: Kill existing GreptimeDB processes
|
|
||||||
run: |
|
|
||||||
pkill -f greptime || true
|
|
||||||
sleep 2
|
|
||||||
|
|
||||||
- name: Start GreptimeDB standalone
|
|
||||||
run: |
|
|
||||||
./bin/greptime standalone start \
|
|
||||||
--http-addr 0.0.0.0:${{ inputs.http-port }} \
|
|
||||||
--rpc-addr 0.0.0.0:4001 \
|
|
||||||
--mysql-addr 0.0.0.0:${{ inputs.mysql-port }} \
|
|
||||||
--postgres-addr 0.0.0.0:${{ inputs.postgres-port }} \
|
|
||||||
--user-provider=static_user_provider:cmd:${{ inputs.username }}=${{ inputs.password }} > /tmp/greptimedb.log 2>&1 &
|
|
||||||
|
|
||||||
- name: Wait for GreptimeDB to be ready
|
|
||||||
run: |
|
|
||||||
echo "Waiting for GreptimeDB..."
|
|
||||||
for i in {1..60}; do
|
|
||||||
if curl -sf http://localhost:${{ inputs.http-port }}/health > /dev/null; then
|
|
||||||
echo "✅ GreptimeDB is ready"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
echo "❌ GreptimeDB failed to start"
|
|
||||||
cat /tmp/greptimedb.log
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
- name: Run multi-language tests
|
|
||||||
env:
|
|
||||||
DB_NAME: ${{ inputs.db-name }}
|
|
||||||
MYSQL_HOST: 127.0.0.1
|
|
||||||
MYSQL_PORT: ${{ inputs.mysql-port }}
|
|
||||||
POSTGRES_HOST: 127.0.0.1
|
|
||||||
POSTGRES_PORT: ${{ inputs.postgres-port }}
|
|
||||||
HTTP_HOST: 127.0.0.1
|
|
||||||
HTTP_PORT: ${{ inputs.http-port }}
|
|
||||||
GREPTIME_USERNAME: ${{ inputs.username }}
|
|
||||||
GREPTIME_PASSWORD: ${{ inputs.password }}
|
|
||||||
run: |
|
|
||||||
chmod +x ./run_tests.sh
|
|
||||||
./run_tests.sh
|
|
||||||
|
|
||||||
- name: Collect logs on failure
|
|
||||||
if: failure()
|
|
||||||
run: |
|
|
||||||
echo "=== GreptimeDB Logs ==="
|
|
||||||
cat /tmp/greptimedb.log || true
|
|
||||||
|
|
||||||
- name: Upload test logs on failure
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: test-logs
|
|
||||||
path: |
|
|
||||||
/tmp/greptimedb.log
|
|
||||||
java-tests/target/surefire-reports/
|
|
||||||
python-tests/.pytest_cache/
|
|
||||||
go-tests/*.log
|
|
||||||
**/test-output/
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
- name: Cleanup
|
|
||||||
if: always()
|
|
||||||
run: |
|
|
||||||
pkill -f greptime || true
|
|
||||||
12
.github/workflows/semantic-pull-request.yml
vendored
12
.github/workflows/semantic-pull-request.yml
vendored
@@ -1,7 +1,7 @@
|
|||||||
name: "Semantic Pull Request"
|
name: "Semantic Pull Request"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
- reopened
|
- reopened
|
||||||
@@ -11,17 +11,17 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
issues: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write # Add permissions to modify PRs
|
||||||
|
issues: write
|
||||||
timeout-minutes: 10
|
timeout-minutes: 10
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
- uses: ./.github/actions/setup-cyborg
|
- uses: ./.github/actions/setup-cyborg
|
||||||
- name: Check Pull Request
|
- name: Check Pull Request
|
||||||
working-directory: cyborg
|
working-directory: cyborg
|
||||||
|
|||||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -52,9 +52,6 @@ venv/
|
|||||||
tests-fuzz/artifacts/
|
tests-fuzz/artifacts/
|
||||||
tests-fuzz/corpus/
|
tests-fuzz/corpus/
|
||||||
|
|
||||||
# cargo-udeps reports
|
|
||||||
udeps-report.json
|
|
||||||
|
|
||||||
# Nix
|
# Nix
|
||||||
.direnv
|
.direnv
|
||||||
.envrc
|
.envrc
|
||||||
@@ -63,7 +60,4 @@ udeps-report.json
|
|||||||
greptimedb_data
|
greptimedb_data
|
||||||
|
|
||||||
# github
|
# github
|
||||||
!/.github
|
!/.github
|
||||||
|
|
||||||
# Claude code
|
|
||||||
CLAUDE.md
|
|
||||||
@@ -10,10 +10,12 @@
|
|||||||
* [NiwakaDev](https://github.com/NiwakaDev)
|
* [NiwakaDev](https://github.com/NiwakaDev)
|
||||||
* [tisonkun](https://github.com/tisonkun)
|
* [tisonkun](https://github.com/tisonkun)
|
||||||
|
|
||||||
|
|
||||||
## Team Members (in alphabetical order)
|
## Team Members (in alphabetical order)
|
||||||
|
|
||||||
* [apdong2022](https://github.com/apdong2022)
|
* [apdong2022](https://github.com/apdong2022)
|
||||||
* [beryl678](https://github.com/beryl678)
|
* [beryl678](https://github.com/beryl678)
|
||||||
|
* [Breeze-P](https://github.com/Breeze-P)
|
||||||
* [daviderli614](https://github.com/daviderli614)
|
* [daviderli614](https://github.com/daviderli614)
|
||||||
* [discord9](https://github.com/discord9)
|
* [discord9](https://github.com/discord9)
|
||||||
* [evenyag](https://github.com/evenyag)
|
* [evenyag](https://github.com/evenyag)
|
||||||
|
|||||||
@@ -55,18 +55,14 @@ GreptimeDB uses the [Apache 2.0 license](https://github.com/GreptimeTeam/greptim
|
|||||||
- To ensure that community is free and confident in its ability to use your contributions, please sign the Contributor License Agreement (CLA) which will be incorporated in the pull request process.
|
- To ensure that community is free and confident in its ability to use your contributions, please sign the Contributor License Agreement (CLA) which will be incorporated in the pull request process.
|
||||||
- Make sure all files have proper license header (running `docker run --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye-native:v3 format` from the project root).
|
- Make sure all files have proper license header (running `docker run --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye-native:v3 format` from the project root).
|
||||||
- Make sure all your codes are formatted and follow the [coding style](https://pingcap.github.io/style-guide/rust/) and [style guide](docs/style-guide.md).
|
- Make sure all your codes are formatted and follow the [coding style](https://pingcap.github.io/style-guide/rust/) and [style guide](docs/style-guide.md).
|
||||||
- Make sure all unit tests are passed using [nextest](https://nexte.st/index.html) `cargo nextest run --workspace --features pg_kvbackend,mysql_kvbackend` or `make test`.
|
- Make sure all unit tests are passed using [nextest](https://nexte.st/index.html) `cargo nextest run`.
|
||||||
- Make sure all clippy warnings are fixed (you can check it locally by running `cargo clippy --workspace --all-targets -- -D warnings` or `make clippy`).
|
- Make sure all clippy warnings are fixed (you can check it locally by running `cargo clippy --workspace --all-targets -- -D warnings`).
|
||||||
- Ensure there are no unused dependencies by running `make check-udeps` (clean them up with `make fix-udeps` if reported).
|
|
||||||
- If you must keep a target-specific dependency (e.g. under `[target.'cfg(...)'.dev-dependencies]`), add a cargo-udeps ignore entry in the same `Cargo.toml`, for example:
|
|
||||||
`[package.metadata.cargo-udeps.ignore]` with `development = ["rexpect"]` (or `dependencies`/`build` as appropriate).
|
|
||||||
- When modifying sample configuration files in `config/`, run `make config-docs` (which requires Docker to be installed) to update the configuration documentation and include it in your commit.
|
|
||||||
|
|
||||||
#### `pre-commit` Hooks
|
#### `pre-commit` Hooks
|
||||||
|
|
||||||
You could setup the [`pre-commit`](https://pre-commit.com/#plugins) hooks to run these checks on every commit automatically.
|
You could setup the [`pre-commit`](https://pre-commit.com/#plugins) hooks to run these checks on every commit automatically.
|
||||||
|
|
||||||
1. Install `pre-commit`
|
1. Install `pre-commit`
|
||||||
|
|
||||||
pip install pre-commit
|
pip install pre-commit
|
||||||
|
|
||||||
@@ -74,7 +70,7 @@ You could setup the [`pre-commit`](https://pre-commit.com/#plugins) hooks to run
|
|||||||
|
|
||||||
brew install pre-commit
|
brew install pre-commit
|
||||||
|
|
||||||
2. Install the `pre-commit` hooks
|
2. Install the `pre-commit` hooks
|
||||||
|
|
||||||
$ pre-commit install
|
$ pre-commit install
|
||||||
pre-commit installed at .git/hooks/pre-commit
|
pre-commit installed at .git/hooks/pre-commit
|
||||||
|
|||||||
5643
Cargo.lock
generated
5643
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
123
Cargo.toml
123
Cargo.toml
@@ -13,7 +13,6 @@ members = [
|
|||||||
"src/common/datasource",
|
"src/common/datasource",
|
||||||
"src/common/decimal",
|
"src/common/decimal",
|
||||||
"src/common/error",
|
"src/common/error",
|
||||||
"src/common/event-recorder",
|
|
||||||
"src/common/frontend",
|
"src/common/frontend",
|
||||||
"src/common/function",
|
"src/common/function",
|
||||||
"src/common/greptimedb-telemetry",
|
"src/common/greptimedb-telemetry",
|
||||||
@@ -31,7 +30,6 @@ members = [
|
|||||||
"src/common/recordbatch",
|
"src/common/recordbatch",
|
||||||
"src/common/runtime",
|
"src/common/runtime",
|
||||||
"src/common/session",
|
"src/common/session",
|
||||||
"src/common/sql",
|
|
||||||
"src/common/stat",
|
"src/common/stat",
|
||||||
"src/common/substrait",
|
"src/common/substrait",
|
||||||
"src/common/telemetry",
|
"src/common/telemetry",
|
||||||
@@ -61,7 +59,6 @@ members = [
|
|||||||
"src/promql",
|
"src/promql",
|
||||||
"src/puffin",
|
"src/puffin",
|
||||||
"src/query",
|
"src/query",
|
||||||
"src/standalone",
|
|
||||||
"src/servers",
|
"src/servers",
|
||||||
"src/session",
|
"src/session",
|
||||||
"src/sql",
|
"src/sql",
|
||||||
@@ -74,13 +71,11 @@ members = [
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "1.0.0-beta.2"
|
version = "0.15.0"
|
||||||
edition = "2024"
|
edition = "2021"
|
||||||
license = "Apache-2.0"
|
license = "Apache-2.0"
|
||||||
|
|
||||||
[workspace.lints]
|
[workspace.lints]
|
||||||
clippy.print_stdout = "warn"
|
|
||||||
clippy.print_stderr = "warn"
|
|
||||||
clippy.dbg_macro = "warn"
|
clippy.dbg_macro = "warn"
|
||||||
clippy.implicit_clone = "warn"
|
clippy.implicit_clone = "warn"
|
||||||
clippy.result_large_err = "allow"
|
clippy.result_large_err = "allow"
|
||||||
@@ -99,12 +94,11 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = ['cfg(tokio_unstable)'] }
|
|||||||
# See for more detaiils: https://github.com/rust-lang/cargo/issues/11329
|
# See for more detaiils: https://github.com/rust-lang/cargo/issues/11329
|
||||||
ahash = { version = "0.8", features = ["compile-time-rng"] }
|
ahash = { version = "0.8", features = ["compile-time-rng"] }
|
||||||
aquamarine = "0.6"
|
aquamarine = "0.6"
|
||||||
arrow = { version = "56.2", features = ["prettyprint"] }
|
arrow = { version = "54.2", features = ["prettyprint"] }
|
||||||
arrow-array = { version = "56.2", default-features = false, features = ["chrono-tz"] }
|
arrow-array = { version = "54.2", default-features = false, features = ["chrono-tz"] }
|
||||||
arrow-buffer = "56.2"
|
arrow-flight = "54.2"
|
||||||
arrow-flight = "56.2"
|
arrow-ipc = { version = "54.2", default-features = false, features = ["lz4", "zstd"] }
|
||||||
arrow-ipc = { version = "56.2", default-features = false, features = ["lz4", "zstd"] }
|
arrow-schema = { version = "54.2", features = ["serde"] }
|
||||||
arrow-schema = { version = "56.2", features = ["serde"] }
|
|
||||||
async-stream = "0.3"
|
async-stream = "0.3"
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
# Remember to update axum-extra, axum-macros when updating axum
|
# Remember to update axum-extra, axum-macros when updating axum
|
||||||
@@ -118,37 +112,30 @@ bitflags = "2.4.1"
|
|||||||
bytemuck = "1.12"
|
bytemuck = "1.12"
|
||||||
bytes = { version = "1.7", features = ["serde"] }
|
bytes = { version = "1.7", features = ["serde"] }
|
||||||
chrono = { version = "0.4", features = ["serde"] }
|
chrono = { version = "0.4", features = ["serde"] }
|
||||||
chrono-tz = { version = "0.10.1", features = ["case-insensitive"] }
|
chrono-tz = "0.10.1"
|
||||||
clap = { version = "4.4", features = ["derive"] }
|
clap = { version = "4.4", features = ["derive"] }
|
||||||
config = "0.13.0"
|
config = "0.13.0"
|
||||||
const_format = "0.2"
|
|
||||||
crossbeam-utils = "0.8"
|
crossbeam-utils = "0.8"
|
||||||
dashmap = "6.1"
|
dashmap = "6.1"
|
||||||
datafusion = "50"
|
datafusion = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-common = "50"
|
datafusion-common = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-expr = "50"
|
datafusion-expr = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-functions = "50"
|
datafusion-functions = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-functions-aggregate-common = "50"
|
datafusion-functions-aggregate-common = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-optimizer = "50"
|
datafusion-optimizer = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-orc = "0.5"
|
datafusion-physical-expr = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-pg-catalog = "0.12.2"
|
datafusion-physical-plan = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-physical-expr = "50"
|
datafusion-sql = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-physical-plan = "50"
|
datafusion-substrait = { git = "https://github.com/waynexia/arrow-datafusion.git", rev = "12c0381babd52c681043957e9d6ee083a03f7646" }
|
||||||
datafusion-sql = "50"
|
|
||||||
datafusion-substrait = "50"
|
|
||||||
deadpool = "0.12"
|
deadpool = "0.12"
|
||||||
deadpool-postgres = "0.14"
|
deadpool-postgres = "0.14"
|
||||||
derive_builder = "0.20"
|
derive_builder = "0.20"
|
||||||
dotenv = "0.15"
|
dotenv = "0.15"
|
||||||
either = "1.15"
|
etcd-client = "0.14"
|
||||||
etcd-client = { git = "https://github.com/GreptimeTeam/etcd-client", rev = "f62df834f0cffda355eba96691fe1a9a332b75a7", features = [
|
|
||||||
"tls",
|
|
||||||
"tls-roots",
|
|
||||||
] }
|
|
||||||
fst = "0.4.7"
|
fst = "0.4.7"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "0df99f09f1d6785055b2d9da96fc4ecc2bdf6803" }
|
greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "464226cf8a4a22696503536a123d0b9e318582f4" }
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
http = "1"
|
http = "1"
|
||||||
humantime = "2.1"
|
humantime = "2.1"
|
||||||
@@ -159,7 +146,7 @@ itertools = "0.14"
|
|||||||
jsonb = { git = "https://github.com/databendlabs/jsonb.git", rev = "8c8d2fc294a39f3ff08909d60f718639cfba3875", default-features = false }
|
jsonb = { git = "https://github.com/databendlabs/jsonb.git", rev = "8c8d2fc294a39f3ff08909d60f718639cfba3875", default-features = false }
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
local-ip-address = "0.6"
|
local-ip-address = "0.6"
|
||||||
loki-proto = { git = "https://github.com/GreptimeTeam/loki-proto.git", rev = "3b7cd33234358b18ece977bf689dc6fb760f29ab" }
|
loki-proto = { git = "https://github.com/GreptimeTeam/loki-proto.git", rev = "1434ecf23a2654025d86188fb5205e7a74b225d3" }
|
||||||
meter-core = { git = "https://github.com/GreptimeTeam/greptime-meter.git", rev = "5618e779cf2bb4755b499c630fba4c35e91898cb" }
|
meter-core = { git = "https://github.com/GreptimeTeam/greptime-meter.git", rev = "5618e779cf2bb4755b499c630fba4c35e91898cb" }
|
||||||
mockall = "0.13"
|
mockall = "0.13"
|
||||||
moka = "0.12"
|
moka = "0.12"
|
||||||
@@ -167,32 +154,28 @@ nalgebra = "0.33"
|
|||||||
nix = { version = "0.30.1", default-features = false, features = ["event", "fs", "process"] }
|
nix = { version = "0.30.1", default-features = false, features = ["event", "fs", "process"] }
|
||||||
notify = "8.0"
|
notify = "8.0"
|
||||||
num_cpus = "1.16"
|
num_cpus = "1.16"
|
||||||
object_store_opendal = "0.54"
|
object_store_opendal = "0.50"
|
||||||
once_cell = "1.18"
|
once_cell = "1.18"
|
||||||
opentelemetry-proto = { version = "0.30", features = [
|
opentelemetry-proto = { version = "0.27", features = [
|
||||||
"gen-tonic",
|
"gen-tonic",
|
||||||
"metrics",
|
"metrics",
|
||||||
"trace",
|
"trace",
|
||||||
"with-serde",
|
"with-serde",
|
||||||
"logs",
|
"logs",
|
||||||
] }
|
] }
|
||||||
ordered-float = { version = "4.3", features = ["serde"] }
|
|
||||||
otel-arrow-rust = { git = "https://github.com/GreptimeTeam/otel-arrow", rev = "2d64b7c0fa95642028a8205b36fe9ea0b023ec59", features = [
|
|
||||||
"server",
|
|
||||||
] }
|
|
||||||
parking_lot = "0.12"
|
parking_lot = "0.12"
|
||||||
parquet = { version = "56.2", default-features = false, features = ["arrow", "async", "object_store"] }
|
parquet = { version = "54.2", default-features = false, features = ["arrow", "async", "object_store"] }
|
||||||
paste = "1.0"
|
paste = "1.0"
|
||||||
pin-project = "1.0"
|
pin-project = "1.0"
|
||||||
pretty_assertions = "1.4.0"
|
|
||||||
prometheus = { version = "0.13.3", features = ["process"] }
|
prometheus = { version = "0.13.3", features = ["process"] }
|
||||||
promql-parser = { version = "0.6", features = ["ser"] }
|
promql-parser = { git = "https://github.com/GreptimeTeam/promql-parser.git", rev = "0410e8b459dda7cb222ce9596f8bf3971bd07bd2", features = [
|
||||||
|
"ser",
|
||||||
|
] }
|
||||||
prost = { version = "0.13", features = ["no-recursion-limit"] }
|
prost = { version = "0.13", features = ["no-recursion-limit"] }
|
||||||
prost-types = "0.13"
|
|
||||||
raft-engine = { version = "0.4.1", default-features = false }
|
raft-engine = { version = "0.4.1", default-features = false }
|
||||||
rand = "0.9"
|
rand = "0.9"
|
||||||
ratelimit = "0.10"
|
ratelimit = "0.10"
|
||||||
regex = "1.12"
|
regex = "1.8"
|
||||||
regex-automata = "0.4"
|
regex-automata = "0.4"
|
||||||
reqwest = { version = "0.12", default-features = false, features = [
|
reqwest = { version = "0.12", default-features = false, features = [
|
||||||
"json",
|
"json",
|
||||||
@@ -200,7 +183,7 @@ reqwest = { version = "0.12", default-features = false, features = [
|
|||||||
"stream",
|
"stream",
|
||||||
"multipart",
|
"multipart",
|
||||||
] }
|
] }
|
||||||
rskafka = { git = "https://github.com/WenyXu/rskafka.git", rev = "7b0f31ed39db049b4ee2e5f1e95b5a30be9baf76", features = [
|
rskafka = { git = "https://github.com/influxdata/rskafka.git", rev = "8dbd01ed809f5a791833a594e85b144e36e45820", features = [
|
||||||
"transport-tls",
|
"transport-tls",
|
||||||
] }
|
] }
|
||||||
rstest = "0.25"
|
rstest = "0.25"
|
||||||
@@ -208,37 +191,40 @@ rstest_reuse = "0.7"
|
|||||||
rust_decimal = "1.33"
|
rust_decimal = "1.33"
|
||||||
rustc-hash = "2.0"
|
rustc-hash = "2.0"
|
||||||
# It is worth noting that we should try to avoid using aws-lc-rs until it can be compiled on various platforms.
|
# It is worth noting that we should try to avoid using aws-lc-rs until it can be compiled on various platforms.
|
||||||
hostname = "0.4.0"
|
|
||||||
rustls = { version = "0.23.25", default-features = false }
|
rustls = { version = "0.23.25", default-features = false }
|
||||||
sea-query = "0.32"
|
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = { version = "1.0", features = ["float_roundtrip"] }
|
serde_json = { version = "1.0", features = ["float_roundtrip"] }
|
||||||
serde_with = "3"
|
serde_with = "3"
|
||||||
|
shadow-rs = "1.1"
|
||||||
simd-json = "0.15"
|
simd-json = "0.15"
|
||||||
similar-asserts = "1.6.0"
|
similar-asserts = "1.6.0"
|
||||||
smallvec = { version = "1", features = ["serde"] }
|
smallvec = { version = "1", features = ["serde"] }
|
||||||
snafu = "0.8"
|
snafu = "0.8"
|
||||||
sqlparser = { version = "0.58.0", default-features = false, features = ["std", "visitor", "serde"] }
|
sqlparser = { git = "https://github.com/GreptimeTeam/sqlparser-rs.git", rev = "0cf6c04490d59435ee965edd2078e8855bd8471e", features = [
|
||||||
sqlx = { version = "0.8", default-features = false, features = ["any", "macros", "json", "runtime-tokio-rustls"] }
|
"visitor",
|
||||||
|
"serde",
|
||||||
|
] } # branch = "v0.54.x"
|
||||||
|
sqlx = { version = "0.8", features = [
|
||||||
|
"runtime-tokio-rustls",
|
||||||
|
"mysql",
|
||||||
|
"postgres",
|
||||||
|
"chrono",
|
||||||
|
] }
|
||||||
strum = { version = "0.27", features = ["derive"] }
|
strum = { version = "0.27", features = ["derive"] }
|
||||||
sysinfo = "0.33"
|
sysinfo = "0.33"
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
tokio = { version = "1.47", features = ["full"] }
|
tokio = { version = "1.40", features = ["full"] }
|
||||||
tokio-postgres = "0.7"
|
tokio-postgres = "0.7"
|
||||||
tokio-rustls = { version = "0.26.2", default-features = false }
|
tokio-rustls = { version = "0.26.2", default-features = false }
|
||||||
tokio-stream = "0.1"
|
tokio-stream = "0.1"
|
||||||
tokio-util = { version = "0.7", features = ["io-util", "compat"] }
|
tokio-util = { version = "0.7", features = ["io-util", "compat"] }
|
||||||
toml = "0.8.8"
|
toml = "0.8.8"
|
||||||
tonic = { version = "0.13", features = ["tls-ring", "gzip", "zstd"] }
|
tonic = { version = "0.12", features = ["tls", "gzip", "zstd"] }
|
||||||
tower = "0.5"
|
tower = "0.5"
|
||||||
tower-http = "0.6"
|
|
||||||
tracing = "0.1"
|
|
||||||
tracing-appender = "0.2"
|
tracing-appender = "0.2"
|
||||||
tracing-opentelemetry = "0.31.0"
|
|
||||||
tracing-subscriber = { version = "0.3", features = ["env-filter", "json", "fmt"] }
|
tracing-subscriber = { version = "0.3", features = ["env-filter", "json", "fmt"] }
|
||||||
typetag = "0.2"
|
typetag = "0.2"
|
||||||
uuid = { version = "1.17", features = ["serde", "v4", "fast-rng"] }
|
uuid = { version = "1.7", features = ["serde", "v4", "fast-rng"] }
|
||||||
vrl = "0.25"
|
|
||||||
zstd = "0.13"
|
zstd = "0.13"
|
||||||
# DO_NOT_REMOVE_THIS: END_OF_EXTERNAL_DEPENDENCIES
|
# DO_NOT_REMOVE_THIS: END_OF_EXTERNAL_DEPENDENCIES
|
||||||
|
|
||||||
@@ -256,7 +242,6 @@ common-config = { path = "src/common/config" }
|
|||||||
common-datasource = { path = "src/common/datasource" }
|
common-datasource = { path = "src/common/datasource" }
|
||||||
common-decimal = { path = "src/common/decimal" }
|
common-decimal = { path = "src/common/decimal" }
|
||||||
common-error = { path = "src/common/error" }
|
common-error = { path = "src/common/error" }
|
||||||
common-event-recorder = { path = "src/common/event-recorder" }
|
|
||||||
common-frontend = { path = "src/common/frontend" }
|
common-frontend = { path = "src/common/frontend" }
|
||||||
common-function = { path = "src/common/function" }
|
common-function = { path = "src/common/function" }
|
||||||
common-greptimedb-telemetry = { path = "src/common/greptimedb-telemetry" }
|
common-greptimedb-telemetry = { path = "src/common/greptimedb-telemetry" }
|
||||||
@@ -274,8 +259,6 @@ common-query = { path = "src/common/query" }
|
|||||||
common-recordbatch = { path = "src/common/recordbatch" }
|
common-recordbatch = { path = "src/common/recordbatch" }
|
||||||
common-runtime = { path = "src/common/runtime" }
|
common-runtime = { path = "src/common/runtime" }
|
||||||
common-session = { path = "src/common/session" }
|
common-session = { path = "src/common/session" }
|
||||||
common-sql = { path = "src/common/sql" }
|
|
||||||
common-stat = { path = "src/common/stat" }
|
|
||||||
common-telemetry = { path = "src/common/telemetry" }
|
common-telemetry = { path = "src/common/telemetry" }
|
||||||
common-test-util = { path = "src/common/test-util" }
|
common-test-util = { path = "src/common/test-util" }
|
||||||
common-time = { path = "src/common/time" }
|
common-time = { path = "src/common/time" }
|
||||||
@@ -297,6 +280,9 @@ mito-codec = { path = "src/mito-codec" }
|
|||||||
mito2 = { path = "src/mito2" }
|
mito2 = { path = "src/mito2" }
|
||||||
object-store = { path = "src/object-store" }
|
object-store = { path = "src/object-store" }
|
||||||
operator = { path = "src/operator" }
|
operator = { path = "src/operator" }
|
||||||
|
otel-arrow-rust = { git = "https://github.com/open-telemetry/otel-arrow", rev = "5d551412d2a12e689cde4d84c14ef29e36784e51", features = [
|
||||||
|
"server",
|
||||||
|
] }
|
||||||
partition = { path = "src/partition" }
|
partition = { path = "src/partition" }
|
||||||
pipeline = { path = "src/pipeline" }
|
pipeline = { path = "src/pipeline" }
|
||||||
plugins = { path = "src/plugins" }
|
plugins = { path = "src/plugins" }
|
||||||
@@ -306,7 +292,7 @@ query = { path = "src/query" }
|
|||||||
servers = { path = "src/servers" }
|
servers = { path = "src/servers" }
|
||||||
session = { path = "src/session" }
|
session = { path = "src/session" }
|
||||||
sql = { path = "src/sql" }
|
sql = { path = "src/sql" }
|
||||||
standalone = { path = "src/standalone" }
|
stat = { path = "src/common/stat" }
|
||||||
store-api = { path = "src/store-api" }
|
store-api = { path = "src/store-api" }
|
||||||
substrait = { path = "src/common/substrait" }
|
substrait = { path = "src/common/substrait" }
|
||||||
table = { path = "src/table" }
|
table = { path = "src/table" }
|
||||||
@@ -315,21 +301,6 @@ table = { path = "src/table" }
|
|||||||
git = "https://github.com/GreptimeTeam/greptime-meter.git"
|
git = "https://github.com/GreptimeTeam/greptime-meter.git"
|
||||||
rev = "5618e779cf2bb4755b499c630fba4c35e91898cb"
|
rev = "5618e779cf2bb4755b499c630fba4c35e91898cb"
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
datafusion = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-common = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-expr = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-functions = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-functions-aggregate-common = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-optimizer = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-physical-expr = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-physical-expr-common = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-physical-plan = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-datasource = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-sql = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
datafusion-substrait = { git = "https://github.com/GreptimeTeam/datafusion.git", rev = "7f8ea0a45748ed32695757368f847ab9ac7b6c82" }
|
|
||||||
sqlparser = { git = "https://github.com/GreptimeTeam/sqlparser-rs.git", rev = "4b519a5caa95472cc3988f5556813a583dd35af1" } # branch = "v0.58.x"
|
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
debug = 1
|
debug = 1
|
||||||
|
|
||||||
|
|||||||
20
Makefile
20
Makefile
@@ -8,7 +8,7 @@ CARGO_BUILD_OPTS := --locked
|
|||||||
IMAGE_REGISTRY ?= docker.io
|
IMAGE_REGISTRY ?= docker.io
|
||||||
IMAGE_NAMESPACE ?= greptime
|
IMAGE_NAMESPACE ?= greptime
|
||||||
IMAGE_TAG ?= latest
|
IMAGE_TAG ?= latest
|
||||||
DEV_BUILDER_IMAGE_TAG ?= 2025-10-01-8fe17d43-20251011080129
|
DEV_BUILDER_IMAGE_TAG ?= 2025-05-19-b2377d4b-20250520045554
|
||||||
BUILDX_MULTI_PLATFORM_BUILD ?= false
|
BUILDX_MULTI_PLATFORM_BUILD ?= false
|
||||||
BUILDX_BUILDER_NAME ?= gtbuilder
|
BUILDX_BUILDER_NAME ?= gtbuilder
|
||||||
BASE_IMAGE ?= ubuntu
|
BASE_IMAGE ?= ubuntu
|
||||||
@@ -17,14 +17,12 @@ CARGO_REGISTRY_CACHE ?= ${HOME}/.cargo/registry
|
|||||||
ARCH := $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
|
ARCH := $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
|
||||||
OUTPUT_DIR := $(shell if [ "$(RELEASE)" = "true" ]; then echo "release"; elif [ ! -z "$(CARGO_PROFILE)" ]; then echo "$(CARGO_PROFILE)" ; else echo "debug"; fi)
|
OUTPUT_DIR := $(shell if [ "$(RELEASE)" = "true" ]; then echo "release"; elif [ ! -z "$(CARGO_PROFILE)" ]; then echo "$(CARGO_PROFILE)" ; else echo "debug"; fi)
|
||||||
SQLNESS_OPTS ?=
|
SQLNESS_OPTS ?=
|
||||||
EXTRA_BUILD_ENVS ?=
|
|
||||||
ASSEMBLED_EXTRA_BUILD_ENV := $(foreach var,$(EXTRA_BUILD_ENVS),-e $(var))
|
|
||||||
|
|
||||||
# The arguments for running integration tests.
|
# The arguments for running integration tests.
|
||||||
ETCD_VERSION ?= v3.5.9
|
ETCD_VERSION ?= v3.5.9
|
||||||
ETCD_IMAGE ?= quay.io/coreos/etcd:${ETCD_VERSION}
|
ETCD_IMAGE ?= quay.io/coreos/etcd:${ETCD_VERSION}
|
||||||
RETRY_COUNT ?= 3
|
RETRY_COUNT ?= 3
|
||||||
NEXTEST_OPTS := --retries ${RETRY_COUNT} --features pg_kvbackend,mysql_kvbackend
|
NEXTEST_OPTS := --retries ${RETRY_COUNT}
|
||||||
BUILD_JOBS ?= $(shell which nproc 1>/dev/null && expr $$(nproc) / 2) # If nproc is not available, we don't set the build jobs.
|
BUILD_JOBS ?= $(shell which nproc 1>/dev/null && expr $$(nproc) / 2) # If nproc is not available, we don't set the build jobs.
|
||||||
ifeq ($(BUILD_JOBS), 0) # If the number of cores is less than 2, set the build jobs to 1.
|
ifeq ($(BUILD_JOBS), 0) # If the number of cores is less than 2, set the build jobs to 1.
|
||||||
BUILD_JOBS := 1
|
BUILD_JOBS := 1
|
||||||
@@ -85,7 +83,6 @@ build: ## Build debug version greptime.
|
|||||||
.PHONY: build-by-dev-builder
|
.PHONY: build-by-dev-builder
|
||||||
build-by-dev-builder: ## Build greptime by dev-builder.
|
build-by-dev-builder: ## Build greptime by dev-builder.
|
||||||
docker run --network=host \
|
docker run --network=host \
|
||||||
${ASSEMBLED_EXTRA_BUILD_ENV} \
|
|
||||||
-v ${PWD}:/greptimedb -v ${CARGO_REGISTRY_CACHE}:/root/.cargo/registry \
|
-v ${PWD}:/greptimedb -v ${CARGO_REGISTRY_CACHE}:/root/.cargo/registry \
|
||||||
-w /greptimedb ${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/dev-builder-${BASE_IMAGE}:${DEV_BUILDER_IMAGE_TAG} \
|
-w /greptimedb ${IMAGE_REGISTRY}/${IMAGE_NAMESPACE}/dev-builder-${BASE_IMAGE}:${DEV_BUILDER_IMAGE_TAG} \
|
||||||
make build \
|
make build \
|
||||||
@@ -172,7 +169,7 @@ nextest: ## Install nextest tools.
|
|||||||
|
|
||||||
.PHONY: sqlness-test
|
.PHONY: sqlness-test
|
||||||
sqlness-test: ## Run sqlness test.
|
sqlness-test: ## Run sqlness test.
|
||||||
cargo sqlness bare ${SQLNESS_OPTS}
|
cargo sqlness ${SQLNESS_OPTS}
|
||||||
|
|
||||||
RUNS ?= 1
|
RUNS ?= 1
|
||||||
FUZZ_TARGET ?= fuzz_alter_table
|
FUZZ_TARGET ?= fuzz_alter_table
|
||||||
@@ -196,17 +193,6 @@ clippy: ## Check clippy rules.
|
|||||||
fix-clippy: ## Fix clippy violations.
|
fix-clippy: ## Fix clippy violations.
|
||||||
cargo clippy --workspace --all-targets --all-features --fix
|
cargo clippy --workspace --all-targets --all-features --fix
|
||||||
|
|
||||||
.PHONY: check-udeps
|
|
||||||
check-udeps: ## Check unused dependencies.
|
|
||||||
cargo udeps --workspace --all-targets
|
|
||||||
|
|
||||||
.PHONY: fix-udeps
|
|
||||||
fix-udeps: ## Remove unused dependencies automatically.
|
|
||||||
@echo "Running cargo-udeps to find unused dependencies..."
|
|
||||||
@cargo udeps --workspace --all-targets --output json > udeps-report.json || true
|
|
||||||
@echo "Removing unused dependencies..."
|
|
||||||
@python3 scripts/fix-udeps.py udeps-report.json
|
|
||||||
|
|
||||||
.PHONY: fmt-check
|
.PHONY: fmt-check
|
||||||
fmt-check: ## Check code format.
|
fmt-check: ## Check code format.
|
||||||
cargo fmt --all -- --check
|
cargo fmt --all -- --check
|
||||||
|
|||||||
72
README.md
72
README.md
@@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<h3 align="center">
|
<h3 align="center">
|
||||||
<a href="https://docs.greptime.com/user-guide/overview/">User Guide</a> |
|
<a href="https://greptime.com/product/cloud">GreptimeCloud</a> |
|
||||||
|
<a href="https://docs.greptime.com/">User Guide</a> |
|
||||||
<a href="https://greptimedb.rs/">API Docs</a> |
|
<a href="https://greptimedb.rs/">API Docs</a> |
|
||||||
<a href="https://github.com/GreptimeTeam/greptimedb/issues/5446">Roadmap 2025</a>
|
<a href="https://github.com/GreptimeTeam/greptimedb/issues/5446">Roadmap 2025</a>
|
||||||
</h4>
|
</h4>
|
||||||
@@ -66,24 +67,17 @@
|
|||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|
||||||
**GreptimeDB** is an open-source, cloud-native database that unifies metrics, logs, and traces, enabling real-time observability at any scale — across edge, cloud, and hybrid environments.
|
**GreptimeDB** is an open-source, cloud-native database purpose-built for the unified collection and analysis of observability data (metrics, logs, and traces). Whether you’re operating on the edge, in the cloud, or across hybrid environments, GreptimeDB empowers real-time insights at massive scale — all in one system.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
| Feature | Description |
|
| Feature | Description |
|
||||||
| --------- | ----------- |
|
| --------- | ----------- |
|
||||||
| [All-in-One Observability](https://docs.greptime.com/user-guide/concepts/why-greptimedb) | OpenTelemetry-native platform unifying metrics, logs, and traces. Query via [SQL](https://docs.greptime.com/user-guide/query-data/sql), [PromQL](https://docs.greptime.com/user-guide/query-data/promql), and [Flow](https://docs.greptime.com/user-guide/flow-computation/overview). |
|
| [Unified Observability Data](https://docs.greptime.com/user-guide/concepts/why-greptimedb) | Store metrics, logs, and traces as timestamped, contextual wide events. Query via [SQL](https://docs.greptime.com/user-guide/query-data/sql), [PromQL](https://docs.greptime.com/user-guide/query-data/promql), and [streaming](https://docs.greptime.com/user-guide/flow-computation/overview). |
|
||||||
| [High Performance](https://docs.greptime.com/user-guide/manage-data/data-index) | Written in Rust with [rich indexing](https://docs.greptime.com/user-guide/manage-data/data-index) (inverted, fulltext, skipping, vector), delivering sub-second responses at PB scale. |
|
| [High Performance & Cost Effective](https://docs.greptime.com/user-guide/manage-data/data-index) | Written in Rust, with a distributed query engine, [rich indexing](https://docs.greptime.com/user-guide/manage-data/data-index), and optimized columnar storage, delivering sub-second responses at PB scale. |
|
||||||
| [Cost Efficiency](https://docs.greptime.com/user-guide/concepts/architecture) | 50x lower operational and storage costs with compute-storage separation and native object storage (S3, Azure Blob, etc.). |
|
| [Cloud-Native Architecture](https://docs.greptime.com/user-guide/concepts/architecture) | Designed for [Kubernetes](https://docs.greptime.com/user-guide/deployments/deploy-on-kubernetes/greptimedb-operator-management), with compute/storage separation, native object storage (AWS S3, Azure Blob, etc.) and seamless cross-cloud access. |
|
||||||
| [Cloud-Native & Scalable](https://docs.greptime.com/user-guide/deployments-administration/deploy-on-kubernetes/greptimedb-operator-management) | Purpose-built for [Kubernetes](https://docs.greptime.com/user-guide/deployments-administration/deploy-on-kubernetes/greptimedb-operator-management) with unlimited cross-cloud scaling, handling hundreds of thousands of concurrent requests. |
|
| [Developer-Friendly](https://docs.greptime.com/user-guide/protocols/overview) | Access via SQL/PromQL interfaces, REST API, MySQL/PostgreSQL protocols, and popular ingestion [protocols](https://docs.greptime.com/user-guide/protocols/overview). |
|
||||||
| [Developer-Friendly](https://docs.greptime.com/user-guide/protocols/overview) | SQL/PromQL interfaces, built-in web dashboard, REST API, MySQL/PostgreSQL protocol compatibility, and native [OpenTelemetry](https://docs.greptime.com/user-guide/ingest-data/for-observability/opentelemetry/) support. |
|
| [Flexible Deployment](https://docs.greptime.com/user-guide/deployments/overview) | Deploy anywhere: edge (including ARM/[Android](https://docs.greptime.com/user-guide/deployments/run-on-android)) or cloud, with unified APIs and efficient data sync. |
|
||||||
| [Flexible Deployment](https://docs.greptime.com/user-guide/deployments-administration/overview) | Deploy anywhere from ARM-based edge devices (including [Android](https://docs.greptime.com/user-guide/deployments-administration/run-on-android)) to cloud, with unified APIs and efficient data sync. |
|
|
||||||
|
|
||||||
✅ **Perfect for:**
|
|
||||||
- Unified observability stack replacing Prometheus + Loki + Tempo
|
|
||||||
- Large-scale metrics with high cardinality (millions to billions of time series)
|
|
||||||
- Large-scale observability platform requiring cost efficiency and scalability
|
|
||||||
- IoT and edge computing with resource and bandwidth constraints
|
|
||||||
|
|
||||||
Learn more in [Why GreptimeDB](https://docs.greptime.com/user-guide/concepts/why-greptimedb) and [Observability 2.0 and the Database for It](https://greptime.com/blogs/2025-04-25-greptimedb-observability2-new-database).
|
Learn more in [Why GreptimeDB](https://docs.greptime.com/user-guide/concepts/why-greptimedb) and [Observability 2.0 and the Database for It](https://greptime.com/blogs/2025-04-25-greptimedb-observability2-new-database).
|
||||||
|
|
||||||
@@ -92,10 +86,10 @@ Learn more in [Why GreptimeDB](https://docs.greptime.com/user-guide/concepts/why
|
|||||||
| Feature | GreptimeDB | Traditional TSDB | Log Stores |
|
| Feature | GreptimeDB | Traditional TSDB | Log Stores |
|
||||||
|----------------------------------|-----------------------|--------------------|-----------------|
|
|----------------------------------|-----------------------|--------------------|-----------------|
|
||||||
| Data Types | Metrics, Logs, Traces | Metrics only | Logs only |
|
| Data Types | Metrics, Logs, Traces | Metrics only | Logs only |
|
||||||
| Query Language | SQL, PromQL | Custom/PromQL | Custom/DSL |
|
| Query Language | SQL, PromQL, Streaming| Custom/PromQL | Custom/DSL |
|
||||||
| Deployment | Edge + Cloud | Cloud/On-prem | Mostly central |
|
| Deployment | Edge + Cloud | Cloud/On-prem | Mostly central |
|
||||||
| Indexing & Performance | PB-Scale, Sub-second | Varies | Varies |
|
| Indexing & Performance | PB-Scale, Sub-second | Varies | Varies |
|
||||||
| Integration | REST API, SQL, Common protocols | Varies | Varies |
|
| Integration | REST, SQL, Common protocols | Varies | Varies |
|
||||||
|
|
||||||
**Performance:**
|
**Performance:**
|
||||||
* [GreptimeDB tops JSONBench's billion-record cold run test!](https://greptime.com/blogs/2025-03-18-jsonbench-greptimedb-performance)
|
* [GreptimeDB tops JSONBench's billion-record cold run test!](https://greptime.com/blogs/2025-03-18-jsonbench-greptimedb-performance)
|
||||||
@@ -105,18 +99,22 @@ Read [more benchmark reports](https://docs.greptime.com/user-guide/concepts/feat
|
|||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
GreptimeDB can run in two modes:
|
* Read the [architecture](https://docs.greptime.com/contributor-guide/overview/#architecture) document.
|
||||||
* **Standalone Mode** - Single binary for development and small deployments
|
* [DeepWiki](https://deepwiki.com/GreptimeTeam/greptimedb/1-overview) provides an in-depth look at GreptimeDB:
|
||||||
* **Distributed Mode** - Separate components for production scale:
|
|
||||||
- Frontend: Query processing and protocol handling
|
|
||||||
- Datanode: Data storage and retrieval
|
|
||||||
- Metasrv: Metadata management and coordination
|
|
||||||
|
|
||||||
Read the [architecture](https://docs.greptime.com/contributor-guide/overview/#architecture) document. [DeepWiki](https://deepwiki.com/GreptimeTeam/greptimedb/1-overview) provides an in-depth look at GreptimeDB:
|
|
||||||
<img alt="GreptimeDB System Overview" src="docs/architecture.png">
|
<img alt="GreptimeDB System Overview" src="docs/architecture.png">
|
||||||
|
|
||||||
## Try GreptimeDB
|
## Try GreptimeDB
|
||||||
|
|
||||||
|
### 1. [Live Demo](https://greptime.com/playground)
|
||||||
|
|
||||||
|
Experience GreptimeDB directly in your browser.
|
||||||
|
|
||||||
|
### 2. [GreptimeCloud](https://console.greptime.cloud/)
|
||||||
|
|
||||||
|
Start instantly with a free cluster.
|
||||||
|
|
||||||
|
### 3. Docker (Local Quickstart)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
docker pull greptime/greptimedb
|
docker pull greptime/greptimedb
|
||||||
```
|
```
|
||||||
@@ -132,8 +130,7 @@ docker run -p 127.0.0.1:4000-4003:4000-4003 \
|
|||||||
--postgres-addr 0.0.0.0:4003
|
--postgres-addr 0.0.0.0:4003
|
||||||
```
|
```
|
||||||
Dashboard: [http://localhost:4000/dashboard](http://localhost:4000/dashboard)
|
Dashboard: [http://localhost:4000/dashboard](http://localhost:4000/dashboard)
|
||||||
|
[Full Install Guide](https://docs.greptime.com/getting-started/installation/overview)
|
||||||
Read more in the [full Install Guide](https://docs.greptime.com/getting-started/installation/overview).
|
|
||||||
|
|
||||||
**Troubleshooting:**
|
**Troubleshooting:**
|
||||||
* Cannot connect to the database? Ensure that ports `4000`, `4001`, `4002`, and `4003` are not blocked by a firewall or used by other services.
|
* Cannot connect to the database? Ensure that ports `4000`, `4001`, `4002`, and `4003` are not blocked by a firewall or used by other services.
|
||||||
@@ -162,26 +159,21 @@ cargo run -- standalone start
|
|||||||
|
|
||||||
## Tools & Extensions
|
## Tools & Extensions
|
||||||
|
|
||||||
- **Kubernetes**: [GreptimeDB Operator](https://github.com/GrepTimeTeam/greptimedb-operator)
|
- **Kubernetes:** [GreptimeDB Operator](https://github.com/GrepTimeTeam/greptimedb-operator)
|
||||||
- **Helm Charts**: [Greptime Helm Charts](https://github.com/GreptimeTeam/helm-charts)
|
- **Helm Charts:** [Greptime Helm Charts](https://github.com/GreptimeTeam/helm-charts)
|
||||||
- **Dashboard**: [Web UI](https://github.com/GreptimeTeam/dashboard)
|
- **Dashboard:** [Web UI](https://github.com/GreptimeTeam/dashboard)
|
||||||
- **gRPC Ingester**: [Go](https://github.com/GreptimeTeam/greptimedb-ingester-go), [Java](https://github.com/GreptimeTeam/greptimedb-ingester-java), [C++](https://github.com/GreptimeTeam/greptimedb-ingester-cpp), [Erlang](https://github.com/GreptimeTeam/greptimedb-ingester-erl), [Rust](https://github.com/GreptimeTeam/greptimedb-ingester-rust)
|
- **SDKs/Ingester:** [Go](https://github.com/GreptimeTeam/greptimedb-ingester-go), [Java](https://github.com/GreptimeTeam/greptimedb-ingester-java), [C++](https://github.com/GreptimeTeam/greptimedb-ingester-cpp), [Erlang](https://github.com/GreptimeTeam/greptimedb-ingester-erl), [Rust](https://github.com/GreptimeTeam/greptimedb-ingester-rust), [JS](https://github.com/GreptimeTeam/greptimedb-ingester-js)
|
||||||
- **Grafana Data Source**: [GreptimeDB Grafana data source plugin](https://github.com/GreptimeTeam/greptimedb-grafana-datasource)
|
- **Grafana**: [Official Dashboard](https://github.com/GreptimeTeam/greptimedb/blob/main/grafana/README.md)
|
||||||
- **Grafana Dashboard**: [Official Dashboard for monitoring](https://github.com/GreptimeTeam/greptimedb/blob/main/grafana/README.md)
|
|
||||||
|
|
||||||
## Project Status
|
## Project Status
|
||||||
|
|
||||||
> **Status:** Beta — marching toward v1.0 GA!
|
> **Status:** Beta.
|
||||||
> **GA (v1.0):** January 10, 2026
|
> **GA (v1.0):** Targeted for mid 2025.
|
||||||
|
|
||||||
- Deployed in production by open-source projects and commercial users
|
- Being used in production by early adopters
|
||||||
- Stable, actively maintained, with regular releases ([version info](https://docs.greptime.com/nightly/reference/about-greptimedb-version))
|
- Stable, actively maintained, with regular releases ([version info](https://docs.greptime.com/nightly/reference/about-greptimedb-version))
|
||||||
- Suitable for evaluation and pilot deployments
|
- Suitable for evaluation and pilot deployments
|
||||||
|
|
||||||
GreptimeDB v1.0 represents a major milestone toward maturity — marking stable APIs, production readiness, and proven performance.
|
|
||||||
|
|
||||||
**Roadmap:** Beta1 (Nov 10) → Beta2 (Nov 24) → RC1 (Dec 8) → GA (Jan 10, 2026), please read [v1.0 highlights and release plan](https://greptime.com/blogs/2025-11-05-greptimedb-v1-highlights) for details.
|
|
||||||
|
|
||||||
For production use, we recommend using the latest stable release.
|
For production use, we recommend using the latest stable release.
|
||||||
[](https://www.star-history.com/#GreptimeTeam/GreptimeDB&Date)
|
[](https://www.star-history.com/#GreptimeTeam/GreptimeDB&Date)
|
||||||
|
|
||||||
@@ -222,5 +214,5 @@ Special thanks to all contributors! See [AUTHORS.md](https://github.com/Greptime
|
|||||||
|
|
||||||
- Uses [Apache Arrow™](https://arrow.apache.org/) (memory model)
|
- Uses [Apache Arrow™](https://arrow.apache.org/) (memory model)
|
||||||
- [Apache Parquet™](https://parquet.apache.org/) (file storage)
|
- [Apache Parquet™](https://parquet.apache.org/) (file storage)
|
||||||
- [Apache DataFusion™](https://arrow.apache.org/datafusion/) (query engine)
|
- [Apache Arrow DataFusion™](https://arrow.apache.org/datafusion/) (query engine)
|
||||||
- [Apache OpenDAL™](https://opendal.apache.org/) (data access abstraction)
|
- [Apache OpenDAL™](https://opendal.apache.org/) (data access abstraction)
|
||||||
|
|||||||
180
config/config.md
180
config/config.md
@@ -13,10 +13,9 @@
|
|||||||
| Key | Type | Default | Descriptions |
|
| Key | Type | Default | Descriptions |
|
||||||
| --- | -----| ------- | ----------- |
|
| --- | -----| ------- | ----------- |
|
||||||
| `default_timezone` | String | Unset | The default timezone of the server. |
|
| `default_timezone` | String | Unset | The default timezone of the server. |
|
||||||
| `default_column_prefix` | String | Unset | The default column prefix for auto-created time index and value columns. |
|
|
||||||
| `init_regions_in_background` | Bool | `false` | Initialize all regions in the background during the startup.<br/>By default, it provides services after all regions have been initialized. |
|
| `init_regions_in_background` | Bool | `false` | Initialize all regions in the background during the startup.<br/>By default, it provides services after all regions have been initialized. |
|
||||||
| `init_regions_parallelism` | Integer | `16` | Parallelism of initializing regions. |
|
| `init_regions_parallelism` | Integer | `16` | Parallelism of initializing regions. |
|
||||||
| `max_concurrent_queries` | Integer | `0` | The maximum current queries allowed to be executed. Zero means unlimited.<br/>NOTE: This setting affects scan_memory_limit's privileged tier allocation.<br/>When set, 70% of queries get privileged memory access (full scan_memory_limit).<br/>The remaining 30% get standard tier access (70% of scan_memory_limit). |
|
| `max_concurrent_queries` | Integer | `0` | The maximum current queries allowed to be executed. Zero means unlimited. |
|
||||||
| `enable_telemetry` | Bool | `true` | Enable telemetry to collect anonymous usage data. Enabled by default. |
|
| `enable_telemetry` | Bool | `true` | Enable telemetry to collect anonymous usage data. Enabled by default. |
|
||||||
| `max_in_flight_write_bytes` | String | Unset | The maximum in-flight write bytes. |
|
| `max_in_flight_write_bytes` | String | Unset | The maximum in-flight write bytes. |
|
||||||
| `runtime` | -- | -- | The runtime options. |
|
| `runtime` | -- | -- | The runtime options. |
|
||||||
@@ -26,15 +25,12 @@
|
|||||||
| `http.addr` | String | `127.0.0.1:4000` | The address to bind the HTTP server. |
|
| `http.addr` | String | `127.0.0.1:4000` | The address to bind the HTTP server. |
|
||||||
| `http.timeout` | String | `0s` | HTTP request timeout. Set to 0 to disable timeout. |
|
| `http.timeout` | String | `0s` | HTTP request timeout. Set to 0 to disable timeout. |
|
||||||
| `http.body_limit` | String | `64MB` | HTTP request body limit.<br/>The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.<br/>Set to 0 to disable limit. |
|
| `http.body_limit` | String | `64MB` | HTTP request body limit.<br/>The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.<br/>Set to 0 to disable limit. |
|
||||||
| `http.max_total_body_memory` | String | Unset | Maximum total memory for all concurrent HTTP request bodies.<br/>Set to 0 to disable the limit. Default: "0" (unlimited) |
|
|
||||||
| `http.enable_cors` | Bool | `true` | HTTP CORS support, it's turned on by default<br/>This allows browser to access http APIs without CORS restrictions |
|
| `http.enable_cors` | Bool | `true` | HTTP CORS support, it's turned on by default<br/>This allows browser to access http APIs without CORS restrictions |
|
||||||
| `http.cors_allowed_origins` | Array | Unset | Customize allowed origins for HTTP CORS. |
|
| `http.cors_allowed_origins` | Array | Unset | Customize allowed origins for HTTP CORS. |
|
||||||
| `http.prom_validation_mode` | String | `strict` | Whether to enable validation for Prometheus remote write requests.<br/>Available options:<br/>- strict: deny invalid UTF-8 strings (default).<br/>- lossy: allow invalid UTF-8 strings, replace invalid characters with REPLACEMENT_CHARACTER(U+FFFD).<br/>- unchecked: do not valid strings. |
|
| `http.prom_validation_mode` | String | `strict` | Whether to enable validation for Prometheus remote write requests.<br/>Available options:<br/>- strict: deny invalid UTF-8 strings (default).<br/>- lossy: allow invalid UTF-8 strings, replace invalid characters with REPLACEMENT_CHARACTER(U+FFFD).<br/>- unchecked: do not valid strings. |
|
||||||
| `grpc` | -- | -- | The gRPC server options. |
|
| `grpc` | -- | -- | The gRPC server options. |
|
||||||
| `grpc.bind_addr` | String | `127.0.0.1:4001` | The address to bind the gRPC server. |
|
| `grpc.bind_addr` | String | `127.0.0.1:4001` | The address to bind the gRPC server. |
|
||||||
| `grpc.runtime_size` | Integer | `8` | The number of server worker threads. |
|
| `grpc.runtime_size` | Integer | `8` | The number of server worker threads. |
|
||||||
| `grpc.max_total_message_memory` | String | Unset | Maximum total memory for all concurrent gRPC request messages.<br/>Set to 0 to disable the limit. Default: "0" (unlimited) |
|
|
||||||
| `grpc.max_connection_age` | String | Unset | The maximum connection age for gRPC connection.<br/>The value can be a human-readable time string. For example: `10m` for ten minutes or `1h` for one hour.<br/>Refer to https://grpc.io/docs/guides/keepalive/ for more details. |
|
|
||||||
| `grpc.tls` | -- | -- | gRPC server TLS options, see `mysql.tls` section. |
|
| `grpc.tls` | -- | -- | gRPC server TLS options, see `mysql.tls` section. |
|
||||||
| `grpc.tls.mode` | String | `disable` | TLS mode. |
|
| `grpc.tls.mode` | String | `disable` | TLS mode. |
|
||||||
| `grpc.tls.cert_path` | String | Unset | Certificate file path. |
|
| `grpc.tls.cert_path` | String | Unset | Certificate file path. |
|
||||||
@@ -45,7 +41,6 @@
|
|||||||
| `mysql.addr` | String | `127.0.0.1:4002` | The addr to bind the MySQL server. |
|
| `mysql.addr` | String | `127.0.0.1:4002` | The addr to bind the MySQL server. |
|
||||||
| `mysql.runtime_size` | Integer | `2` | The number of server worker threads. |
|
| `mysql.runtime_size` | Integer | `2` | The number of server worker threads. |
|
||||||
| `mysql.keep_alive` | String | `0s` | Server-side keep-alive time.<br/>Set to 0 (default) to disable. |
|
| `mysql.keep_alive` | String | `0s` | Server-side keep-alive time.<br/>Set to 0 (default) to disable. |
|
||||||
| `mysql.prepared_stmt_cache_size` | Integer | `10000` | Maximum entries in the MySQL prepared statement cache; default is 10,000. |
|
|
||||||
| `mysql.tls` | -- | -- | -- |
|
| `mysql.tls` | -- | -- | -- |
|
||||||
| `mysql.tls.mode` | String | `disable` | TLS mode, refer to https://www.postgresql.org/docs/current/libpq-ssl.html<br/>- `disable` (default value)<br/>- `prefer`<br/>- `require`<br/>- `verify-ca`<br/>- `verify-full` |
|
| `mysql.tls.mode` | String | `disable` | TLS mode, refer to https://www.postgresql.org/docs/current/libpq-ssl.html<br/>- `disable` (default value)<br/>- `prefer`<br/>- `require`<br/>- `verify-ca`<br/>- `verify-full` |
|
||||||
| `mysql.tls.cert_path` | String | Unset | Certificate file path. |
|
| `mysql.tls.cert_path` | String | Unset | Certificate file path. |
|
||||||
@@ -104,11 +99,9 @@
|
|||||||
| `flow.num_workers` | Integer | `0` | The number of flow worker in flownode.<br/>Not setting(or set to 0) this value will use the number of CPU cores divided by 2. |
|
| `flow.num_workers` | Integer | `0` | The number of flow worker in flownode.<br/>Not setting(or set to 0) this value will use the number of CPU cores divided by 2. |
|
||||||
| `query` | -- | -- | The query engine options. |
|
| `query` | -- | -- | The query engine options. |
|
||||||
| `query.parallelism` | Integer | `0` | Parallelism of the query engine.<br/>Default to 0, which means the number of CPU cores. |
|
| `query.parallelism` | Integer | `0` | Parallelism of the query engine.<br/>Default to 0, which means the number of CPU cores. |
|
||||||
| `query.memory_pool_size` | String | `50%` | Memory pool size for query execution operators (aggregation, sorting, join).<br/>Supports absolute size (e.g., "2GB", "4GB") or percentage of system memory (e.g., "20%").<br/>Setting it to 0 disables the limit (unbounded, default behavior).<br/>When this limit is reached, queries will fail with ResourceExhausted error.<br/>NOTE: This does NOT limit memory used by table scans. |
|
|
||||||
| `storage` | -- | -- | The data storage options. |
|
| `storage` | -- | -- | The data storage options. |
|
||||||
| `storage.data_home` | String | `./greptimedb_data` | The working home directory. |
|
| `storage.data_home` | String | `./greptimedb_data` | The working home directory. |
|
||||||
| `storage.type` | String | `File` | The storage type used to store the data.<br/>- `File`: the data is stored in the local file system.<br/>- `S3`: the data is stored in the S3 object storage.<br/>- `Gcs`: the data is stored in the Google Cloud Storage.<br/>- `Azblob`: the data is stored in the Azure Blob Storage.<br/>- `Oss`: the data is stored in the Aliyun OSS. |
|
| `storage.type` | String | `File` | The storage type used to store the data.<br/>- `File`: the data is stored in the local file system.<br/>- `S3`: the data is stored in the S3 object storage.<br/>- `Gcs`: the data is stored in the Google Cloud Storage.<br/>- `Azblob`: the data is stored in the Azure Blob Storage.<br/>- `Oss`: the data is stored in the Aliyun OSS. |
|
||||||
| `storage.enable_read_cache` | Bool | `true` | Whether to enable read cache. If not set, the read cache will be enabled by default when using object storage. |
|
|
||||||
| `storage.cache_path` | String | Unset | Read cache configuration for object storage such as 'S3' etc, it's configured by default when using object storage. It is recommended to configure it when using object storage for better performance.<br/>A local file directory, defaults to `{data_home}`. An empty string means disabling. |
|
| `storage.cache_path` | String | Unset | Read cache configuration for object storage such as 'S3' etc, it's configured by default when using object storage. It is recommended to configure it when using object storage for better performance.<br/>A local file directory, defaults to `{data_home}`. An empty string means disabling. |
|
||||||
| `storage.cache_capacity` | String | Unset | The local file cache capacity in bytes. If your disk space is sufficient, it is recommended to set it larger. |
|
| `storage.cache_capacity` | String | Unset | The local file cache capacity in bytes. If your disk space is sufficient, it is recommended to set it larger. |
|
||||||
| `storage.bucket` | String | Unset | The S3 bucket name.<br/>**It's only used when the storage type is `S3`, `Oss` and `Gcs`**. |
|
| `storage.bucket` | String | Unset | The S3 bucket name.<br/>**It's only used when the storage type is `S3`, `Oss` and `Gcs`**. |
|
||||||
@@ -152,15 +145,10 @@
|
|||||||
| `region_engine.mito.write_cache_path` | String | `""` | File system path for write cache, defaults to `{data_home}`. |
|
| `region_engine.mito.write_cache_path` | String | `""` | File system path for write cache, defaults to `{data_home}`. |
|
||||||
| `region_engine.mito.write_cache_size` | String | `5GiB` | Capacity for write cache. If your disk space is sufficient, it is recommended to set it larger. |
|
| `region_engine.mito.write_cache_size` | String | `5GiB` | Capacity for write cache. If your disk space is sufficient, it is recommended to set it larger. |
|
||||||
| `region_engine.mito.write_cache_ttl` | String | Unset | TTL for write cache. |
|
| `region_engine.mito.write_cache_ttl` | String | Unset | TTL for write cache. |
|
||||||
| `region_engine.mito.preload_index_cache` | Bool | `true` | Preload index (puffin) files into cache on region open (default: true).<br/>When enabled, index files are loaded into the write cache during region initialization,<br/>which can improve query performance at the cost of longer startup times. |
|
|
||||||
| `region_engine.mito.index_cache_percent` | Integer | `20` | Percentage of write cache capacity allocated for index (puffin) files (default: 20).<br/>The remaining capacity is used for data (parquet) files.<br/>Must be between 0 and 100 (exclusive). For example, with a 5GiB write cache and 20% allocation,<br/>1GiB is reserved for index files and 4GiB for data files. |
|
|
||||||
| `region_engine.mito.sst_write_buffer_size` | String | `8MB` | Buffer size for SST writing. |
|
| `region_engine.mito.sst_write_buffer_size` | String | `8MB` | Buffer size for SST writing. |
|
||||||
| `region_engine.mito.parallel_scan_channel_size` | Integer | `32` | Capacity of the channel to send data from parallel scan tasks to the main task. |
|
| `region_engine.mito.parallel_scan_channel_size` | Integer | `32` | Capacity of the channel to send data from parallel scan tasks to the main task. |
|
||||||
| `region_engine.mito.max_concurrent_scan_files` | Integer | `384` | Maximum number of SST files to scan concurrently. |
|
|
||||||
| `region_engine.mito.allow_stale_entries` | Bool | `false` | Whether to allow stale WAL entries read during replay. |
|
| `region_engine.mito.allow_stale_entries` | Bool | `false` | Whether to allow stale WAL entries read during replay. |
|
||||||
| `region_engine.mito.scan_memory_limit` | String | `50%` | Memory limit for table scans across all queries.<br/>Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%").<br/>Setting it to 0 disables the limit.<br/>NOTE: Works with max_concurrent_queries for tiered memory allocation.<br/>- If max_concurrent_queries is set: 70% of queries get full access, 30% get 70% access.<br/>- If max_concurrent_queries is 0 (unlimited): first 20 queries get full access, rest get 70% access. |
|
|
||||||
| `region_engine.mito.min_compaction_interval` | String | `0m` | Minimum time interval between two compactions.<br/>To align with the old behavior, the default value is 0 (no restrictions). |
|
| `region_engine.mito.min_compaction_interval` | String | `0m` | Minimum time interval between two compactions.<br/>To align with the old behavior, the default value is 0 (no restrictions). |
|
||||||
| `region_engine.mito.default_experimental_flat_format` | Bool | `false` | Whether to enable experimental flat format as the default format. |
|
|
||||||
| `region_engine.mito.index` | -- | -- | The options for index in Mito engine. |
|
| `region_engine.mito.index` | -- | -- | The options for index in Mito engine. |
|
||||||
| `region_engine.mito.index.aux_path` | String | `""` | Auxiliary directory path for the index in filesystem, used to store intermediate files for<br/>creating the index and staging files for searching the index, defaults to `{data_home}/index_intermediate`.<br/>The default name for this directory is `index_intermediate` for backward compatibility.<br/><br/>This path contains two subdirectories:<br/>- `__intm`: for storing intermediate files used during creating index.<br/>- `staging`: for storing staging files used during searching index. |
|
| `region_engine.mito.index.aux_path` | String | `""` | Auxiliary directory path for the index in filesystem, used to store intermediate files for<br/>creating the index and staging files for searching the index, defaults to `{data_home}/index_intermediate`.<br/>The default name for this directory is `index_intermediate` for backward compatibility.<br/><br/>This path contains two subdirectories:<br/>- `__intm`: for storing intermediate files used during creating index.<br/>- `staging`: for storing staging files used during searching index. |
|
||||||
| `region_engine.mito.index.staging_size` | String | `2GB` | The max capacity of the staging directory. |
|
| `region_engine.mito.index.staging_size` | String | `2GB` | The max capacity of the staging directory. |
|
||||||
@@ -192,28 +180,33 @@
|
|||||||
| `region_engine.mito.memtable.fork_dictionary_bytes` | String | `1GiB` | Max dictionary bytes.<br/>Only available for `partition_tree` memtable. |
|
| `region_engine.mito.memtable.fork_dictionary_bytes` | String | `1GiB` | Max dictionary bytes.<br/>Only available for `partition_tree` memtable. |
|
||||||
| `region_engine.file` | -- | -- | Enable the file engine. |
|
| `region_engine.file` | -- | -- | Enable the file engine. |
|
||||||
| `region_engine.metric` | -- | -- | Metric engine options. |
|
| `region_engine.metric` | -- | -- | Metric engine options. |
|
||||||
| `region_engine.metric.sparse_primary_key_encoding` | Bool | `true` | Whether to use sparse primary key encoding. |
|
| `region_engine.metric.experimental_sparse_primary_key_encoding` | Bool | `false` | Whether to enable the experimental sparse primary key encoding. |
|
||||||
| `logging` | -- | -- | The logging options. |
|
| `logging` | -- | -- | The logging options. |
|
||||||
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
||||||
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
||||||
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
||||||
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
|
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
|
||||||
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
||||||
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
||||||
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
||||||
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
||||||
| `logging.otlp_headers` | -- | -- | Additional OTLP headers, only valid when using OTLP http |
|
| `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
||||||
| `logging.tracing_sample_ratio` | -- | Unset | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
|
||||||
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
||||||
| `slow_query` | -- | -- | The slow query log options. |
|
| `slow_query` | -- | -- | The slow query log options. |
|
||||||
| `slow_query.enable` | Bool | `false` | Whether to enable slow query log. |
|
| `slow_query.enable` | Bool | `false` | Whether to enable slow query log. |
|
||||||
| `slow_query.record_type` | String | Unset | The record type of slow queries. It can be `system_table` or `log`. |
|
| `slow_query.record_type` | String | Unset | The record type of slow queries. It can be `system_table` or `log`. |
|
||||||
| `slow_query.threshold` | String | Unset | The threshold of slow query. |
|
| `slow_query.threshold` | String | Unset | The threshold of slow query. |
|
||||||
| `slow_query.sample_ratio` | Float | Unset | The sampling ratio of slow query log. The value should be in the range of (0, 1]. |
|
| `slow_query.sample_ratio` | Float | Unset | The sampling ratio of slow query log. The value should be in the range of (0, 1]. |
|
||||||
|
| `export_metrics` | -- | -- | The standalone can export its metrics and send to Prometheus compatible service (e.g. `greptimedb`) from remote-write API.<br/>This is only used for `greptimedb` to export its own metrics internally. It's different from prometheus scrape. |
|
||||||
|
| `export_metrics.enable` | Bool | `false` | whether enable export metrics. |
|
||||||
|
| `export_metrics.write_interval` | String | `30s` | The interval of export metrics. |
|
||||||
|
| `export_metrics.self_import` | -- | -- | For `standalone` mode, `self_import` is recommended to collect metrics generated by itself<br/>You must create the database before enabling it. |
|
||||||
|
| `export_metrics.self_import.db` | String | Unset | -- |
|
||||||
|
| `export_metrics.remote_write` | -- | -- | -- |
|
||||||
|
| `export_metrics.remote_write.url` | String | `""` | The prometheus remote write endpoint that the metrics send to. The url example can be: `http://127.0.0.1:4000/v1/prometheus/write?db=greptime_metrics`. |
|
||||||
|
| `export_metrics.remote_write.headers` | InlineTable | -- | HTTP headers of Prometheus remote-write carry. |
|
||||||
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
||||||
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
||||||
| `memory` | -- | -- | The memory options. |
|
|
||||||
| `memory.enable_heap_profiling` | Bool | `true` | Whether to enable heap profiling activation during startup.<br/>When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable<br/>is set to "prof:true,prof_active:false". The official image adds this env variable.<br/>Default is true. |
|
|
||||||
|
|
||||||
|
|
||||||
## Distributed Mode
|
## Distributed Mode
|
||||||
@@ -223,7 +216,6 @@
|
|||||||
| Key | Type | Default | Descriptions |
|
| Key | Type | Default | Descriptions |
|
||||||
| --- | -----| ------- | ----------- |
|
| --- | -----| ------- | ----------- |
|
||||||
| `default_timezone` | String | Unset | The default timezone of the server. |
|
| `default_timezone` | String | Unset | The default timezone of the server. |
|
||||||
| `default_column_prefix` | String | Unset | The default column prefix for auto-created time index and value columns. |
|
|
||||||
| `max_in_flight_write_bytes` | String | Unset | The maximum in-flight write bytes. |
|
| `max_in_flight_write_bytes` | String | Unset | The maximum in-flight write bytes. |
|
||||||
| `runtime` | -- | -- | The runtime options. |
|
| `runtime` | -- | -- | The runtime options. |
|
||||||
| `runtime.global_rt_size` | Integer | `8` | The number of threads to execute the runtime for global read operations. |
|
| `runtime.global_rt_size` | Integer | `8` | The number of threads to execute the runtime for global read operations. |
|
||||||
@@ -235,7 +227,6 @@
|
|||||||
| `http.addr` | String | `127.0.0.1:4000` | The address to bind the HTTP server. |
|
| `http.addr` | String | `127.0.0.1:4000` | The address to bind the HTTP server. |
|
||||||
| `http.timeout` | String | `0s` | HTTP request timeout. Set to 0 to disable timeout. |
|
| `http.timeout` | String | `0s` | HTTP request timeout. Set to 0 to disable timeout. |
|
||||||
| `http.body_limit` | String | `64MB` | HTTP request body limit.<br/>The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.<br/>Set to 0 to disable limit. |
|
| `http.body_limit` | String | `64MB` | HTTP request body limit.<br/>The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.<br/>Set to 0 to disable limit. |
|
||||||
| `http.max_total_body_memory` | String | Unset | Maximum total memory for all concurrent HTTP request bodies.<br/>Set to 0 to disable the limit. Default: "0" (unlimited) |
|
|
||||||
| `http.enable_cors` | Bool | `true` | HTTP CORS support, it's turned on by default<br/>This allows browser to access http APIs without CORS restrictions |
|
| `http.enable_cors` | Bool | `true` | HTTP CORS support, it's turned on by default<br/>This allows browser to access http APIs without CORS restrictions |
|
||||||
| `http.cors_allowed_origins` | Array | Unset | Customize allowed origins for HTTP CORS. |
|
| `http.cors_allowed_origins` | Array | Unset | Customize allowed origins for HTTP CORS. |
|
||||||
| `http.prom_validation_mode` | String | `strict` | Whether to enable validation for Prometheus remote write requests.<br/>Available options:<br/>- strict: deny invalid UTF-8 strings (default).<br/>- lossy: allow invalid UTF-8 strings, replace invalid characters with REPLACEMENT_CHARACTER(U+FFFD).<br/>- unchecked: do not valid strings. |
|
| `http.prom_validation_mode` | String | `strict` | Whether to enable validation for Prometheus remote write requests.<br/>Available options:<br/>- strict: deny invalid UTF-8 strings (default).<br/>- lossy: allow invalid UTF-8 strings, replace invalid characters with REPLACEMENT_CHARACTER(U+FFFD).<br/>- unchecked: do not valid strings. |
|
||||||
@@ -243,30 +234,17 @@
|
|||||||
| `grpc.bind_addr` | String | `127.0.0.1:4001` | The address to bind the gRPC server. |
|
| `grpc.bind_addr` | String | `127.0.0.1:4001` | The address to bind the gRPC server. |
|
||||||
| `grpc.server_addr` | String | `127.0.0.1:4001` | The address advertised to the metasrv, and used for connections from outside the host.<br/>If left empty or unset, the server will automatically use the IP address of the first network interface<br/>on the host, with the same port number as the one specified in `grpc.bind_addr`. |
|
| `grpc.server_addr` | String | `127.0.0.1:4001` | The address advertised to the metasrv, and used for connections from outside the host.<br/>If left empty or unset, the server will automatically use the IP address of the first network interface<br/>on the host, with the same port number as the one specified in `grpc.bind_addr`. |
|
||||||
| `grpc.runtime_size` | Integer | `8` | The number of server worker threads. |
|
| `grpc.runtime_size` | Integer | `8` | The number of server worker threads. |
|
||||||
| `grpc.max_total_message_memory` | String | Unset | Maximum total memory for all concurrent gRPC request messages.<br/>Set to 0 to disable the limit. Default: "0" (unlimited) |
|
|
||||||
| `grpc.flight_compression` | String | `arrow_ipc` | Compression mode for frontend side Arrow IPC service. Available options:<br/>- `none`: disable all compression<br/>- `transport`: only enable gRPC transport compression (zstd)<br/>- `arrow_ipc`: only enable Arrow IPC compression (lz4)<br/>- `all`: enable all compression.<br/>Default to `none` |
|
| `grpc.flight_compression` | String | `arrow_ipc` | Compression mode for frontend side Arrow IPC service. Available options:<br/>- `none`: disable all compression<br/>- `transport`: only enable gRPC transport compression (zstd)<br/>- `arrow_ipc`: only enable Arrow IPC compression (lz4)<br/>- `all`: enable all compression.<br/>Default to `none` |
|
||||||
| `grpc.max_connection_age` | String | Unset | The maximum connection age for gRPC connection.<br/>The value can be a human-readable time string. For example: `10m` for ten minutes or `1h` for one hour.<br/>Refer to https://grpc.io/docs/guides/keepalive/ for more details. |
|
|
||||||
| `grpc.tls` | -- | -- | gRPC server TLS options, see `mysql.tls` section. |
|
| `grpc.tls` | -- | -- | gRPC server TLS options, see `mysql.tls` section. |
|
||||||
| `grpc.tls.mode` | String | `disable` | TLS mode. |
|
| `grpc.tls.mode` | String | `disable` | TLS mode. |
|
||||||
| `grpc.tls.cert_path` | String | Unset | Certificate file path. |
|
| `grpc.tls.cert_path` | String | Unset | Certificate file path. |
|
||||||
| `grpc.tls.key_path` | String | Unset | Private key file path. |
|
| `grpc.tls.key_path` | String | Unset | Private key file path. |
|
||||||
| `grpc.tls.watch` | Bool | `false` | Watch for Certificate and key file change and auto reload.<br/>For now, gRPC tls config does not support auto reload. |
|
| `grpc.tls.watch` | Bool | `false` | Watch for Certificate and key file change and auto reload.<br/>For now, gRPC tls config does not support auto reload. |
|
||||||
| `internal_grpc` | -- | -- | The internal gRPC server options. Internal gRPC port for nodes inside cluster to access frontend. |
|
|
||||||
| `internal_grpc.bind_addr` | String | `127.0.0.1:4010` | The address to bind the gRPC server. |
|
|
||||||
| `internal_grpc.server_addr` | String | `127.0.0.1:4010` | The address advertised to the metasrv, and used for connections from outside the host.<br/>If left empty or unset, the server will automatically use the IP address of the first network interface<br/>on the host, with the same port number as the one specified in `grpc.bind_addr`. |
|
|
||||||
| `internal_grpc.runtime_size` | Integer | `8` | The number of server worker threads. |
|
|
||||||
| `internal_grpc.flight_compression` | String | `arrow_ipc` | Compression mode for frontend side Arrow IPC service. Available options:<br/>- `none`: disable all compression<br/>- `transport`: only enable gRPC transport compression (zstd)<br/>- `arrow_ipc`: only enable Arrow IPC compression (lz4)<br/>- `all`: enable all compression.<br/>Default to `none` |
|
|
||||||
| `internal_grpc.tls` | -- | -- | internal gRPC server TLS options, see `mysql.tls` section. |
|
|
||||||
| `internal_grpc.tls.mode` | String | `disable` | TLS mode. |
|
|
||||||
| `internal_grpc.tls.cert_path` | String | Unset | Certificate file path. |
|
|
||||||
| `internal_grpc.tls.key_path` | String | Unset | Private key file path. |
|
|
||||||
| `internal_grpc.tls.watch` | Bool | `false` | Watch for Certificate and key file change and auto reload.<br/>For now, gRPC tls config does not support auto reload. |
|
|
||||||
| `mysql` | -- | -- | MySQL server options. |
|
| `mysql` | -- | -- | MySQL server options. |
|
||||||
| `mysql.enable` | Bool | `true` | Whether to enable. |
|
| `mysql.enable` | Bool | `true` | Whether to enable. |
|
||||||
| `mysql.addr` | String | `127.0.0.1:4002` | The addr to bind the MySQL server. |
|
| `mysql.addr` | String | `127.0.0.1:4002` | The addr to bind the MySQL server. |
|
||||||
| `mysql.runtime_size` | Integer | `2` | The number of server worker threads. |
|
| `mysql.runtime_size` | Integer | `2` | The number of server worker threads. |
|
||||||
| `mysql.keep_alive` | String | `0s` | Server-side keep-alive time.<br/>Set to 0 (default) to disable. |
|
| `mysql.keep_alive` | String | `0s` | Server-side keep-alive time.<br/>Set to 0 (default) to disable. |
|
||||||
| `mysql.prepared_stmt_cache_size` | Integer | `10000` | Maximum entries in the MySQL prepared statement cache; default is 10,000. |
|
|
||||||
| `mysql.tls` | -- | -- | -- |
|
| `mysql.tls` | -- | -- | -- |
|
||||||
| `mysql.tls.mode` | String | `disable` | TLS mode, refer to https://www.postgresql.org/docs/current/libpq-ssl.html<br/>- `disable` (default value)<br/>- `prefer`<br/>- `require`<br/>- `verify-ca`<br/>- `verify-full` |
|
| `mysql.tls.mode` | String | `disable` | TLS mode, refer to https://www.postgresql.org/docs/current/libpq-ssl.html<br/>- `disable` (default value)<br/>- `prefer`<br/>- `require`<br/>- `verify-ca`<br/>- `verify-full` |
|
||||||
| `mysql.tls.cert_path` | String | Unset | Certificate file path. |
|
| `mysql.tls.cert_path` | String | Unset | Certificate file path. |
|
||||||
@@ -303,8 +281,6 @@
|
|||||||
| `meta_client.metadata_cache_tti` | String | `5m` | -- |
|
| `meta_client.metadata_cache_tti` | String | `5m` | -- |
|
||||||
| `query` | -- | -- | The query engine options. |
|
| `query` | -- | -- | The query engine options. |
|
||||||
| `query.parallelism` | Integer | `0` | Parallelism of the query engine.<br/>Default to 0, which means the number of CPU cores. |
|
| `query.parallelism` | Integer | `0` | Parallelism of the query engine.<br/>Default to 0, which means the number of CPU cores. |
|
||||||
| `query.allow_query_fallback` | Bool | `false` | Whether to allow query fallback when push down optimize fails.<br/>Default to false, meaning when push down optimize failed, return error msg |
|
|
||||||
| `query.memory_pool_size` | String | `50%` | Memory pool size for query execution operators (aggregation, sorting, join).<br/>Supports absolute size (e.g., "4GB", "8GB") or percentage of system memory (e.g., "30%").<br/>Setting it to 0 disables the limit (unbounded, default behavior).<br/>When this limit is reached, queries will fail with ResourceExhausted error.<br/>NOTE: This does NOT limit memory used by table scans (only applies to datanodes). |
|
|
||||||
| `datanode` | -- | -- | Datanode options. |
|
| `datanode` | -- | -- | Datanode options. |
|
||||||
| `datanode.client` | -- | -- | Datanode client options. |
|
| `datanode.client` | -- | -- | Datanode client options. |
|
||||||
| `datanode.client.connect_timeout` | String | `10s` | -- |
|
| `datanode.client.connect_timeout` | String | `10s` | -- |
|
||||||
@@ -313,26 +289,27 @@
|
|||||||
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
||||||
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
||||||
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
||||||
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
|
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
|
||||||
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
||||||
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
||||||
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
||||||
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
||||||
| `logging.otlp_headers` | -- | -- | Additional OTLP headers, only valid when using OTLP http |
|
| `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
||||||
| `logging.tracing_sample_ratio` | -- | Unset | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
|
||||||
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
||||||
| `slow_query` | -- | -- | The slow query log options. |
|
| `slow_query` | -- | -- | The slow query log options. |
|
||||||
| `slow_query.enable` | Bool | `true` | Whether to enable slow query log. |
|
| `slow_query.enable` | Bool | `true` | Whether to enable slow query log. |
|
||||||
| `slow_query.record_type` | String | `system_table` | The record type of slow queries. It can be `system_table` or `log`.<br/>If `system_table` is selected, the slow queries will be recorded in a system table `greptime_private.slow_queries`.<br/>If `log` is selected, the slow queries will be logged in a log file `greptimedb-slow-queries.*`. |
|
| `slow_query.record_type` | String | `system_table` | The record type of slow queries. It can be `system_table` or `log`.<br/>If `system_table` is selected, the slow queries will be recorded in a system table `greptime_private.slow_queries`.<br/>If `log` is selected, the slow queries will be logged in a log file `greptimedb-slow-queries.*`. |
|
||||||
| `slow_query.threshold` | String | `30s` | The threshold of slow query. It can be human readable time string, for example: `10s`, `100ms`, `1s`. |
|
| `slow_query.threshold` | String | `30s` | The threshold of slow query. It can be human readable time string, for example: `10s`, `100ms`, `1s`. |
|
||||||
| `slow_query.sample_ratio` | Float | `1.0` | The sampling ratio of slow query log. The value should be in the range of (0, 1]. For example, `0.1` means 10% of the slow queries will be logged and `1.0` means all slow queries will be logged. |
|
| `slow_query.sample_ratio` | Float | `1.0` | The sampling ratio of slow query log. The value should be in the range of (0, 1]. For example, `0.1` means 10% of the slow queries will be logged and `1.0` means all slow queries will be logged. |
|
||||||
| `slow_query.ttl` | String | `90d` | The TTL of the `slow_queries` system table. Default is `90d` when `record_type` is `system_table`. |
|
| `slow_query.ttl` | String | `30d` | The TTL of the `slow_queries` system table. Default is `30d` when `record_type` is `system_table`. |
|
||||||
|
| `export_metrics` | -- | -- | The frontend can export its metrics and send to Prometheus compatible service (e.g. `greptimedb` itself) from remote-write API.<br/>This is only used for `greptimedb` to export its own metrics internally. It's different from prometheus scrape. |
|
||||||
|
| `export_metrics.enable` | Bool | `false` | whether enable export metrics. |
|
||||||
|
| `export_metrics.write_interval` | String | `30s` | The interval of export metrics. |
|
||||||
|
| `export_metrics.remote_write` | -- | -- | -- |
|
||||||
|
| `export_metrics.remote_write.url` | String | `""` | The prometheus remote write endpoint that the metrics send to. The url example can be: `http://127.0.0.1:4000/v1/prometheus/write?db=greptime_metrics`. |
|
||||||
|
| `export_metrics.remote_write.headers` | InlineTable | -- | HTTP headers of Prometheus remote-write carry. |
|
||||||
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
||||||
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
||||||
| `memory` | -- | -- | The memory options. |
|
|
||||||
| `memory.enable_heap_profiling` | Bool | `true` | Whether to enable heap profiling activation during startup.<br/>When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable<br/>is set to "prof:true,prof_active:false". The official image adds this env variable.<br/>Default is true. |
|
|
||||||
| `event_recorder` | -- | -- | Configuration options for the event recorder. |
|
|
||||||
| `event_recorder.ttl` | String | `90d` | TTL for the events table that will be used to store the events. Default is `90d`. |
|
|
||||||
|
|
||||||
|
|
||||||
### Metasrv
|
### Metasrv
|
||||||
@@ -340,27 +317,21 @@
|
|||||||
| Key | Type | Default | Descriptions |
|
| Key | Type | Default | Descriptions |
|
||||||
| --- | -----| ------- | ----------- |
|
| --- | -----| ------- | ----------- |
|
||||||
| `data_home` | String | `./greptimedb_data` | The working home directory. |
|
| `data_home` | String | `./greptimedb_data` | The working home directory. |
|
||||||
| `store_addrs` | Array | -- | Store server address(es). The format depends on the selected backend.<br/><br/>For etcd: a list of "host:port" endpoints.<br/>e.g. ["192.168.1.1:2379", "192.168.1.2:2379"]<br/><br/>For PostgreSQL: a connection string in libpq format or URI.<br/>e.g.<br/>- "host=localhost port=5432 user=postgres password=<PASSWORD> dbname=postgres"<br/>- "postgresql://user:password@localhost:5432/mydb?connect_timeout=10"<br/>The detail see: https://docs.rs/tokio-postgres/latest/tokio_postgres/config/struct.Config.html<br/><br/>For mysql store, the format is a MySQL connection URL.<br/>e.g. "mysql://user:password@localhost:3306/greptime_meta?ssl-mode=VERIFY_CA&ssl-ca=/path/to/ca.pem" |
|
| `store_addrs` | Array | -- | Store server address default to etcd store.<br/>For postgres store, the format is:<br/>"password=password dbname=postgres user=postgres host=localhost port=5432"<br/>For etcd store, the format is:<br/>"127.0.0.1:2379" |
|
||||||
| `store_key_prefix` | String | `""` | If it's not empty, the metasrv will store all data with this key prefix. |
|
| `store_key_prefix` | String | `""` | If it's not empty, the metasrv will store all data with this key prefix. |
|
||||||
| `backend` | String | `etcd_store` | The datastore for meta server.<br/>Available values:<br/>- `etcd_store` (default value)<br/>- `memory_store`<br/>- `postgres_store`<br/>- `mysql_store` |
|
| `backend` | String | `etcd_store` | The datastore for meta server.<br/>Available values:<br/>- `etcd_store` (default value)<br/>- `memory_store`<br/>- `postgres_store`<br/>- `mysql_store` |
|
||||||
| `meta_table_name` | String | `greptime_metakv` | Table name in RDS to store metadata. Effect when using a RDS kvbackend.<br/>**Only used when backend is `postgres_store`.** |
|
| `meta_table_name` | String | `greptime_metakv` | Table name in RDS to store metadata. Effect when using a RDS kvbackend.<br/>**Only used when backend is `postgres_store`.** |
|
||||||
| `meta_schema_name` | String | `greptime_schema` | Optional PostgreSQL schema for metadata table and election table name qualification.<br/>When PostgreSQL public schema is not writable (e.g., PostgreSQL 15+ with restricted public),<br/>set this to a writable schema. GreptimeDB will use `meta_schema_name`.`meta_table_name`.<br/>GreptimeDB will NOT create the schema automatically; please ensure it exists or the user has permission.<br/>**Only used when backend is `postgres_store`.** |
|
|
||||||
| `meta_election_lock_id` | Integer | `1` | Advisory lock id in PostgreSQL for election. Effect when using PostgreSQL as kvbackend<br/>Only used when backend is `postgres_store`. |
|
| `meta_election_lock_id` | Integer | `1` | Advisory lock id in PostgreSQL for election. Effect when using PostgreSQL as kvbackend<br/>Only used when backend is `postgres_store`. |
|
||||||
| `selector` | String | `round_robin` | Datanode selector type.<br/>- `round_robin` (default value)<br/>- `lease_based`<br/>- `load_based`<br/>For details, please see "https://docs.greptime.com/developer-guide/metasrv/selector". |
|
| `selector` | String | `round_robin` | Datanode selector type.<br/>- `round_robin` (default value)<br/>- `lease_based`<br/>- `load_based`<br/>For details, please see "https://docs.greptime.com/developer-guide/metasrv/selector". |
|
||||||
| `use_memory_store` | Bool | `false` | Store data in memory. |
|
| `use_memory_store` | Bool | `false` | Store data in memory. |
|
||||||
| `enable_region_failover` | Bool | `false` | Whether to enable region failover.<br/>This feature is only available on GreptimeDB running on cluster mode and<br/>- Using Remote WAL<br/>- Using shared storage (e.g., s3). |
|
| `enable_region_failover` | Bool | `false` | Whether to enable region failover.<br/>This feature is only available on GreptimeDB running on cluster mode and<br/>- Using Remote WAL<br/>- Using shared storage (e.g., s3). |
|
||||||
| `region_failure_detector_initialization_delay` | String | `10m` | The delay before starting region failure detection.<br/>This delay helps prevent Metasrv from triggering unnecessary region failovers before all Datanodes are fully started.<br/>Especially useful when the cluster is not deployed with GreptimeDB Operator and maintenance mode is not enabled. |
|
| `region_failure_detector_initialization_delay` | String | `10m` | Delay before initializing region failure detectors.<br/>This delay helps prevent premature initialization of region failure detectors in cases where<br/>cluster maintenance mode is enabled right after metasrv starts, especially when the cluster<br/>is not deployed via the recommended GreptimeDB Operator. Without this delay, early detector registration<br/>may trigger unnecessary region failovers during datanode startup. |
|
||||||
| `allow_region_failover_on_local_wal` | Bool | `false` | Whether to allow region failover on local WAL.<br/>**This option is not recommended to be set to true, because it may lead to data loss during failover.** |
|
| `allow_region_failover_on_local_wal` | Bool | `false` | Whether to allow region failover on local WAL.<br/>**This option is not recommended to be set to true, because it may lead to data loss during failover.** |
|
||||||
| `node_max_idle_time` | String | `24hours` | Max allowed idle time before removing node info from metasrv memory. |
|
| `node_max_idle_time` | String | `24hours` | Max allowed idle time before removing node info from metasrv memory. |
|
||||||
| `enable_telemetry` | Bool | `true` | Whether to enable greptimedb telemetry. Enabled by default. |
|
| `enable_telemetry` | Bool | `true` | Whether to enable greptimedb telemetry. Enabled by default. |
|
||||||
| `runtime` | -- | -- | The runtime options. |
|
| `runtime` | -- | -- | The runtime options. |
|
||||||
| `runtime.global_rt_size` | Integer | `8` | The number of threads to execute the runtime for global read operations. |
|
| `runtime.global_rt_size` | Integer | `8` | The number of threads to execute the runtime for global read operations. |
|
||||||
| `runtime.compact_rt_size` | Integer | `4` | The number of threads to execute the runtime for global write operations. |
|
| `runtime.compact_rt_size` | Integer | `4` | The number of threads to execute the runtime for global write operations. |
|
||||||
| `backend_tls` | -- | -- | TLS configuration for kv store backend (applicable for etcd, PostgreSQL, and MySQL backends)<br/>When using etcd, PostgreSQL, or MySQL as metadata store, you can configure TLS here<br/><br/>Note: if TLS is configured in both this section and the `store_addrs` connection string, the<br/>settings here will override the TLS settings in `store_addrs`. |
|
|
||||||
| `backend_tls.mode` | String | `prefer` | TLS mode, refer to https://www.postgresql.org/docs/current/libpq-ssl.html<br/>- "disable" - No TLS<br/>- "prefer" (default) - Try TLS, fallback to plain<br/>- "require" - Require TLS<br/>- "verify_ca" - Require TLS and verify CA<br/>- "verify_full" - Require TLS and verify hostname |
|
|
||||||
| `backend_tls.cert_path` | String | `""` | Path to client certificate file (for client authentication)<br/>Like "/path/to/client.crt" |
|
|
||||||
| `backend_tls.key_path` | String | `""` | Path to client private key file (for client authentication)<br/>Like "/path/to/client.key" |
|
|
||||||
| `backend_tls.ca_cert_path` | String | `""` | Path to CA certificate file (for server certificate verification)<br/>Required when using custom CAs or self-signed certificates<br/>Leave empty to use system root certificates only<br/>Like "/path/to/ca.crt" |
|
|
||||||
| `grpc` | -- | -- | The gRPC server options. |
|
| `grpc` | -- | -- | The gRPC server options. |
|
||||||
| `grpc.bind_addr` | String | `127.0.0.1:3002` | The address to bind the gRPC server. |
|
| `grpc.bind_addr` | String | `127.0.0.1:3002` | The address to bind the gRPC server. |
|
||||||
| `grpc.server_addr` | String | `127.0.0.1:3002` | The communication server address for the frontend and datanode to connect to metasrv.<br/>If left empty or unset, the server will automatically use the IP address of the first network interface<br/>on the host, with the same port number as the one specified in `bind_addr`. |
|
| `grpc.server_addr` | String | `127.0.0.1:3002` | The communication server address for the frontend and datanode to connect to metasrv.<br/>If left empty or unset, the server will automatically use the IP address of the first network interface<br/>on the host, with the same port number as the one specified in `bind_addr`. |
|
||||||
@@ -377,9 +348,10 @@
|
|||||||
| `procedure.max_metadata_value_size` | String | `1500KiB` | Auto split large value<br/>GreptimeDB procedure uses etcd as the default metadata storage backend.<br/>The etcd the maximum size of any request is 1.5 MiB<br/>1500KiB = 1536KiB (1.5MiB) - 36KiB (reserved size of key)<br/>Comments out the `max_metadata_value_size`, for don't split large value (no limit). |
|
| `procedure.max_metadata_value_size` | String | `1500KiB` | Auto split large value<br/>GreptimeDB procedure uses etcd as the default metadata storage backend.<br/>The etcd the maximum size of any request is 1.5 MiB<br/>1500KiB = 1536KiB (1.5MiB) - 36KiB (reserved size of key)<br/>Comments out the `max_metadata_value_size`, for don't split large value (no limit). |
|
||||||
| `procedure.max_running_procedures` | Integer | `128` | Max running procedures.<br/>The maximum number of procedures that can be running at the same time.<br/>If the number of running procedures exceeds this limit, the procedure will be rejected. |
|
| `procedure.max_running_procedures` | Integer | `128` | Max running procedures.<br/>The maximum number of procedures that can be running at the same time.<br/>If the number of running procedures exceeds this limit, the procedure will be rejected. |
|
||||||
| `failure_detector` | -- | -- | -- |
|
| `failure_detector` | -- | -- | -- |
|
||||||
| `failure_detector.threshold` | Float | `8.0` | Maximum acceptable φ before the peer is treated as failed.<br/>Lower values react faster but yield more false positives. |
|
| `failure_detector.threshold` | Float | `8.0` | The threshold value used by the failure detector to determine failure conditions. |
|
||||||
| `failure_detector.min_std_deviation` | String | `100ms` | The minimum standard deviation of the heartbeat intervals.<br/>So tiny variations don’t make φ explode. Prevents hypersensitivity when heartbeat intervals barely vary. |
|
| `failure_detector.min_std_deviation` | String | `100ms` | The minimum standard deviation of the heartbeat intervals, used to calculate acceptable variations. |
|
||||||
| `failure_detector.acceptable_heartbeat_pause` | String | `10000ms` | The acceptable pause duration between heartbeats.<br/>Additional extra grace period to the learned mean interval before φ rises, absorbing temporary network hiccups or GC pauses. |
|
| `failure_detector.acceptable_heartbeat_pause` | String | `10000ms` | The acceptable pause duration between heartbeats, used to determine if a heartbeat interval is acceptable. |
|
||||||
|
| `failure_detector.first_heartbeat_estimate` | String | `1000ms` | The initial estimate of the heartbeat interval used by the failure detector. |
|
||||||
| `datanode` | -- | -- | Datanode options. |
|
| `datanode` | -- | -- | Datanode options. |
|
||||||
| `datanode.client` | -- | -- | Datanode client options. |
|
| `datanode.client` | -- | -- | Datanode client options. |
|
||||||
| `datanode.client.timeout` | String | `10s` | Operation timeout. |
|
| `datanode.client.timeout` | String | `10s` | Operation timeout. |
|
||||||
@@ -387,38 +359,35 @@
|
|||||||
| `datanode.client.tcp_nodelay` | Bool | `true` | `TCP_NODELAY` option for accepted connections. |
|
| `datanode.client.tcp_nodelay` | Bool | `true` | `TCP_NODELAY` option for accepted connections. |
|
||||||
| `wal` | -- | -- | -- |
|
| `wal` | -- | -- | -- |
|
||||||
| `wal.provider` | String | `raft_engine` | -- |
|
| `wal.provider` | String | `raft_engine` | -- |
|
||||||
| `wal.broker_endpoints` | Array | -- | The broker endpoints of the Kafka cluster.<br/><br/>**It's only used when the provider is `kafka`**. |
|
| `wal.broker_endpoints` | Array | -- | The broker endpoints of the Kafka cluster. |
|
||||||
| `wal.auto_create_topics` | Bool | `true` | Automatically create topics for WAL.<br/>Set to `true` to automatically create topics for WAL.<br/>Otherwise, use topics named `topic_name_prefix_[0..num_topics)`<br/>**It's only used when the provider is `kafka`**. |
|
| `wal.auto_create_topics` | Bool | `true` | Automatically create topics for WAL.<br/>Set to `true` to automatically create topics for WAL.<br/>Otherwise, use topics named `topic_name_prefix_[0..num_topics)` |
|
||||||
| `wal.auto_prune_interval` | String | `30m` | Interval of automatically WAL pruning.<br/>Set to `0s` to disable automatically WAL pruning which delete unused remote WAL entries periodically.<br/>**It's only used when the provider is `kafka`**. |
|
| `wal.auto_prune_interval` | String | `0s` | Interval of automatically WAL pruning.<br/>Set to `0s` to disable automatically WAL pruning which delete unused remote WAL entries periodically. |
|
||||||
| `wal.flush_trigger_size` | String | `512MB` | Estimated size threshold to trigger a flush when using Kafka remote WAL.<br/>Since multiple regions may share a Kafka topic, the estimated size is calculated as:<br/> (latest_entry_id - flushed_entry_id) * avg_record_size<br/>MetaSrv triggers a flush for a region when this estimated size exceeds `flush_trigger_size`.<br/>- `latest_entry_id`: The latest entry ID in the topic.<br/>- `flushed_entry_id`: The last flushed entry ID for the region.<br/>Set to "0" to let the system decide the flush trigger size.<br/>**It's only used when the provider is `kafka`**. |
|
| `wal.trigger_flush_threshold` | Integer | `0` | The threshold to trigger a flush operation of a region in automatically WAL pruning.<br/>Metasrv will send a flush request to flush the region when:<br/>`trigger_flush_threshold` + `prunable_entry_id` < `max_prunable_entry_id`<br/>where:<br/>- `prunable_entry_id` is the maximum entry id that can be pruned of the region.<br/>- `max_prunable_entry_id` is the maximum prunable entry id among all regions in the same topic.<br/>Set to `0` to disable the flush operation. |
|
||||||
| `wal.checkpoint_trigger_size` | String | `128MB` | Estimated size threshold to trigger a checkpoint when using Kafka remote WAL.<br/>The estimated size is calculated as:<br/> (latest_entry_id - last_checkpoint_entry_id) * avg_record_size<br/>MetaSrv triggers a checkpoint for a region when this estimated size exceeds `checkpoint_trigger_size`.<br/>Set to "0" to let the system decide the checkpoint trigger size.<br/>**It's only used when the provider is `kafka`**. |
|
| `wal.auto_prune_parallelism` | Integer | `10` | Concurrent task limit for automatically WAL pruning. |
|
||||||
| `wal.auto_prune_parallelism` | Integer | `10` | Concurrent task limit for automatically WAL pruning.<br/>**It's only used when the provider is `kafka`**. |
|
| `wal.num_topics` | Integer | `64` | Number of topics. |
|
||||||
| `wal.num_topics` | Integer | `64` | Number of topics used for remote WAL.<br/>**It's only used when the provider is `kafka`**. |
|
| `wal.selector_type` | String | `round_robin` | Topic selector type.<br/>Available selector types:<br/>- `round_robin` (default) |
|
||||||
| `wal.selector_type` | String | `round_robin` | Topic selector type.<br/>Available selector types:<br/>- `round_robin` (default)<br/>**It's only used when the provider is `kafka`**. |
|
| `wal.topic_name_prefix` | String | `greptimedb_wal_topic` | A Kafka topic is constructed by concatenating `topic_name_prefix` and `topic_id`.<br/>Only accepts strings that match the following regular expression pattern:<br/>[a-zA-Z_:-][a-zA-Z0-9_:\-\.@#]*<br/>i.g., greptimedb_wal_topic_0, greptimedb_wal_topic_1. |
|
||||||
| `wal.topic_name_prefix` | String | `greptimedb_wal_topic` | A Kafka topic is constructed by concatenating `topic_name_prefix` and `topic_id`.<br/>Only accepts strings that match the following regular expression pattern:<br/>[a-zA-Z_:-][a-zA-Z0-9_:\-\.@#]*<br/>i.g., greptimedb_wal_topic_0, greptimedb_wal_topic_1.<br/>**It's only used when the provider is `kafka`**. |
|
| `wal.replication_factor` | Integer | `1` | Expected number of replicas of each partition. |
|
||||||
| `wal.replication_factor` | Integer | `1` | Expected number of replicas of each partition.<br/>**It's only used when the provider is `kafka`**. |
|
| `wal.create_topic_timeout` | String | `30s` | Above which a topic creation operation will be cancelled. |
|
||||||
| `wal.create_topic_timeout` | String | `30s` | The timeout for creating a Kafka topic.<br/>**It's only used when the provider is `kafka`**. |
|
|
||||||
| `event_recorder` | -- | -- | Configuration options for the event recorder. |
|
|
||||||
| `event_recorder.ttl` | String | `90d` | TTL for the events table that will be used to store the events. Default is `90d`. |
|
|
||||||
| `stats_persistence` | -- | -- | Configuration options for the stats persistence. |
|
|
||||||
| `stats_persistence.ttl` | String | `0s` | TTL for the stats table that will be used to store the stats.<br/>Set to `0s` to disable stats persistence.<br/>Default is `0s`.<br/>If you want to enable stats persistence, set the TTL to a value greater than 0.<br/>It is recommended to set a small value, e.g., `3h`. |
|
|
||||||
| `stats_persistence.interval` | String | `10m` | The interval to persist the stats. Default is `10m`.<br/>The minimum value is `10m`, if the value is less than `10m`, it will be overridden to `10m`. |
|
|
||||||
| `logging` | -- | -- | The logging options. |
|
| `logging` | -- | -- | The logging options. |
|
||||||
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
||||||
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
||||||
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
||||||
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
|
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
|
||||||
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
||||||
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
||||||
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
||||||
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
||||||
| `logging.otlp_headers` | -- | -- | Additional OTLP headers, only valid when using OTLP http |
|
| `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
||||||
| `logging.tracing_sample_ratio` | -- | Unset | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
|
||||||
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
||||||
|
| `export_metrics` | -- | -- | The metasrv can export its metrics and send to Prometheus compatible service (e.g. `greptimedb` itself) from remote-write API.<br/>This is only used for `greptimedb` to export its own metrics internally. It's different from prometheus scrape. |
|
||||||
|
| `export_metrics.enable` | Bool | `false` | whether enable export metrics. |
|
||||||
|
| `export_metrics.write_interval` | String | `30s` | The interval of export metrics. |
|
||||||
|
| `export_metrics.remote_write` | -- | -- | -- |
|
||||||
|
| `export_metrics.remote_write.url` | String | `""` | The prometheus remote write endpoint that the metrics send to. The url example can be: `http://127.0.0.1:4000/v1/prometheus/write?db=greptime_metrics`. |
|
||||||
|
| `export_metrics.remote_write.headers` | InlineTable | -- | HTTP headers of Prometheus remote-write carry. |
|
||||||
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
||||||
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
||||||
| `memory` | -- | -- | The memory options. |
|
|
||||||
| `memory.enable_heap_profiling` | Bool | `true` | Whether to enable heap profiling activation during startup.<br/>When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable<br/>is set to "prof:true,prof_active:false". The official image adds this env variable.<br/>Default is true. |
|
|
||||||
|
|
||||||
|
|
||||||
### Datanode
|
### Datanode
|
||||||
@@ -426,11 +395,10 @@
|
|||||||
| Key | Type | Default | Descriptions |
|
| Key | Type | Default | Descriptions |
|
||||||
| --- | -----| ------- | ----------- |
|
| --- | -----| ------- | ----------- |
|
||||||
| `node_id` | Integer | Unset | The datanode identifier and should be unique in the cluster. |
|
| `node_id` | Integer | Unset | The datanode identifier and should be unique in the cluster. |
|
||||||
| `default_column_prefix` | String | Unset | The default column prefix for auto-created time index and value columns. |
|
|
||||||
| `require_lease_before_startup` | Bool | `false` | Start services after regions have obtained leases.<br/>It will block the datanode start if it can't receive leases in the heartbeat from metasrv. |
|
| `require_lease_before_startup` | Bool | `false` | Start services after regions have obtained leases.<br/>It will block the datanode start if it can't receive leases in the heartbeat from metasrv. |
|
||||||
| `init_regions_in_background` | Bool | `false` | Initialize all regions in the background during the startup.<br/>By default, it provides services after all regions have been initialized. |
|
| `init_regions_in_background` | Bool | `false` | Initialize all regions in the background during the startup.<br/>By default, it provides services after all regions have been initialized. |
|
||||||
| `init_regions_parallelism` | Integer | `16` | Parallelism of initializing regions. |
|
| `init_regions_parallelism` | Integer | `16` | Parallelism of initializing regions. |
|
||||||
| `max_concurrent_queries` | Integer | `0` | The maximum current queries allowed to be executed. Zero means unlimited.<br/>NOTE: This setting affects scan_memory_limit's privileged tier allocation.<br/>When set, 70% of queries get privileged memory access (full scan_memory_limit).<br/>The remaining 30% get standard tier access (70% of scan_memory_limit). |
|
| `max_concurrent_queries` | Integer | `0` | The maximum current queries allowed to be executed. Zero means unlimited. |
|
||||||
| `enable_telemetry` | Bool | `true` | Enable telemetry to collect anonymous usage data. Enabled by default. |
|
| `enable_telemetry` | Bool | `true` | Enable telemetry to collect anonymous usage data. Enabled by default. |
|
||||||
| `http` | -- | -- | The HTTP server options. |
|
| `http` | -- | -- | The HTTP server options. |
|
||||||
| `http.addr` | String | `127.0.0.1:4000` | The address to bind the HTTP server. |
|
| `http.addr` | String | `127.0.0.1:4000` | The address to bind the HTTP server. |
|
||||||
@@ -465,11 +433,11 @@
|
|||||||
| `meta_client.metadata_cache_ttl` | String | `10m` | TTL of the metadata cache. |
|
| `meta_client.metadata_cache_ttl` | String | `10m` | TTL of the metadata cache. |
|
||||||
| `meta_client.metadata_cache_tti` | String | `5m` | -- |
|
| `meta_client.metadata_cache_tti` | String | `5m` | -- |
|
||||||
| `wal` | -- | -- | The WAL options. |
|
| `wal` | -- | -- | The WAL options. |
|
||||||
| `wal.provider` | String | `raft_engine` | The provider of the WAL.<br/>- `raft_engine`: the wal is stored in the local file system by raft-engine.<br/>- `kafka`: it's remote wal that data is stored in Kafka.<br/>- `noop`: it's a no-op WAL provider that does not store any WAL data.<br/>**Notes: any unflushed data will be lost when the datanode is shutdown.** |
|
| `wal.provider` | String | `raft_engine` | The provider of the WAL.<br/>- `raft_engine`: the wal is stored in the local file system by raft-engine.<br/>- `kafka`: it's remote wal that data is stored in Kafka. |
|
||||||
| `wal.dir` | String | Unset | The directory to store the WAL files.<br/>**It's only used when the provider is `raft_engine`**. |
|
| `wal.dir` | String | Unset | The directory to store the WAL files.<br/>**It's only used when the provider is `raft_engine`**. |
|
||||||
| `wal.file_size` | String | `128MB` | The size of the WAL segment file.<br/>**It's only used when the provider is `raft_engine`**. |
|
| `wal.file_size` | String | `128MB` | The size of the WAL segment file.<br/>**It's only used when the provider is `raft_engine`**. |
|
||||||
| `wal.purge_threshold` | String | `1GB` | The threshold of the WAL size to trigger a purge.<br/>**It's only used when the provider is `raft_engine`**. |
|
| `wal.purge_threshold` | String | `1GB` | The threshold of the WAL size to trigger a flush.<br/>**It's only used when the provider is `raft_engine`**. |
|
||||||
| `wal.purge_interval` | String | `1m` | The interval to trigger a purge.<br/>**It's only used when the provider is `raft_engine`**. |
|
| `wal.purge_interval` | String | `1m` | The interval to trigger a flush.<br/>**It's only used when the provider is `raft_engine`**. |
|
||||||
| `wal.read_batch_size` | Integer | `128` | The read batch size.<br/>**It's only used when the provider is `raft_engine`**. |
|
| `wal.read_batch_size` | Integer | `128` | The read batch size.<br/>**It's only used when the provider is `raft_engine`**. |
|
||||||
| `wal.sync_write` | Bool | `false` | Whether to use sync write.<br/>**It's only used when the provider is `raft_engine`**. |
|
| `wal.sync_write` | Bool | `false` | Whether to use sync write.<br/>**It's only used when the provider is `raft_engine`**. |
|
||||||
| `wal.enable_log_recycle` | Bool | `true` | Whether to reuse logically truncated log files.<br/>**It's only used when the provider is `raft_engine`**. |
|
| `wal.enable_log_recycle` | Bool | `true` | Whether to reuse logically truncated log files.<br/>**It's only used when the provider is `raft_engine`**. |
|
||||||
@@ -484,12 +452,10 @@
|
|||||||
| `wal.overwrite_entry_start_id` | Bool | `false` | Ignore missing entries during read WAL.<br/>**It's only used when the provider is `kafka`**.<br/><br/>This option ensures that when Kafka messages are deleted, the system<br/>can still successfully replay memtable data without throwing an<br/>out-of-range error.<br/>However, enabling this option might lead to unexpected data loss,<br/>as the system will skip over missing entries instead of treating<br/>them as critical errors. |
|
| `wal.overwrite_entry_start_id` | Bool | `false` | Ignore missing entries during read WAL.<br/>**It's only used when the provider is `kafka`**.<br/><br/>This option ensures that when Kafka messages are deleted, the system<br/>can still successfully replay memtable data without throwing an<br/>out-of-range error.<br/>However, enabling this option might lead to unexpected data loss,<br/>as the system will skip over missing entries instead of treating<br/>them as critical errors. |
|
||||||
| `query` | -- | -- | The query engine options. |
|
| `query` | -- | -- | The query engine options. |
|
||||||
| `query.parallelism` | Integer | `0` | Parallelism of the query engine.<br/>Default to 0, which means the number of CPU cores. |
|
| `query.parallelism` | Integer | `0` | Parallelism of the query engine.<br/>Default to 0, which means the number of CPU cores. |
|
||||||
| `query.memory_pool_size` | String | `50%` | Memory pool size for query execution operators (aggregation, sorting, join).<br/>Supports absolute size (e.g., "2GB", "4GB") or percentage of system memory (e.g., "20%").<br/>Setting it to 0 disables the limit (unbounded, default behavior).<br/>When this limit is reached, queries will fail with ResourceExhausted error.<br/>NOTE: This does NOT limit memory used by table scans. |
|
|
||||||
| `storage` | -- | -- | The data storage options. |
|
| `storage` | -- | -- | The data storage options. |
|
||||||
| `storage.data_home` | String | `./greptimedb_data` | The working home directory. |
|
| `storage.data_home` | String | `./greptimedb_data` | The working home directory. |
|
||||||
| `storage.type` | String | `File` | The storage type used to store the data.<br/>- `File`: the data is stored in the local file system.<br/>- `S3`: the data is stored in the S3 object storage.<br/>- `Gcs`: the data is stored in the Google Cloud Storage.<br/>- `Azblob`: the data is stored in the Azure Blob Storage.<br/>- `Oss`: the data is stored in the Aliyun OSS. |
|
| `storage.type` | String | `File` | The storage type used to store the data.<br/>- `File`: the data is stored in the local file system.<br/>- `S3`: the data is stored in the S3 object storage.<br/>- `Gcs`: the data is stored in the Google Cloud Storage.<br/>- `Azblob`: the data is stored in the Azure Blob Storage.<br/>- `Oss`: the data is stored in the Aliyun OSS. |
|
||||||
| `storage.cache_path` | String | Unset | Read cache configuration for object storage such as 'S3' etc, it's configured by default when using object storage. It is recommended to configure it when using object storage for better performance.<br/>A local file directory, defaults to `{data_home}`. An empty string means disabling. |
|
| `storage.cache_path` | String | Unset | Read cache configuration for object storage such as 'S3' etc, it's configured by default when using object storage. It is recommended to configure it when using object storage for better performance.<br/>A local file directory, defaults to `{data_home}`. An empty string means disabling. |
|
||||||
| `storage.enable_read_cache` | Bool | `true` | Whether to enable read cache. If not set, the read cache will be enabled by default when using object storage. |
|
|
||||||
| `storage.cache_capacity` | String | Unset | The local file cache capacity in bytes. If your disk space is sufficient, it is recommended to set it larger. |
|
| `storage.cache_capacity` | String | Unset | The local file cache capacity in bytes. If your disk space is sufficient, it is recommended to set it larger. |
|
||||||
| `storage.bucket` | String | Unset | The S3 bucket name.<br/>**It's only used when the storage type is `S3`, `Oss` and `Gcs`**. |
|
| `storage.bucket` | String | Unset | The S3 bucket name.<br/>**It's only used when the storage type is `S3`, `Oss` and `Gcs`**. |
|
||||||
| `storage.root` | String | Unset | The S3 data will be stored in the specified prefix, for example, `s3://${bucket}/${root}`.<br/>**It's only used when the storage type is `S3`, `Oss` and `Azblob`**. |
|
| `storage.root` | String | Unset | The S3 data will be stored in the specified prefix, for example, `s3://${bucket}/${root}`.<br/>**It's only used when the storage type is `S3`, `Oss` and `Azblob`**. |
|
||||||
@@ -517,8 +483,6 @@
|
|||||||
| `region_engine.mito.worker_channel_size` | Integer | `128` | Request channel size of each worker. |
|
| `region_engine.mito.worker_channel_size` | Integer | `128` | Request channel size of each worker. |
|
||||||
| `region_engine.mito.worker_request_batch_size` | Integer | `64` | Max batch size for a worker to handle requests. |
|
| `region_engine.mito.worker_request_batch_size` | Integer | `64` | Max batch size for a worker to handle requests. |
|
||||||
| `region_engine.mito.manifest_checkpoint_distance` | Integer | `10` | Number of meta action updated to trigger a new checkpoint for the manifest. |
|
| `region_engine.mito.manifest_checkpoint_distance` | Integer | `10` | Number of meta action updated to trigger a new checkpoint for the manifest. |
|
||||||
| `region_engine.mito.experimental_manifest_keep_removed_file_count` | Integer | `256` | Number of removed files to keep in manifest's `removed_files` field before also<br/>remove them from `removed_files`. Mostly for debugging purpose.<br/>If set to 0, it will only use `keep_removed_file_ttl` to decide when to remove files<br/>from `removed_files` field. |
|
|
||||||
| `region_engine.mito.experimental_manifest_keep_removed_file_ttl` | String | `1h` | How long to keep removed files in the `removed_files` field of manifest<br/>after they are removed from manifest.<br/>files will only be removed from `removed_files` field<br/>if both `keep_removed_file_count` and `keep_removed_file_ttl` is reached. |
|
|
||||||
| `region_engine.mito.compress_manifest` | Bool | `false` | Whether to compress manifest and checkpoint file by gzip (default false). |
|
| `region_engine.mito.compress_manifest` | Bool | `false` | Whether to compress manifest and checkpoint file by gzip (default false). |
|
||||||
| `region_engine.mito.max_background_flushes` | Integer | Auto | Max number of running background flush jobs (default: 1/2 of cpu cores). |
|
| `region_engine.mito.max_background_flushes` | Integer | Auto | Max number of running background flush jobs (default: 1/2 of cpu cores). |
|
||||||
| `region_engine.mito.max_background_compactions` | Integer | Auto | Max number of running background compaction jobs (default: 1/4 of cpu cores). |
|
| `region_engine.mito.max_background_compactions` | Integer | Auto | Max number of running background compaction jobs (default: 1/4 of cpu cores). |
|
||||||
@@ -534,15 +498,10 @@
|
|||||||
| `region_engine.mito.write_cache_path` | String | `""` | File system path for write cache, defaults to `{data_home}`. |
|
| `region_engine.mito.write_cache_path` | String | `""` | File system path for write cache, defaults to `{data_home}`. |
|
||||||
| `region_engine.mito.write_cache_size` | String | `5GiB` | Capacity for write cache. If your disk space is sufficient, it is recommended to set it larger. |
|
| `region_engine.mito.write_cache_size` | String | `5GiB` | Capacity for write cache. If your disk space is sufficient, it is recommended to set it larger. |
|
||||||
| `region_engine.mito.write_cache_ttl` | String | Unset | TTL for write cache. |
|
| `region_engine.mito.write_cache_ttl` | String | Unset | TTL for write cache. |
|
||||||
| `region_engine.mito.preload_index_cache` | Bool | `true` | Preload index (puffin) files into cache on region open (default: true).<br/>When enabled, index files are loaded into the write cache during region initialization,<br/>which can improve query performance at the cost of longer startup times. |
|
|
||||||
| `region_engine.mito.index_cache_percent` | Integer | `20` | Percentage of write cache capacity allocated for index (puffin) files (default: 20).<br/>The remaining capacity is used for data (parquet) files.<br/>Must be between 0 and 100 (exclusive). For example, with a 5GiB write cache and 20% allocation,<br/>1GiB is reserved for index files and 4GiB for data files. |
|
|
||||||
| `region_engine.mito.sst_write_buffer_size` | String | `8MB` | Buffer size for SST writing. |
|
| `region_engine.mito.sst_write_buffer_size` | String | `8MB` | Buffer size for SST writing. |
|
||||||
| `region_engine.mito.parallel_scan_channel_size` | Integer | `32` | Capacity of the channel to send data from parallel scan tasks to the main task. |
|
| `region_engine.mito.parallel_scan_channel_size` | Integer | `32` | Capacity of the channel to send data from parallel scan tasks to the main task. |
|
||||||
| `region_engine.mito.max_concurrent_scan_files` | Integer | `384` | Maximum number of SST files to scan concurrently. |
|
|
||||||
| `region_engine.mito.allow_stale_entries` | Bool | `false` | Whether to allow stale WAL entries read during replay. |
|
| `region_engine.mito.allow_stale_entries` | Bool | `false` | Whether to allow stale WAL entries read during replay. |
|
||||||
| `region_engine.mito.scan_memory_limit` | String | `50%` | Memory limit for table scans across all queries.<br/>Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%").<br/>Setting it to 0 disables the limit.<br/>NOTE: Works with max_concurrent_queries for tiered memory allocation.<br/>- If max_concurrent_queries is set: 70% of queries get full access, 30% get 70% access.<br/>- If max_concurrent_queries is 0 (unlimited): first 20 queries get full access, rest get 70% access. |
|
|
||||||
| `region_engine.mito.min_compaction_interval` | String | `0m` | Minimum time interval between two compactions.<br/>To align with the old behavior, the default value is 0 (no restrictions). |
|
| `region_engine.mito.min_compaction_interval` | String | `0m` | Minimum time interval between two compactions.<br/>To align with the old behavior, the default value is 0 (no restrictions). |
|
||||||
| `region_engine.mito.default_experimental_flat_format` | Bool | `false` | Whether to enable experimental flat format as the default format. |
|
|
||||||
| `region_engine.mito.index` | -- | -- | The options for index in Mito engine. |
|
| `region_engine.mito.index` | -- | -- | The options for index in Mito engine. |
|
||||||
| `region_engine.mito.index.aux_path` | String | `""` | Auxiliary directory path for the index in filesystem, used to store intermediate files for<br/>creating the index and staging files for searching the index, defaults to `{data_home}/index_intermediate`.<br/>The default name for this directory is `index_intermediate` for backward compatibility.<br/><br/>This path contains two subdirectories:<br/>- `__intm`: for storing intermediate files used during creating index.<br/>- `staging`: for storing staging files used during searching index. |
|
| `region_engine.mito.index.aux_path` | String | `""` | Auxiliary directory path for the index in filesystem, used to store intermediate files for<br/>creating the index and staging files for searching the index, defaults to `{data_home}/index_intermediate`.<br/>The default name for this directory is `index_intermediate` for backward compatibility.<br/><br/>This path contains two subdirectories:<br/>- `__intm`: for storing intermediate files used during creating index.<br/>- `staging`: for storing staging files used during searching index. |
|
||||||
| `region_engine.mito.index.staging_size` | String | `2GB` | The max capacity of the staging directory. |
|
| `region_engine.mito.index.staging_size` | String | `2GB` | The max capacity of the staging directory. |
|
||||||
@@ -574,23 +533,26 @@
|
|||||||
| `region_engine.mito.memtable.fork_dictionary_bytes` | String | `1GiB` | Max dictionary bytes.<br/>Only available for `partition_tree` memtable. |
|
| `region_engine.mito.memtable.fork_dictionary_bytes` | String | `1GiB` | Max dictionary bytes.<br/>Only available for `partition_tree` memtable. |
|
||||||
| `region_engine.file` | -- | -- | Enable the file engine. |
|
| `region_engine.file` | -- | -- | Enable the file engine. |
|
||||||
| `region_engine.metric` | -- | -- | Metric engine options. |
|
| `region_engine.metric` | -- | -- | Metric engine options. |
|
||||||
| `region_engine.metric.sparse_primary_key_encoding` | Bool | `true` | Whether to use sparse primary key encoding. |
|
| `region_engine.metric.experimental_sparse_primary_key_encoding` | Bool | `false` | Whether to enable the experimental sparse primary key encoding. |
|
||||||
| `logging` | -- | -- | The logging options. |
|
| `logging` | -- | -- | The logging options. |
|
||||||
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
||||||
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
||||||
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
||||||
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
|
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
|
||||||
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
||||||
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
||||||
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
||||||
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
||||||
| `logging.otlp_headers` | -- | -- | Additional OTLP headers, only valid when using OTLP http |
|
| `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
||||||
| `logging.tracing_sample_ratio` | -- | Unset | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
|
||||||
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
||||||
|
| `export_metrics` | -- | -- | The datanode can export its metrics and send to Prometheus compatible service (e.g. `greptimedb` itself) from remote-write API.<br/>This is only used for `greptimedb` to export its own metrics internally. It's different from prometheus scrape. |
|
||||||
|
| `export_metrics.enable` | Bool | `false` | whether enable export metrics. |
|
||||||
|
| `export_metrics.write_interval` | String | `30s` | The interval of export metrics. |
|
||||||
|
| `export_metrics.remote_write` | -- | -- | -- |
|
||||||
|
| `export_metrics.remote_write.url` | String | `""` | The prometheus remote write endpoint that the metrics send to. The url example can be: `http://127.0.0.1:4000/v1/prometheus/write?db=greptime_metrics`. |
|
||||||
|
| `export_metrics.remote_write.headers` | InlineTable | -- | HTTP headers of Prometheus remote-write carry. |
|
||||||
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
||||||
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
||||||
| `memory` | -- | -- | The memory options. |
|
|
||||||
| `memory.enable_heap_profiling` | Bool | `true` | Whether to enable heap profiling activation during startup.<br/>When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable<br/>is set to "prof:true,prof_active:false". The official image adds this env variable.<br/>Default is true. |
|
|
||||||
|
|
||||||
|
|
||||||
### Flownode
|
### Flownode
|
||||||
@@ -600,22 +562,6 @@
|
|||||||
| `node_id` | Integer | Unset | The flownode identifier and should be unique in the cluster. |
|
| `node_id` | Integer | Unset | The flownode identifier and should be unique in the cluster. |
|
||||||
| `flow` | -- | -- | flow engine options. |
|
| `flow` | -- | -- | flow engine options. |
|
||||||
| `flow.num_workers` | Integer | `0` | The number of flow worker in flownode.<br/>Not setting(or set to 0) this value will use the number of CPU cores divided by 2. |
|
| `flow.num_workers` | Integer | `0` | The number of flow worker in flownode.<br/>Not setting(or set to 0) this value will use the number of CPU cores divided by 2. |
|
||||||
| `flow.batching_mode` | -- | -- | -- |
|
|
||||||
| `flow.batching_mode.query_timeout` | String | `600s` | The default batching engine query timeout is 10 minutes. |
|
|
||||||
| `flow.batching_mode.slow_query_threshold` | String | `60s` | will output a warn log for any query that runs for more that this threshold |
|
|
||||||
| `flow.batching_mode.experimental_min_refresh_duration` | String | `5s` | The minimum duration between two queries execution by batching mode task |
|
|
||||||
| `flow.batching_mode.grpc_conn_timeout` | String | `5s` | The gRPC connection timeout |
|
|
||||||
| `flow.batching_mode.experimental_grpc_max_retries` | Integer | `3` | The gRPC max retry number |
|
|
||||||
| `flow.batching_mode.experimental_frontend_scan_timeout` | String | `30s` | Flow wait for available frontend timeout,<br/>if failed to find available frontend after frontend_scan_timeout elapsed, return error<br/>which prevent flownode from starting |
|
|
||||||
| `flow.batching_mode.experimental_frontend_activity_timeout` | String | `60s` | Frontend activity timeout<br/>if frontend is down(not sending heartbeat) for more than frontend_activity_timeout,<br/>it will be removed from the list that flownode use to connect |
|
|
||||||
| `flow.batching_mode.experimental_max_filter_num_per_query` | Integer | `20` | Maximum number of filters allowed in a single query |
|
|
||||||
| `flow.batching_mode.experimental_time_window_merge_threshold` | Integer | `3` | Time window merge distance |
|
|
||||||
| `flow.batching_mode.read_preference` | String | `Leader` | Read preference of the Frontend client. |
|
|
||||||
| `flow.batching_mode.frontend_tls` | -- | -- | -- |
|
|
||||||
| `flow.batching_mode.frontend_tls.enabled` | Bool | `false` | Whether to enable TLS for client. |
|
|
||||||
| `flow.batching_mode.frontend_tls.server_ca_cert_path` | String | Unset | Server Certificate file path. |
|
|
||||||
| `flow.batching_mode.frontend_tls.client_cert_path` | String | Unset | Client Certificate file path. |
|
|
||||||
| `flow.batching_mode.frontend_tls.client_key_path` | String | Unset | Client Private key file path. |
|
|
||||||
| `grpc` | -- | -- | The gRPC server options. |
|
| `grpc` | -- | -- | The gRPC server options. |
|
||||||
| `grpc.bind_addr` | String | `127.0.0.1:6800` | The address to bind the gRPC server. |
|
| `grpc.bind_addr` | String | `127.0.0.1:6800` | The address to bind the gRPC server. |
|
||||||
| `grpc.server_addr` | String | `127.0.0.1:6800` | The address advertised to the metasrv,<br/>and used for connections from outside the host |
|
| `grpc.server_addr` | String | `127.0.0.1:6800` | The address advertised to the metasrv,<br/>and used for connections from outside the host |
|
||||||
@@ -643,18 +589,12 @@
|
|||||||
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
| `logging.dir` | String | `./greptimedb_data/logs` | The directory to store the log files. If set to empty, logs will not be written to files. |
|
||||||
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
| `logging.level` | String | Unset | The log level. Can be `info`/`debug`/`warn`/`error`. |
|
||||||
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
| `logging.enable_otlp_tracing` | Bool | `false` | Enable OTLP tracing. |
|
||||||
| `logging.otlp_endpoint` | String | `http://localhost:4318/v1/traces` | The OTLP tracing endpoint. |
|
| `logging.otlp_endpoint` | String | `http://localhost:4318` | The OTLP tracing endpoint. |
|
||||||
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
| `logging.append_stdout` | Bool | `true` | Whether to append logs to stdout. |
|
||||||
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
| `logging.log_format` | String | `text` | The log format. Can be `text`/`json`. |
|
||||||
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
| `logging.max_log_files` | Integer | `720` | The maximum amount of log files. |
|
||||||
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
| `logging.otlp_export_protocol` | String | `http` | The OTLP tracing export protocol. Can be `grpc`/`http`. |
|
||||||
| `logging.otlp_headers` | -- | -- | Additional OTLP headers, only valid when using OTLP http |
|
| `logging.tracing_sample_ratio` | -- | -- | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
||||||
| `logging.tracing_sample_ratio` | -- | Unset | The percentage of tracing will be sampled and exported.<br/>Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.<br/>ratio > 1 are treated as 1. Fractions < 0 are treated as 0 |
|
|
||||||
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
| `logging.tracing_sample_ratio.default_ratio` | Float | `1.0` | -- |
|
||||||
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
| `tracing` | -- | -- | The tracing options. Only effect when compiled with `tokio-console` feature. |
|
||||||
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
| `tracing.tokio_console_addr` | String | Unset | The tokio console address. |
|
||||||
| `query` | -- | -- | -- |
|
|
||||||
| `query.parallelism` | Integer | `1` | Parallelism of the query engine for query sent by flownode.<br/>Default to 1, so it won't use too much cpu or memory |
|
|
||||||
| `query.memory_pool_size` | String | `50%` | Memory pool size for query execution operators (aggregation, sorting, join).<br/>Supports absolute size (e.g., "1GB", "2GB") or percentage of system memory (e.g., "20%").<br/>Setting it to 0 disables the limit (unbounded, default behavior).<br/>When this limit is reached, queries will fail with ResourceExhausted error.<br/>NOTE: This does NOT limit memory used by table scans. |
|
|
||||||
| `memory` | -- | -- | The memory options. |
|
|
||||||
| `memory.enable_heap_profiling` | Bool | `true` | Whether to enable heap profiling activation during startup.<br/>When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable<br/>is set to "prof:true,prof_active:false". The official image adds this env variable.<br/>Default is true. |
|
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
node_id = 42
|
node_id = 42
|
||||||
|
|
||||||
## The default column prefix for auto-created time index and value columns.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
default_column_prefix = "greptime"
|
|
||||||
|
|
||||||
## Start services after regions have obtained leases.
|
## Start services after regions have obtained leases.
|
||||||
## It will block the datanode start if it can't receive leases in the heartbeat from metasrv.
|
## It will block the datanode start if it can't receive leases in the heartbeat from metasrv.
|
||||||
require_lease_before_startup = false
|
require_lease_before_startup = false
|
||||||
@@ -18,9 +14,6 @@ init_regions_in_background = false
|
|||||||
init_regions_parallelism = 16
|
init_regions_parallelism = 16
|
||||||
|
|
||||||
## The maximum current queries allowed to be executed. Zero means unlimited.
|
## The maximum current queries allowed to be executed. Zero means unlimited.
|
||||||
## NOTE: This setting affects scan_memory_limit's privileged tier allocation.
|
|
||||||
## When set, 70% of queries get privileged memory access (full scan_memory_limit).
|
|
||||||
## The remaining 30% get standard tier access (70% of scan_memory_limit).
|
|
||||||
max_concurrent_queries = 0
|
max_concurrent_queries = 0
|
||||||
|
|
||||||
## Enable telemetry to collect anonymous usage data. Enabled by default.
|
## Enable telemetry to collect anonymous usage data. Enabled by default.
|
||||||
@@ -125,7 +118,6 @@ metadata_cache_tti = "5m"
|
|||||||
## The provider of the WAL.
|
## The provider of the WAL.
|
||||||
## - `raft_engine`: the wal is stored in the local file system by raft-engine.
|
## - `raft_engine`: the wal is stored in the local file system by raft-engine.
|
||||||
## - `kafka`: it's remote wal that data is stored in Kafka.
|
## - `kafka`: it's remote wal that data is stored in Kafka.
|
||||||
## - `noop`: it's a no-op WAL provider that does not store any WAL data.<br/>**Notes: any unflushed data will be lost when the datanode is shutdown.**
|
|
||||||
provider = "raft_engine"
|
provider = "raft_engine"
|
||||||
|
|
||||||
## The directory to store the WAL files.
|
## The directory to store the WAL files.
|
||||||
@@ -137,11 +129,11 @@ dir = "./greptimedb_data/wal"
|
|||||||
## **It's only used when the provider is `raft_engine`**.
|
## **It's only used when the provider is `raft_engine`**.
|
||||||
file_size = "128MB"
|
file_size = "128MB"
|
||||||
|
|
||||||
## The threshold of the WAL size to trigger a purge.
|
## The threshold of the WAL size to trigger a flush.
|
||||||
## **It's only used when the provider is `raft_engine`**.
|
## **It's only used when the provider is `raft_engine`**.
|
||||||
purge_threshold = "1GB"
|
purge_threshold = "1GB"
|
||||||
|
|
||||||
## The interval to trigger a purge.
|
## The interval to trigger a flush.
|
||||||
## **It's only used when the provider is `raft_engine`**.
|
## **It's only used when the provider is `raft_engine`**.
|
||||||
purge_interval = "1m"
|
purge_interval = "1m"
|
||||||
|
|
||||||
@@ -264,13 +256,6 @@ overwrite_entry_start_id = false
|
|||||||
## Default to 0, which means the number of CPU cores.
|
## Default to 0, which means the number of CPU cores.
|
||||||
parallelism = 0
|
parallelism = 0
|
||||||
|
|
||||||
## Memory pool size for query execution operators (aggregation, sorting, join).
|
|
||||||
## Supports absolute size (e.g., "2GB", "4GB") or percentage of system memory (e.g., "20%").
|
|
||||||
## Setting it to 0 disables the limit (unbounded, default behavior).
|
|
||||||
## When this limit is reached, queries will fail with ResourceExhausted error.
|
|
||||||
## NOTE: This does NOT limit memory used by table scans.
|
|
||||||
memory_pool_size = "50%"
|
|
||||||
|
|
||||||
## The data storage options.
|
## The data storage options.
|
||||||
[storage]
|
[storage]
|
||||||
## The working home directory.
|
## The working home directory.
|
||||||
@@ -289,9 +274,6 @@ type = "File"
|
|||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
#+ cache_path = ""
|
#+ cache_path = ""
|
||||||
|
|
||||||
## Whether to enable read cache. If not set, the read cache will be enabled by default when using object storage.
|
|
||||||
#+ enable_read_cache = true
|
|
||||||
|
|
||||||
## The local file cache capacity in bytes. If your disk space is sufficient, it is recommended to set it larger.
|
## The local file cache capacity in bytes. If your disk space is sufficient, it is recommended to set it larger.
|
||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
cache_capacity = "5GiB"
|
cache_capacity = "5GiB"
|
||||||
@@ -427,19 +409,6 @@ worker_request_batch_size = 64
|
|||||||
## Number of meta action updated to trigger a new checkpoint for the manifest.
|
## Number of meta action updated to trigger a new checkpoint for the manifest.
|
||||||
manifest_checkpoint_distance = 10
|
manifest_checkpoint_distance = 10
|
||||||
|
|
||||||
|
|
||||||
## Number of removed files to keep in manifest's `removed_files` field before also
|
|
||||||
## remove them from `removed_files`. Mostly for debugging purpose.
|
|
||||||
## If set to 0, it will only use `keep_removed_file_ttl` to decide when to remove files
|
|
||||||
## from `removed_files` field.
|
|
||||||
experimental_manifest_keep_removed_file_count = 256
|
|
||||||
|
|
||||||
## How long to keep removed files in the `removed_files` field of manifest
|
|
||||||
## after they are removed from manifest.
|
|
||||||
## files will only be removed from `removed_files` field
|
|
||||||
## if both `keep_removed_file_count` and `keep_removed_file_ttl` is reached.
|
|
||||||
experimental_manifest_keep_removed_file_ttl = "1h"
|
|
||||||
|
|
||||||
## Whether to compress manifest and checkpoint file by gzip (default false).
|
## Whether to compress manifest and checkpoint file by gzip (default false).
|
||||||
compress_manifest = false
|
compress_manifest = false
|
||||||
|
|
||||||
@@ -499,44 +468,19 @@ write_cache_size = "5GiB"
|
|||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
write_cache_ttl = "8h"
|
write_cache_ttl = "8h"
|
||||||
|
|
||||||
## Preload index (puffin) files into cache on region open (default: true).
|
|
||||||
## When enabled, index files are loaded into the write cache during region initialization,
|
|
||||||
## which can improve query performance at the cost of longer startup times.
|
|
||||||
preload_index_cache = true
|
|
||||||
|
|
||||||
## Percentage of write cache capacity allocated for index (puffin) files (default: 20).
|
|
||||||
## The remaining capacity is used for data (parquet) files.
|
|
||||||
## Must be between 0 and 100 (exclusive). For example, with a 5GiB write cache and 20% allocation,
|
|
||||||
## 1GiB is reserved for index files and 4GiB for data files.
|
|
||||||
index_cache_percent = 20
|
|
||||||
|
|
||||||
## Buffer size for SST writing.
|
## Buffer size for SST writing.
|
||||||
sst_write_buffer_size = "8MB"
|
sst_write_buffer_size = "8MB"
|
||||||
|
|
||||||
## Capacity of the channel to send data from parallel scan tasks to the main task.
|
## Capacity of the channel to send data from parallel scan tasks to the main task.
|
||||||
parallel_scan_channel_size = 32
|
parallel_scan_channel_size = 32
|
||||||
|
|
||||||
## Maximum number of SST files to scan concurrently.
|
|
||||||
max_concurrent_scan_files = 384
|
|
||||||
|
|
||||||
## Whether to allow stale WAL entries read during replay.
|
## Whether to allow stale WAL entries read during replay.
|
||||||
allow_stale_entries = false
|
allow_stale_entries = false
|
||||||
|
|
||||||
## Memory limit for table scans across all queries.
|
|
||||||
## Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%").
|
|
||||||
## Setting it to 0 disables the limit.
|
|
||||||
## NOTE: Works with max_concurrent_queries for tiered memory allocation.
|
|
||||||
## - If max_concurrent_queries is set: 70% of queries get full access, 30% get 70% access.
|
|
||||||
## - If max_concurrent_queries is 0 (unlimited): first 20 queries get full access, rest get 70% access.
|
|
||||||
scan_memory_limit = "50%"
|
|
||||||
|
|
||||||
## Minimum time interval between two compactions.
|
## Minimum time interval between two compactions.
|
||||||
## To align with the old behavior, the default value is 0 (no restrictions).
|
## To align with the old behavior, the default value is 0 (no restrictions).
|
||||||
min_compaction_interval = "0m"
|
min_compaction_interval = "0m"
|
||||||
|
|
||||||
## Whether to enable experimental flat format as the default format.
|
|
||||||
default_experimental_flat_format = false
|
|
||||||
|
|
||||||
## The options for index in Mito engine.
|
## The options for index in Mito engine.
|
||||||
[region_engine.mito.index]
|
[region_engine.mito.index]
|
||||||
|
|
||||||
@@ -669,8 +613,8 @@ fork_dictionary_bytes = "1GiB"
|
|||||||
[[region_engine]]
|
[[region_engine]]
|
||||||
## Metric engine options.
|
## Metric engine options.
|
||||||
[region_engine.metric]
|
[region_engine.metric]
|
||||||
## Whether to use sparse primary key encoding.
|
## Whether to enable the experimental sparse primary key encoding.
|
||||||
sparse_primary_key_encoding = true
|
experimental_sparse_primary_key_encoding = false
|
||||||
|
|
||||||
## The logging options.
|
## The logging options.
|
||||||
[logging]
|
[logging]
|
||||||
@@ -685,7 +629,7 @@ level = "info"
|
|||||||
enable_otlp_tracing = false
|
enable_otlp_tracing = false
|
||||||
|
|
||||||
## The OTLP tracing endpoint.
|
## The OTLP tracing endpoint.
|
||||||
otlp_endpoint = "http://localhost:4318/v1/traces"
|
otlp_endpoint = "http://localhost:4318"
|
||||||
|
|
||||||
## Whether to append logs to stdout.
|
## Whether to append logs to stdout.
|
||||||
append_stdout = true
|
append_stdout = true
|
||||||
@@ -699,29 +643,29 @@ max_log_files = 720
|
|||||||
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
||||||
otlp_export_protocol = "http"
|
otlp_export_protocol = "http"
|
||||||
|
|
||||||
## Additional OTLP headers, only valid when using OTLP http
|
|
||||||
[logging.otlp_headers]
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Authorization = "Bearer my-token"
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Database = "My database"
|
|
||||||
|
|
||||||
## The percentage of tracing will be sampled and exported.
|
## The percentage of tracing will be sampled and exported.
|
||||||
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
||||||
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
||||||
[logging.tracing_sample_ratio]
|
[logging.tracing_sample_ratio]
|
||||||
default_ratio = 1.0
|
default_ratio = 1.0
|
||||||
|
|
||||||
|
## The datanode can export its metrics and send to Prometheus compatible service (e.g. `greptimedb` itself) from remote-write API.
|
||||||
|
## This is only used for `greptimedb` to export its own metrics internally. It's different from prometheus scrape.
|
||||||
|
[export_metrics]
|
||||||
|
## whether enable export metrics.
|
||||||
|
enable = false
|
||||||
|
## The interval of export metrics.
|
||||||
|
write_interval = "30s"
|
||||||
|
|
||||||
|
[export_metrics.remote_write]
|
||||||
|
## The prometheus remote write endpoint that the metrics send to. The url example can be: `http://127.0.0.1:4000/v1/prometheus/write?db=greptime_metrics`.
|
||||||
|
url = ""
|
||||||
|
|
||||||
|
## HTTP headers of Prometheus remote-write carry.
|
||||||
|
headers = { }
|
||||||
|
|
||||||
## The tracing options. Only effect when compiled with `tokio-console` feature.
|
## The tracing options. Only effect when compiled with `tokio-console` feature.
|
||||||
#+ [tracing]
|
#+ [tracing]
|
||||||
## The tokio console address.
|
## The tokio console address.
|
||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
#+ tokio_console_addr = "127.0.0.1"
|
#+ tokio_console_addr = "127.0.0.1"
|
||||||
|
|
||||||
## The memory options.
|
|
||||||
[memory]
|
|
||||||
## Whether to enable heap profiling activation during startup.
|
|
||||||
## When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable
|
|
||||||
## is set to "prof:true,prof_active:false". The official image adds this env variable.
|
|
||||||
## Default is true.
|
|
||||||
enable_heap_profiling = true
|
|
||||||
|
|||||||
@@ -7,43 +7,6 @@ node_id = 14
|
|||||||
## The number of flow worker in flownode.
|
## The number of flow worker in flownode.
|
||||||
## Not setting(or set to 0) this value will use the number of CPU cores divided by 2.
|
## Not setting(or set to 0) this value will use the number of CPU cores divided by 2.
|
||||||
#+num_workers=0
|
#+num_workers=0
|
||||||
[flow.batching_mode]
|
|
||||||
## The default batching engine query timeout is 10 minutes.
|
|
||||||
#+query_timeout="600s"
|
|
||||||
## will output a warn log for any query that runs for more that this threshold
|
|
||||||
#+slow_query_threshold="60s"
|
|
||||||
## The minimum duration between two queries execution by batching mode task
|
|
||||||
#+experimental_min_refresh_duration="5s"
|
|
||||||
## The gRPC connection timeout
|
|
||||||
#+grpc_conn_timeout="5s"
|
|
||||||
## The gRPC max retry number
|
|
||||||
#+experimental_grpc_max_retries=3
|
|
||||||
## Flow wait for available frontend timeout,
|
|
||||||
## if failed to find available frontend after frontend_scan_timeout elapsed, return error
|
|
||||||
## which prevent flownode from starting
|
|
||||||
#+experimental_frontend_scan_timeout="30s"
|
|
||||||
## Frontend activity timeout
|
|
||||||
## if frontend is down(not sending heartbeat) for more than frontend_activity_timeout,
|
|
||||||
## it will be removed from the list that flownode use to connect
|
|
||||||
#+experimental_frontend_activity_timeout="60s"
|
|
||||||
## Maximum number of filters allowed in a single query
|
|
||||||
#+experimental_max_filter_num_per_query=20
|
|
||||||
## Time window merge distance
|
|
||||||
#+experimental_time_window_merge_threshold=3
|
|
||||||
## Read preference of the Frontend client.
|
|
||||||
#+read_preference="Leader"
|
|
||||||
[flow.batching_mode.frontend_tls]
|
|
||||||
## Whether to enable TLS for client.
|
|
||||||
#+enabled=false
|
|
||||||
## Server Certificate file path.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#+server_ca_cert_path=""
|
|
||||||
## Client Certificate file path.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#+client_cert_path=""
|
|
||||||
## Client Private key file path.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#+client_key_path=""
|
|
||||||
|
|
||||||
## The gRPC server options.
|
## The gRPC server options.
|
||||||
[grpc]
|
[grpc]
|
||||||
@@ -120,7 +83,7 @@ level = "info"
|
|||||||
enable_otlp_tracing = false
|
enable_otlp_tracing = false
|
||||||
|
|
||||||
## The OTLP tracing endpoint.
|
## The OTLP tracing endpoint.
|
||||||
otlp_endpoint = "http://localhost:4318/v1/traces"
|
otlp_endpoint = "http://localhost:4318"
|
||||||
|
|
||||||
## Whether to append logs to stdout.
|
## Whether to append logs to stdout.
|
||||||
append_stdout = true
|
append_stdout = true
|
||||||
@@ -134,13 +97,6 @@ max_log_files = 720
|
|||||||
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
||||||
otlp_export_protocol = "http"
|
otlp_export_protocol = "http"
|
||||||
|
|
||||||
## Additional OTLP headers, only valid when using OTLP http
|
|
||||||
[logging.otlp_headers]
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Authorization = "Bearer my-token"
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Database = "My database"
|
|
||||||
|
|
||||||
## The percentage of tracing will be sampled and exported.
|
## The percentage of tracing will be sampled and exported.
|
||||||
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
||||||
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
||||||
@@ -152,23 +108,3 @@ default_ratio = 1.0
|
|||||||
## The tokio console address.
|
## The tokio console address.
|
||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
#+ tokio_console_addr = "127.0.0.1"
|
#+ tokio_console_addr = "127.0.0.1"
|
||||||
|
|
||||||
[query]
|
|
||||||
## Parallelism of the query engine for query sent by flownode.
|
|
||||||
## Default to 1, so it won't use too much cpu or memory
|
|
||||||
parallelism = 1
|
|
||||||
|
|
||||||
## Memory pool size for query execution operators (aggregation, sorting, join).
|
|
||||||
## Supports absolute size (e.g., "1GB", "2GB") or percentage of system memory (e.g., "20%").
|
|
||||||
## Setting it to 0 disables the limit (unbounded, default behavior).
|
|
||||||
## When this limit is reached, queries will fail with ResourceExhausted error.
|
|
||||||
## NOTE: This does NOT limit memory used by table scans.
|
|
||||||
memory_pool_size = "50%"
|
|
||||||
|
|
||||||
## The memory options.
|
|
||||||
[memory]
|
|
||||||
## Whether to enable heap profiling activation during startup.
|
|
||||||
## When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable
|
|
||||||
## is set to "prof:true,prof_active:false". The official image adds this env variable.
|
|
||||||
## Default is true.
|
|
||||||
enable_heap_profiling = true
|
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
default_timezone = "UTC"
|
default_timezone = "UTC"
|
||||||
|
|
||||||
## The default column prefix for auto-created time index and value columns.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
default_column_prefix = "greptime"
|
|
||||||
|
|
||||||
## The maximum in-flight write bytes.
|
## The maximum in-flight write bytes.
|
||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
#+ max_in_flight_write_bytes = "500MB"
|
#+ max_in_flight_write_bytes = "500MB"
|
||||||
@@ -35,10 +31,6 @@ timeout = "0s"
|
|||||||
## The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.
|
## The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.
|
||||||
## Set to 0 to disable limit.
|
## Set to 0 to disable limit.
|
||||||
body_limit = "64MB"
|
body_limit = "64MB"
|
||||||
## Maximum total memory for all concurrent HTTP request bodies.
|
|
||||||
## Set to 0 to disable the limit. Default: "0" (unlimited)
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#+ max_total_body_memory = "1GB"
|
|
||||||
## HTTP CORS support, it's turned on by default
|
## HTTP CORS support, it's turned on by default
|
||||||
## This allows browser to access http APIs without CORS restrictions
|
## This allows browser to access http APIs without CORS restrictions
|
||||||
enable_cors = true
|
enable_cors = true
|
||||||
@@ -62,10 +54,6 @@ bind_addr = "127.0.0.1:4001"
|
|||||||
server_addr = "127.0.0.1:4001"
|
server_addr = "127.0.0.1:4001"
|
||||||
## The number of server worker threads.
|
## The number of server worker threads.
|
||||||
runtime_size = 8
|
runtime_size = 8
|
||||||
## Maximum total memory for all concurrent gRPC request messages.
|
|
||||||
## Set to 0 to disable the limit. Default: "0" (unlimited)
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#+ max_total_message_memory = "1GB"
|
|
||||||
## Compression mode for frontend side Arrow IPC service. Available options:
|
## Compression mode for frontend side Arrow IPC service. Available options:
|
||||||
## - `none`: disable all compression
|
## - `none`: disable all compression
|
||||||
## - `transport`: only enable gRPC transport compression (zstd)
|
## - `transport`: only enable gRPC transport compression (zstd)
|
||||||
@@ -73,11 +61,6 @@ runtime_size = 8
|
|||||||
## - `all`: enable all compression.
|
## - `all`: enable all compression.
|
||||||
## Default to `none`
|
## Default to `none`
|
||||||
flight_compression = "arrow_ipc"
|
flight_compression = "arrow_ipc"
|
||||||
## The maximum connection age for gRPC connection.
|
|
||||||
## The value can be a human-readable time string. For example: `10m` for ten minutes or `1h` for one hour.
|
|
||||||
## Refer to https://grpc.io/docs/guides/keepalive/ for more details.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#+ max_connection_age = "10m"
|
|
||||||
|
|
||||||
## gRPC server TLS options, see `mysql.tls` section.
|
## gRPC server TLS options, see `mysql.tls` section.
|
||||||
[grpc.tls]
|
[grpc.tls]
|
||||||
@@ -96,42 +79,6 @@ key_path = ""
|
|||||||
## For now, gRPC tls config does not support auto reload.
|
## For now, gRPC tls config does not support auto reload.
|
||||||
watch = false
|
watch = false
|
||||||
|
|
||||||
## The internal gRPC server options. Internal gRPC port for nodes inside cluster to access frontend.
|
|
||||||
[internal_grpc]
|
|
||||||
## The address to bind the gRPC server.
|
|
||||||
bind_addr = "127.0.0.1:4010"
|
|
||||||
## The address advertised to the metasrv, and used for connections from outside the host.
|
|
||||||
## If left empty or unset, the server will automatically use the IP address of the first network interface
|
|
||||||
## on the host, with the same port number as the one specified in `grpc.bind_addr`.
|
|
||||||
server_addr = "127.0.0.1:4010"
|
|
||||||
## The number of server worker threads.
|
|
||||||
runtime_size = 8
|
|
||||||
## Compression mode for frontend side Arrow IPC service. Available options:
|
|
||||||
## - `none`: disable all compression
|
|
||||||
## - `transport`: only enable gRPC transport compression (zstd)
|
|
||||||
## - `arrow_ipc`: only enable Arrow IPC compression (lz4)
|
|
||||||
## - `all`: enable all compression.
|
|
||||||
## Default to `none`
|
|
||||||
flight_compression = "arrow_ipc"
|
|
||||||
|
|
||||||
## internal gRPC server TLS options, see `mysql.tls` section.
|
|
||||||
[internal_grpc.tls]
|
|
||||||
## TLS mode.
|
|
||||||
mode = "disable"
|
|
||||||
|
|
||||||
## Certificate file path.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
cert_path = ""
|
|
||||||
|
|
||||||
## Private key file path.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
key_path = ""
|
|
||||||
|
|
||||||
## Watch for Certificate and key file change and auto reload.
|
|
||||||
## For now, gRPC tls config does not support auto reload.
|
|
||||||
watch = false
|
|
||||||
|
|
||||||
|
|
||||||
## MySQL server options.
|
## MySQL server options.
|
||||||
[mysql]
|
[mysql]
|
||||||
## Whether to enable.
|
## Whether to enable.
|
||||||
@@ -143,8 +90,6 @@ runtime_size = 2
|
|||||||
## Server-side keep-alive time.
|
## Server-side keep-alive time.
|
||||||
## Set to 0 (default) to disable.
|
## Set to 0 (default) to disable.
|
||||||
keep_alive = "0s"
|
keep_alive = "0s"
|
||||||
## Maximum entries in the MySQL prepared statement cache; default is 10,000.
|
|
||||||
prepared_stmt_cache_size = 10000
|
|
||||||
|
|
||||||
# MySQL server TLS options.
|
# MySQL server TLS options.
|
||||||
[mysql.tls]
|
[mysql.tls]
|
||||||
@@ -252,16 +197,6 @@ metadata_cache_tti = "5m"
|
|||||||
## Parallelism of the query engine.
|
## Parallelism of the query engine.
|
||||||
## Default to 0, which means the number of CPU cores.
|
## Default to 0, which means the number of CPU cores.
|
||||||
parallelism = 0
|
parallelism = 0
|
||||||
## Whether to allow query fallback when push down optimize fails.
|
|
||||||
## Default to false, meaning when push down optimize failed, return error msg
|
|
||||||
allow_query_fallback = false
|
|
||||||
|
|
||||||
## Memory pool size for query execution operators (aggregation, sorting, join).
|
|
||||||
## Supports absolute size (e.g., "4GB", "8GB") or percentage of system memory (e.g., "30%").
|
|
||||||
## Setting it to 0 disables the limit (unbounded, default behavior).
|
|
||||||
## When this limit is reached, queries will fail with ResourceExhausted error.
|
|
||||||
## NOTE: This does NOT limit memory used by table scans (only applies to datanodes).
|
|
||||||
memory_pool_size = "50%"
|
|
||||||
|
|
||||||
## Datanode options.
|
## Datanode options.
|
||||||
[datanode]
|
[datanode]
|
||||||
@@ -283,7 +218,7 @@ level = "info"
|
|||||||
enable_otlp_tracing = false
|
enable_otlp_tracing = false
|
||||||
|
|
||||||
## The OTLP tracing endpoint.
|
## The OTLP tracing endpoint.
|
||||||
otlp_endpoint = "http://localhost:4318/v1/traces"
|
otlp_endpoint = "http://localhost:4318"
|
||||||
|
|
||||||
## Whether to append logs to stdout.
|
## Whether to append logs to stdout.
|
||||||
append_stdout = true
|
append_stdout = true
|
||||||
@@ -297,13 +232,6 @@ max_log_files = 720
|
|||||||
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
||||||
otlp_export_protocol = "http"
|
otlp_export_protocol = "http"
|
||||||
|
|
||||||
## Additional OTLP headers, only valid when using OTLP http
|
|
||||||
[logging.otlp_headers]
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Authorization = "Bearer my-token"
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Database = "My database"
|
|
||||||
|
|
||||||
## The percentage of tracing will be sampled and exported.
|
## The percentage of tracing will be sampled and exported.
|
||||||
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
||||||
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
||||||
@@ -326,24 +254,26 @@ threshold = "30s"
|
|||||||
## The sampling ratio of slow query log. The value should be in the range of (0, 1]. For example, `0.1` means 10% of the slow queries will be logged and `1.0` means all slow queries will be logged.
|
## The sampling ratio of slow query log. The value should be in the range of (0, 1]. For example, `0.1` means 10% of the slow queries will be logged and `1.0` means all slow queries will be logged.
|
||||||
sample_ratio = 1.0
|
sample_ratio = 1.0
|
||||||
|
|
||||||
## The TTL of the `slow_queries` system table. Default is `90d` when `record_type` is `system_table`.
|
## The TTL of the `slow_queries` system table. Default is `30d` when `record_type` is `system_table`.
|
||||||
ttl = "90d"
|
ttl = "30d"
|
||||||
|
|
||||||
|
## The frontend can export its metrics and send to Prometheus compatible service (e.g. `greptimedb` itself) from remote-write API.
|
||||||
|
## This is only used for `greptimedb` to export its own metrics internally. It's different from prometheus scrape.
|
||||||
|
[export_metrics]
|
||||||
|
## whether enable export metrics.
|
||||||
|
enable = false
|
||||||
|
## The interval of export metrics.
|
||||||
|
write_interval = "30s"
|
||||||
|
|
||||||
|
[export_metrics.remote_write]
|
||||||
|
## The prometheus remote write endpoint that the metrics send to. The url example can be: `http://127.0.0.1:4000/v1/prometheus/write?db=greptime_metrics`.
|
||||||
|
url = ""
|
||||||
|
|
||||||
|
## HTTP headers of Prometheus remote-write carry.
|
||||||
|
headers = { }
|
||||||
|
|
||||||
## The tracing options. Only effect when compiled with `tokio-console` feature.
|
## The tracing options. Only effect when compiled with `tokio-console` feature.
|
||||||
#+ [tracing]
|
#+ [tracing]
|
||||||
## The tokio console address.
|
## The tokio console address.
|
||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
#+ tokio_console_addr = "127.0.0.1"
|
#+ tokio_console_addr = "127.0.0.1"
|
||||||
|
|
||||||
## The memory options.
|
|
||||||
[memory]
|
|
||||||
## Whether to enable heap profiling activation during startup.
|
|
||||||
## When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable
|
|
||||||
## is set to "prof:true,prof_active:false". The official image adds this env variable.
|
|
||||||
## Default is true.
|
|
||||||
enable_heap_profiling = true
|
|
||||||
|
|
||||||
## Configuration options for the event recorder.
|
|
||||||
[event_recorder]
|
|
||||||
## TTL for the events table that will be used to store the events. Default is `90d`.
|
|
||||||
ttl = "90d"
|
|
||||||
|
|||||||
@@ -1,19 +1,11 @@
|
|||||||
## The working home directory.
|
## The working home directory.
|
||||||
data_home = "./greptimedb_data"
|
data_home = "./greptimedb_data"
|
||||||
|
|
||||||
## Store server address(es). The format depends on the selected backend.
|
## Store server address default to etcd store.
|
||||||
##
|
## For postgres store, the format is:
|
||||||
## For etcd: a list of "host:port" endpoints.
|
## "password=password dbname=postgres user=postgres host=localhost port=5432"
|
||||||
## e.g. ["192.168.1.1:2379", "192.168.1.2:2379"]
|
## For etcd store, the format is:
|
||||||
##
|
## "127.0.0.1:2379"
|
||||||
## For PostgreSQL: a connection string in libpq format or URI.
|
|
||||||
## e.g.
|
|
||||||
## - "host=localhost port=5432 user=postgres password=<PASSWORD> dbname=postgres"
|
|
||||||
## - "postgresql://user:password@localhost:5432/mydb?connect_timeout=10"
|
|
||||||
## The detail see: https://docs.rs/tokio-postgres/latest/tokio_postgres/config/struct.Config.html
|
|
||||||
##
|
|
||||||
## For mysql store, the format is a MySQL connection URL.
|
|
||||||
## e.g. "mysql://user:password@localhost:3306/greptime_meta?ssl-mode=VERIFY_CA&ssl-ca=/path/to/ca.pem"
|
|
||||||
store_addrs = ["127.0.0.1:2379"]
|
store_addrs = ["127.0.0.1:2379"]
|
||||||
|
|
||||||
## If it's not empty, the metasrv will store all data with this key prefix.
|
## If it's not empty, the metasrv will store all data with this key prefix.
|
||||||
@@ -31,14 +23,6 @@ backend = "etcd_store"
|
|||||||
## **Only used when backend is `postgres_store`.**
|
## **Only used when backend is `postgres_store`.**
|
||||||
meta_table_name = "greptime_metakv"
|
meta_table_name = "greptime_metakv"
|
||||||
|
|
||||||
## Optional PostgreSQL schema for metadata table and election table name qualification.
|
|
||||||
## When PostgreSQL public schema is not writable (e.g., PostgreSQL 15+ with restricted public),
|
|
||||||
## set this to a writable schema. GreptimeDB will use `meta_schema_name`.`meta_table_name`.
|
|
||||||
## GreptimeDB will NOT create the schema automatically; please ensure it exists or the user has permission.
|
|
||||||
## **Only used when backend is `postgres_store`.**
|
|
||||||
|
|
||||||
meta_schema_name = "greptime_schema"
|
|
||||||
|
|
||||||
## Advisory lock id in PostgreSQL for election. Effect when using PostgreSQL as kvbackend
|
## Advisory lock id in PostgreSQL for election. Effect when using PostgreSQL as kvbackend
|
||||||
## Only used when backend is `postgres_store`.
|
## Only used when backend is `postgres_store`.
|
||||||
meta_election_lock_id = 1
|
meta_election_lock_id = 1
|
||||||
@@ -59,9 +43,11 @@ use_memory_store = false
|
|||||||
## - Using shared storage (e.g., s3).
|
## - Using shared storage (e.g., s3).
|
||||||
enable_region_failover = false
|
enable_region_failover = false
|
||||||
|
|
||||||
## The delay before starting region failure detection.
|
## Delay before initializing region failure detectors.
|
||||||
## This delay helps prevent Metasrv from triggering unnecessary region failovers before all Datanodes are fully started.
|
## This delay helps prevent premature initialization of region failure detectors in cases where
|
||||||
## Especially useful when the cluster is not deployed with GreptimeDB Operator and maintenance mode is not enabled.
|
## cluster maintenance mode is enabled right after metasrv starts, especially when the cluster
|
||||||
|
## is not deployed via the recommended GreptimeDB Operator. Without this delay, early detector registration
|
||||||
|
## may trigger unnecessary region failovers during datanode startup.
|
||||||
region_failure_detector_initialization_delay = '10m'
|
region_failure_detector_initialization_delay = '10m'
|
||||||
|
|
||||||
## Whether to allow region failover on local WAL.
|
## Whether to allow region failover on local WAL.
|
||||||
@@ -81,34 +67,6 @@ node_max_idle_time = "24hours"
|
|||||||
## The number of threads to execute the runtime for global write operations.
|
## The number of threads to execute the runtime for global write operations.
|
||||||
#+ compact_rt_size = 4
|
#+ compact_rt_size = 4
|
||||||
|
|
||||||
## TLS configuration for kv store backend (applicable for etcd, PostgreSQL, and MySQL backends)
|
|
||||||
## When using etcd, PostgreSQL, or MySQL as metadata store, you can configure TLS here
|
|
||||||
##
|
|
||||||
## Note: if TLS is configured in both this section and the `store_addrs` connection string, the
|
|
||||||
## settings here will override the TLS settings in `store_addrs`.
|
|
||||||
[backend_tls]
|
|
||||||
## TLS mode, refer to https://www.postgresql.org/docs/current/libpq-ssl.html
|
|
||||||
## - "disable" - No TLS
|
|
||||||
## - "prefer" (default) - Try TLS, fallback to plain
|
|
||||||
## - "require" - Require TLS
|
|
||||||
## - "verify_ca" - Require TLS and verify CA
|
|
||||||
## - "verify_full" - Require TLS and verify hostname
|
|
||||||
mode = "prefer"
|
|
||||||
|
|
||||||
## Path to client certificate file (for client authentication)
|
|
||||||
## Like "/path/to/client.crt"
|
|
||||||
cert_path = ""
|
|
||||||
|
|
||||||
## Path to client private key file (for client authentication)
|
|
||||||
## Like "/path/to/client.key"
|
|
||||||
key_path = ""
|
|
||||||
|
|
||||||
## Path to CA certificate file (for server certificate verification)
|
|
||||||
## Required when using custom CAs or self-signed certificates
|
|
||||||
## Leave empty to use system root certificates only
|
|
||||||
## Like "/path/to/ca.crt"
|
|
||||||
ca_cert_path = ""
|
|
||||||
|
|
||||||
## The gRPC server options.
|
## The gRPC server options.
|
||||||
[grpc]
|
[grpc]
|
||||||
## The address to bind the gRPC server.
|
## The address to bind the gRPC server.
|
||||||
@@ -157,18 +115,20 @@ max_metadata_value_size = "1500KiB"
|
|||||||
max_running_procedures = 128
|
max_running_procedures = 128
|
||||||
|
|
||||||
# Failure detectors options.
|
# Failure detectors options.
|
||||||
# GreptimeDB uses the Phi Accrual Failure Detector algorithm to detect datanode failures.
|
|
||||||
[failure_detector]
|
[failure_detector]
|
||||||
## Maximum acceptable φ before the peer is treated as failed.
|
|
||||||
## Lower values react faster but yield more false positives.
|
## The threshold value used by the failure detector to determine failure conditions.
|
||||||
threshold = 8.0
|
threshold = 8.0
|
||||||
## The minimum standard deviation of the heartbeat intervals.
|
|
||||||
## So tiny variations don’t make φ explode. Prevents hypersensitivity when heartbeat intervals barely vary.
|
## The minimum standard deviation of the heartbeat intervals, used to calculate acceptable variations.
|
||||||
min_std_deviation = "100ms"
|
min_std_deviation = "100ms"
|
||||||
## The acceptable pause duration between heartbeats.
|
|
||||||
## Additional extra grace period to the learned mean interval before φ rises, absorbing temporary network hiccups or GC pauses.
|
## The acceptable pause duration between heartbeats, used to determine if a heartbeat interval is acceptable.
|
||||||
acceptable_heartbeat_pause = "10000ms"
|
acceptable_heartbeat_pause = "10000ms"
|
||||||
|
|
||||||
|
## The initial estimate of the heartbeat interval used by the failure detector.
|
||||||
|
first_heartbeat_estimate = "1000ms"
|
||||||
|
|
||||||
## Datanode options.
|
## Datanode options.
|
||||||
[datanode]
|
[datanode]
|
||||||
|
|
||||||
@@ -190,69 +150,50 @@ tcp_nodelay = true
|
|||||||
# - `kafka`: metasrv **have to be** configured with kafka wal config when using kafka wal provider in datanode.
|
# - `kafka`: metasrv **have to be** configured with kafka wal config when using kafka wal provider in datanode.
|
||||||
provider = "raft_engine"
|
provider = "raft_engine"
|
||||||
|
|
||||||
|
# Kafka wal config.
|
||||||
|
|
||||||
## The broker endpoints of the Kafka cluster.
|
## The broker endpoints of the Kafka cluster.
|
||||||
##
|
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
broker_endpoints = ["127.0.0.1:9092"]
|
broker_endpoints = ["127.0.0.1:9092"]
|
||||||
|
|
||||||
## Automatically create topics for WAL.
|
## Automatically create topics for WAL.
|
||||||
## Set to `true` to automatically create topics for WAL.
|
## Set to `true` to automatically create topics for WAL.
|
||||||
## Otherwise, use topics named `topic_name_prefix_[0..num_topics)`
|
## Otherwise, use topics named `topic_name_prefix_[0..num_topics)`
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
auto_create_topics = true
|
auto_create_topics = true
|
||||||
|
|
||||||
## Interval of automatically WAL pruning.
|
## Interval of automatically WAL pruning.
|
||||||
## Set to `0s` to disable automatically WAL pruning which delete unused remote WAL entries periodically.
|
## Set to `0s` to disable automatically WAL pruning which delete unused remote WAL entries periodically.
|
||||||
## **It's only used when the provider is `kafka`**.
|
auto_prune_interval = "0s"
|
||||||
auto_prune_interval = "30m"
|
|
||||||
|
|
||||||
|
## The threshold to trigger a flush operation of a region in automatically WAL pruning.
|
||||||
## Estimated size threshold to trigger a flush when using Kafka remote WAL.
|
## Metasrv will send a flush request to flush the region when:
|
||||||
## Since multiple regions may share a Kafka topic, the estimated size is calculated as:
|
## `trigger_flush_threshold` + `prunable_entry_id` < `max_prunable_entry_id`
|
||||||
## (latest_entry_id - flushed_entry_id) * avg_record_size
|
## where:
|
||||||
## MetaSrv triggers a flush for a region when this estimated size exceeds `flush_trigger_size`.
|
## - `prunable_entry_id` is the maximum entry id that can be pruned of the region.
|
||||||
## - `latest_entry_id`: The latest entry ID in the topic.
|
## - `max_prunable_entry_id` is the maximum prunable entry id among all regions in the same topic.
|
||||||
## - `flushed_entry_id`: The last flushed entry ID for the region.
|
## Set to `0` to disable the flush operation.
|
||||||
## Set to "0" to let the system decide the flush trigger size.
|
trigger_flush_threshold = 0
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
flush_trigger_size = "512MB"
|
|
||||||
|
|
||||||
## Estimated size threshold to trigger a checkpoint when using Kafka remote WAL.
|
|
||||||
## The estimated size is calculated as:
|
|
||||||
## (latest_entry_id - last_checkpoint_entry_id) * avg_record_size
|
|
||||||
## MetaSrv triggers a checkpoint for a region when this estimated size exceeds `checkpoint_trigger_size`.
|
|
||||||
## Set to "0" to let the system decide the checkpoint trigger size.
|
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
checkpoint_trigger_size = "128MB"
|
|
||||||
|
|
||||||
## Concurrent task limit for automatically WAL pruning.
|
## Concurrent task limit for automatically WAL pruning.
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
auto_prune_parallelism = 10
|
auto_prune_parallelism = 10
|
||||||
|
|
||||||
## Number of topics used for remote WAL.
|
## Number of topics.
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
num_topics = 64
|
num_topics = 64
|
||||||
|
|
||||||
## Topic selector type.
|
## Topic selector type.
|
||||||
## Available selector types:
|
## Available selector types:
|
||||||
## - `round_robin` (default)
|
## - `round_robin` (default)
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
selector_type = "round_robin"
|
selector_type = "round_robin"
|
||||||
|
|
||||||
|
|
||||||
## A Kafka topic is constructed by concatenating `topic_name_prefix` and `topic_id`.
|
## A Kafka topic is constructed by concatenating `topic_name_prefix` and `topic_id`.
|
||||||
## Only accepts strings that match the following regular expression pattern:
|
## Only accepts strings that match the following regular expression pattern:
|
||||||
## [a-zA-Z_:-][a-zA-Z0-9_:\-\.@#]*
|
## [a-zA-Z_:-][a-zA-Z0-9_:\-\.@#]*
|
||||||
## i.g., greptimedb_wal_topic_0, greptimedb_wal_topic_1.
|
## i.g., greptimedb_wal_topic_0, greptimedb_wal_topic_1.
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
topic_name_prefix = "greptimedb_wal_topic"
|
topic_name_prefix = "greptimedb_wal_topic"
|
||||||
|
|
||||||
## Expected number of replicas of each partition.
|
## Expected number of replicas of each partition.
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
replication_factor = 1
|
replication_factor = 1
|
||||||
|
|
||||||
## The timeout for creating a Kafka topic.
|
## Above which a topic creation operation will be cancelled.
|
||||||
## **It's only used when the provider is `kafka`**.
|
|
||||||
create_topic_timeout = "30s"
|
create_topic_timeout = "30s"
|
||||||
|
|
||||||
# The Kafka SASL configuration.
|
# The Kafka SASL configuration.
|
||||||
@@ -273,23 +214,6 @@ create_topic_timeout = "30s"
|
|||||||
# client_cert_path = "/path/to/client_cert"
|
# client_cert_path = "/path/to/client_cert"
|
||||||
# client_key_path = "/path/to/key"
|
# client_key_path = "/path/to/key"
|
||||||
|
|
||||||
## Configuration options for the event recorder.
|
|
||||||
[event_recorder]
|
|
||||||
## TTL for the events table that will be used to store the events. Default is `90d`.
|
|
||||||
ttl = "90d"
|
|
||||||
|
|
||||||
## Configuration options for the stats persistence.
|
|
||||||
[stats_persistence]
|
|
||||||
## TTL for the stats table that will be used to store the stats.
|
|
||||||
## Set to `0s` to disable stats persistence.
|
|
||||||
## Default is `0s`.
|
|
||||||
## If you want to enable stats persistence, set the TTL to a value greater than 0.
|
|
||||||
## It is recommended to set a small value, e.g., `3h`.
|
|
||||||
ttl = "0s"
|
|
||||||
## The interval to persist the stats. Default is `10m`.
|
|
||||||
## The minimum value is `10m`, if the value is less than `10m`, it will be overridden to `10m`.
|
|
||||||
interval = "10m"
|
|
||||||
|
|
||||||
## The logging options.
|
## The logging options.
|
||||||
[logging]
|
[logging]
|
||||||
## The directory to store the log files. If set to empty, logs will not be written to files.
|
## The directory to store the log files. If set to empty, logs will not be written to files.
|
||||||
@@ -303,7 +227,7 @@ level = "info"
|
|||||||
enable_otlp_tracing = false
|
enable_otlp_tracing = false
|
||||||
|
|
||||||
## The OTLP tracing endpoint.
|
## The OTLP tracing endpoint.
|
||||||
otlp_endpoint = "http://localhost:4318/v1/traces"
|
otlp_endpoint = "http://localhost:4318"
|
||||||
|
|
||||||
## Whether to append logs to stdout.
|
## Whether to append logs to stdout.
|
||||||
append_stdout = true
|
append_stdout = true
|
||||||
@@ -317,30 +241,29 @@ max_log_files = 720
|
|||||||
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
||||||
otlp_export_protocol = "http"
|
otlp_export_protocol = "http"
|
||||||
|
|
||||||
## Additional OTLP headers, only valid when using OTLP http
|
|
||||||
[logging.otlp_headers]
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Authorization = "Bearer my-token"
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Database = "My database"
|
|
||||||
|
|
||||||
|
|
||||||
## The percentage of tracing will be sampled and exported.
|
## The percentage of tracing will be sampled and exported.
|
||||||
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
||||||
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
||||||
[logging.tracing_sample_ratio]
|
[logging.tracing_sample_ratio]
|
||||||
default_ratio = 1.0
|
default_ratio = 1.0
|
||||||
|
|
||||||
|
## The metasrv can export its metrics and send to Prometheus compatible service (e.g. `greptimedb` itself) from remote-write API.
|
||||||
|
## This is only used for `greptimedb` to export its own metrics internally. It's different from prometheus scrape.
|
||||||
|
[export_metrics]
|
||||||
|
## whether enable export metrics.
|
||||||
|
enable = false
|
||||||
|
## The interval of export metrics.
|
||||||
|
write_interval = "30s"
|
||||||
|
|
||||||
|
[export_metrics.remote_write]
|
||||||
|
## The prometheus remote write endpoint that the metrics send to. The url example can be: `http://127.0.0.1:4000/v1/prometheus/write?db=greptime_metrics`.
|
||||||
|
url = ""
|
||||||
|
|
||||||
|
## HTTP headers of Prometheus remote-write carry.
|
||||||
|
headers = { }
|
||||||
|
|
||||||
## The tracing options. Only effect when compiled with `tokio-console` feature.
|
## The tracing options. Only effect when compiled with `tokio-console` feature.
|
||||||
#+ [tracing]
|
#+ [tracing]
|
||||||
## The tokio console address.
|
## The tokio console address.
|
||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
#+ tokio_console_addr = "127.0.0.1"
|
#+ tokio_console_addr = "127.0.0.1"
|
||||||
|
|
||||||
## The memory options.
|
|
||||||
[memory]
|
|
||||||
## Whether to enable heap profiling activation during startup.
|
|
||||||
## When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable
|
|
||||||
## is set to "prof:true,prof_active:false". The official image adds this env variable.
|
|
||||||
## Default is true.
|
|
||||||
enable_heap_profiling = true
|
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
default_timezone = "UTC"
|
default_timezone = "UTC"
|
||||||
|
|
||||||
## The default column prefix for auto-created time index and value columns.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
default_column_prefix = "greptime"
|
|
||||||
|
|
||||||
## Initialize all regions in the background during the startup.
|
## Initialize all regions in the background during the startup.
|
||||||
## By default, it provides services after all regions have been initialized.
|
## By default, it provides services after all regions have been initialized.
|
||||||
init_regions_in_background = false
|
init_regions_in_background = false
|
||||||
@@ -14,9 +10,6 @@ init_regions_in_background = false
|
|||||||
init_regions_parallelism = 16
|
init_regions_parallelism = 16
|
||||||
|
|
||||||
## The maximum current queries allowed to be executed. Zero means unlimited.
|
## The maximum current queries allowed to be executed. Zero means unlimited.
|
||||||
## NOTE: This setting affects scan_memory_limit's privileged tier allocation.
|
|
||||||
## When set, 70% of queries get privileged memory access (full scan_memory_limit).
|
|
||||||
## The remaining 30% get standard tier access (70% of scan_memory_limit).
|
|
||||||
max_concurrent_queries = 0
|
max_concurrent_queries = 0
|
||||||
|
|
||||||
## Enable telemetry to collect anonymous usage data. Enabled by default.
|
## Enable telemetry to collect anonymous usage data. Enabled by default.
|
||||||
@@ -43,10 +36,6 @@ timeout = "0s"
|
|||||||
## The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.
|
## The following units are supported: `B`, `KB`, `KiB`, `MB`, `MiB`, `GB`, `GiB`, `TB`, `TiB`, `PB`, `PiB`.
|
||||||
## Set to 0 to disable limit.
|
## Set to 0 to disable limit.
|
||||||
body_limit = "64MB"
|
body_limit = "64MB"
|
||||||
## Maximum total memory for all concurrent HTTP request bodies.
|
|
||||||
## Set to 0 to disable the limit. Default: "0" (unlimited)
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#+ max_total_body_memory = "1GB"
|
|
||||||
## HTTP CORS support, it's turned on by default
|
## HTTP CORS support, it's turned on by default
|
||||||
## This allows browser to access http APIs without CORS restrictions
|
## This allows browser to access http APIs without CORS restrictions
|
||||||
enable_cors = true
|
enable_cors = true
|
||||||
@@ -67,15 +56,6 @@ prom_validation_mode = "strict"
|
|||||||
bind_addr = "127.0.0.1:4001"
|
bind_addr = "127.0.0.1:4001"
|
||||||
## The number of server worker threads.
|
## The number of server worker threads.
|
||||||
runtime_size = 8
|
runtime_size = 8
|
||||||
## Maximum total memory for all concurrent gRPC request messages.
|
|
||||||
## Set to 0 to disable the limit. Default: "0" (unlimited)
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#+ max_total_message_memory = "1GB"
|
|
||||||
## The maximum connection age for gRPC connection.
|
|
||||||
## The value can be a human-readable time string. For example: `10m` for ten minutes or `1h` for one hour.
|
|
||||||
## Refer to https://grpc.io/docs/guides/keepalive/ for more details.
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#+ max_connection_age = "10m"
|
|
||||||
|
|
||||||
## gRPC server TLS options, see `mysql.tls` section.
|
## gRPC server TLS options, see `mysql.tls` section.
|
||||||
[grpc.tls]
|
[grpc.tls]
|
||||||
@@ -105,8 +85,7 @@ runtime_size = 2
|
|||||||
## Server-side keep-alive time.
|
## Server-side keep-alive time.
|
||||||
## Set to 0 (default) to disable.
|
## Set to 0 (default) to disable.
|
||||||
keep_alive = "0s"
|
keep_alive = "0s"
|
||||||
## Maximum entries in the MySQL prepared statement cache; default is 10,000.
|
|
||||||
prepared_stmt_cache_size= 10000
|
|
||||||
# MySQL server TLS options.
|
# MySQL server TLS options.
|
||||||
[mysql.tls]
|
[mysql.tls]
|
||||||
|
|
||||||
@@ -368,13 +347,6 @@ max_running_procedures = 128
|
|||||||
## Default to 0, which means the number of CPU cores.
|
## Default to 0, which means the number of CPU cores.
|
||||||
parallelism = 0
|
parallelism = 0
|
||||||
|
|
||||||
## Memory pool size for query execution operators (aggregation, sorting, join).
|
|
||||||
## Supports absolute size (e.g., "2GB", "4GB") or percentage of system memory (e.g., "20%").
|
|
||||||
## Setting it to 0 disables the limit (unbounded, default behavior).
|
|
||||||
## When this limit is reached, queries will fail with ResourceExhausted error.
|
|
||||||
## NOTE: This does NOT limit memory used by table scans.
|
|
||||||
memory_pool_size = "50%"
|
|
||||||
|
|
||||||
## The data storage options.
|
## The data storage options.
|
||||||
[storage]
|
[storage]
|
||||||
## The working home directory.
|
## The working home directory.
|
||||||
@@ -388,9 +360,6 @@ data_home = "./greptimedb_data"
|
|||||||
## - `Oss`: the data is stored in the Aliyun OSS.
|
## - `Oss`: the data is stored in the Aliyun OSS.
|
||||||
type = "File"
|
type = "File"
|
||||||
|
|
||||||
## Whether to enable read cache. If not set, the read cache will be enabled by default when using object storage.
|
|
||||||
#+ enable_read_cache = true
|
|
||||||
|
|
||||||
## Read cache configuration for object storage such as 'S3' etc, it's configured by default when using object storage. It is recommended to configure it when using object storage for better performance.
|
## Read cache configuration for object storage such as 'S3' etc, it's configured by default when using object storage. It is recommended to configure it when using object storage for better performance.
|
||||||
## A local file directory, defaults to `{data_home}`. An empty string means disabling.
|
## A local file directory, defaults to `{data_home}`. An empty string means disabling.
|
||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
@@ -590,44 +559,19 @@ write_cache_size = "5GiB"
|
|||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
write_cache_ttl = "8h"
|
write_cache_ttl = "8h"
|
||||||
|
|
||||||
## Preload index (puffin) files into cache on region open (default: true).
|
|
||||||
## When enabled, index files are loaded into the write cache during region initialization,
|
|
||||||
## which can improve query performance at the cost of longer startup times.
|
|
||||||
preload_index_cache = true
|
|
||||||
|
|
||||||
## Percentage of write cache capacity allocated for index (puffin) files (default: 20).
|
|
||||||
## The remaining capacity is used for data (parquet) files.
|
|
||||||
## Must be between 0 and 100 (exclusive). For example, with a 5GiB write cache and 20% allocation,
|
|
||||||
## 1GiB is reserved for index files and 4GiB for data files.
|
|
||||||
index_cache_percent = 20
|
|
||||||
|
|
||||||
## Buffer size for SST writing.
|
## Buffer size for SST writing.
|
||||||
sst_write_buffer_size = "8MB"
|
sst_write_buffer_size = "8MB"
|
||||||
|
|
||||||
## Capacity of the channel to send data from parallel scan tasks to the main task.
|
## Capacity of the channel to send data from parallel scan tasks to the main task.
|
||||||
parallel_scan_channel_size = 32
|
parallel_scan_channel_size = 32
|
||||||
|
|
||||||
## Maximum number of SST files to scan concurrently.
|
|
||||||
max_concurrent_scan_files = 384
|
|
||||||
|
|
||||||
## Whether to allow stale WAL entries read during replay.
|
## Whether to allow stale WAL entries read during replay.
|
||||||
allow_stale_entries = false
|
allow_stale_entries = false
|
||||||
|
|
||||||
## Memory limit for table scans across all queries.
|
|
||||||
## Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%").
|
|
||||||
## Setting it to 0 disables the limit.
|
|
||||||
## NOTE: Works with max_concurrent_queries for tiered memory allocation.
|
|
||||||
## - If max_concurrent_queries is set: 70% of queries get full access, 30% get 70% access.
|
|
||||||
## - If max_concurrent_queries is 0 (unlimited): first 20 queries get full access, rest get 70% access.
|
|
||||||
scan_memory_limit = "50%"
|
|
||||||
|
|
||||||
## Minimum time interval between two compactions.
|
## Minimum time interval between two compactions.
|
||||||
## To align with the old behavior, the default value is 0 (no restrictions).
|
## To align with the old behavior, the default value is 0 (no restrictions).
|
||||||
min_compaction_interval = "0m"
|
min_compaction_interval = "0m"
|
||||||
|
|
||||||
## Whether to enable experimental flat format as the default format.
|
|
||||||
default_experimental_flat_format = false
|
|
||||||
|
|
||||||
## The options for index in Mito engine.
|
## The options for index in Mito engine.
|
||||||
[region_engine.mito.index]
|
[region_engine.mito.index]
|
||||||
|
|
||||||
@@ -760,8 +704,8 @@ fork_dictionary_bytes = "1GiB"
|
|||||||
[[region_engine]]
|
[[region_engine]]
|
||||||
## Metric engine options.
|
## Metric engine options.
|
||||||
[region_engine.metric]
|
[region_engine.metric]
|
||||||
## Whether to use sparse primary key encoding.
|
## Whether to enable the experimental sparse primary key encoding.
|
||||||
sparse_primary_key_encoding = true
|
experimental_sparse_primary_key_encoding = false
|
||||||
|
|
||||||
## The logging options.
|
## The logging options.
|
||||||
[logging]
|
[logging]
|
||||||
@@ -776,7 +720,7 @@ level = "info"
|
|||||||
enable_otlp_tracing = false
|
enable_otlp_tracing = false
|
||||||
|
|
||||||
## The OTLP tracing endpoint.
|
## The OTLP tracing endpoint.
|
||||||
otlp_endpoint = "http://localhost:4318/v1/traces"
|
otlp_endpoint = "http://localhost:4318"
|
||||||
|
|
||||||
## Whether to append logs to stdout.
|
## Whether to append logs to stdout.
|
||||||
append_stdout = true
|
append_stdout = true
|
||||||
@@ -790,13 +734,6 @@ max_log_files = 720
|
|||||||
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
## The OTLP tracing export protocol. Can be `grpc`/`http`.
|
||||||
otlp_export_protocol = "http"
|
otlp_export_protocol = "http"
|
||||||
|
|
||||||
## Additional OTLP headers, only valid when using OTLP http
|
|
||||||
[logging.otlp_headers]
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Authorization = "Bearer my-token"
|
|
||||||
## @toml2docs:none-default
|
|
||||||
#Database = "My database"
|
|
||||||
|
|
||||||
## The percentage of tracing will be sampled and exported.
|
## The percentage of tracing will be sampled and exported.
|
||||||
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
## Valid range `[0, 1]`, 1 means all traces are sampled, 0 means all traces are not sampled, the default value is 1.
|
||||||
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
## ratio > 1 are treated as 1. Fractions < 0 are treated as 0
|
||||||
@@ -820,16 +757,29 @@ default_ratio = 1.0
|
|||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
#+ sample_ratio = 1.0
|
#+ sample_ratio = 1.0
|
||||||
|
|
||||||
|
## The standalone can export its metrics and send to Prometheus compatible service (e.g. `greptimedb`) from remote-write API.
|
||||||
|
## This is only used for `greptimedb` to export its own metrics internally. It's different from prometheus scrape.
|
||||||
|
[export_metrics]
|
||||||
|
## whether enable export metrics.
|
||||||
|
enable = false
|
||||||
|
## The interval of export metrics.
|
||||||
|
write_interval = "30s"
|
||||||
|
|
||||||
|
## For `standalone` mode, `self_import` is recommended to collect metrics generated by itself
|
||||||
|
## You must create the database before enabling it.
|
||||||
|
[export_metrics.self_import]
|
||||||
|
## @toml2docs:none-default
|
||||||
|
db = "greptime_metrics"
|
||||||
|
|
||||||
|
[export_metrics.remote_write]
|
||||||
|
## The prometheus remote write endpoint that the metrics send to. The url example can be: `http://127.0.0.1:4000/v1/prometheus/write?db=greptime_metrics`.
|
||||||
|
url = ""
|
||||||
|
|
||||||
|
## HTTP headers of Prometheus remote-write carry.
|
||||||
|
headers = { }
|
||||||
|
|
||||||
## The tracing options. Only effect when compiled with `tokio-console` feature.
|
## The tracing options. Only effect when compiled with `tokio-console` feature.
|
||||||
#+ [tracing]
|
#+ [tracing]
|
||||||
## The tokio console address.
|
## The tokio console address.
|
||||||
## @toml2docs:none-default
|
## @toml2docs:none-default
|
||||||
#+ tokio_console_addr = "127.0.0.1"
|
#+ tokio_console_addr = "127.0.0.1"
|
||||||
|
|
||||||
## The memory options.
|
|
||||||
[memory]
|
|
||||||
## Whether to enable heap profiling activation during startup.
|
|
||||||
## When enabled, heap profiling will be activated if the `MALLOC_CONF` environment variable
|
|
||||||
## is set to "prof:true,prof_active:false". The official image adds this env variable.
|
|
||||||
## Default is true.
|
|
||||||
enable_heap_profiling = true
|
|
||||||
|
|||||||
@@ -55,25 +55,12 @@ async function main() {
|
|||||||
await client.rest.issues.addLabels({
|
await client.rest.issues.addLabels({
|
||||||
owner, repo, issue_number: number, labels: [labelDocsRequired],
|
owner, repo, issue_number: number, labels: [labelDocsRequired],
|
||||||
})
|
})
|
||||||
|
|
||||||
// Get available assignees for the docs repo
|
|
||||||
const assigneesResponse = await docsClient.rest.issues.listAssignees({
|
|
||||||
owner: 'GreptimeTeam',
|
|
||||||
repo: 'docs',
|
|
||||||
})
|
|
||||||
const validAssignees = assigneesResponse.data.map(assignee => assignee.login)
|
|
||||||
core.info(`Available assignees: ${validAssignees.join(', ')}`)
|
|
||||||
|
|
||||||
// Check if the actor is a valid assignee, otherwise fallback to fengjiachun
|
|
||||||
const assignee = validAssignees.includes(actor) ? actor : 'fengjiachun'
|
|
||||||
core.info(`Assigning issue to: ${assignee}`)
|
|
||||||
|
|
||||||
await docsClient.rest.issues.create({
|
await docsClient.rest.issues.create({
|
||||||
owner: 'GreptimeTeam',
|
owner: 'GreptimeTeam',
|
||||||
repo: 'docs',
|
repo: 'docs',
|
||||||
title: `Update docs for ${title}`,
|
title: `Update docs for ${title}`,
|
||||||
body: `A document change request is generated from ${html_url}`,
|
body: `A document change request is generated from ${html_url}`,
|
||||||
assignee: assignee,
|
assignee: actor,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
core.info(`Created issue ${res.data}`)
|
core.info(`Created issue ${res.data}`)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
FROM centos:7 AS builder
|
FROM centos:7 as builder
|
||||||
|
|
||||||
ARG CARGO_PROFILE
|
ARG CARGO_PROFILE
|
||||||
ARG FEATURES
|
ARG FEATURES
|
||||||
ARG OUTPUT_DIR
|
ARG OUTPUT_DIR
|
||||||
|
|
||||||
ENV LANG=en_US.utf8
|
ENV LANG en_US.utf8
|
||||||
WORKDIR /greptimedb
|
WORKDIR /greptimedb
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
@@ -22,7 +22,7 @@ RUN unzip protoc-3.15.8-linux-x86_64.zip -d /usr/local/
|
|||||||
# Install Rust
|
# Install Rust
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y
|
||||||
ENV PATH=/usr/local/bin:/root/.cargo/bin/:$PATH
|
ENV PATH /usr/local/bin:/root/.cargo/bin/:$PATH
|
||||||
|
|
||||||
# Build the project in release mode.
|
# Build the project in release mode.
|
||||||
RUN --mount=target=.,rw \
|
RUN --mount=target=.,rw \
|
||||||
@@ -33,7 +33,7 @@ RUN --mount=target=.,rw \
|
|||||||
TARGET_DIR=/out/target
|
TARGET_DIR=/out/target
|
||||||
|
|
||||||
# Export the binary to the clean image.
|
# Export the binary to the clean image.
|
||||||
FROM centos:7 AS base
|
FROM centos:7 as base
|
||||||
|
|
||||||
ARG OUTPUT_DIR
|
ARG OUTPUT_DIR
|
||||||
|
|
||||||
@@ -45,8 +45,6 @@ RUN yum install -y epel-release \
|
|||||||
|
|
||||||
WORKDIR /greptime
|
WORKDIR /greptime
|
||||||
COPY --from=builder /out/target/${OUTPUT_DIR}/greptime /greptime/bin/
|
COPY --from=builder /out/target/${OUTPUT_DIR}/greptime /greptime/bin/
|
||||||
ENV PATH=/greptime/bin/:$PATH
|
ENV PATH /greptime/bin/:$PATH
|
||||||
|
|
||||||
ENV MALLOC_CONF="prof:true,prof_active:false"
|
|
||||||
|
|
||||||
ENTRYPOINT ["greptime"]
|
ENTRYPOINT ["greptime"]
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
FROM ubuntu:22.04 AS builder
|
|
||||||
|
|
||||||
ARG CARGO_PROFILE
|
|
||||||
ARG FEATURES
|
|
||||||
ARG OUTPUT_DIR
|
|
||||||
|
|
||||||
ENV LANG=en_US.utf8
|
|
||||||
WORKDIR /greptimedb
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y software-properties-common
|
|
||||||
|
|
||||||
# Install dependencies.
|
|
||||||
RUN --mount=type=cache,target=/var/cache/apt \
|
|
||||||
apt-get update && apt-get install -y \
|
|
||||||
libssl-dev \
|
|
||||||
protobuf-compiler \
|
|
||||||
curl \
|
|
||||||
git \
|
|
||||||
build-essential \
|
|
||||||
pkg-config
|
|
||||||
|
|
||||||
# Install Rust.
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y
|
|
||||||
ENV PATH=/root/.cargo/bin/:$PATH
|
|
||||||
|
|
||||||
# Build the project in release mode.
|
|
||||||
RUN --mount=target=. \
|
|
||||||
--mount=type=cache,target=/root/.cargo/registry \
|
|
||||||
make build \
|
|
||||||
CARGO_PROFILE=${CARGO_PROFILE} \
|
|
||||||
FEATURES=${FEATURES} \
|
|
||||||
TARGET_DIR=/out/target
|
|
||||||
|
|
||||||
FROM ubuntu:22.04 AS libs
|
|
||||||
|
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
# Copy required library dependencies based on architecture
|
|
||||||
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
|
||||||
cp /lib/x86_64-linux-gnu/libz.so.1.2.11 /lib/x86_64-linux-gnu/libz.so.1; \
|
|
||||||
elif [ "$TARGETARCH" = "arm64" ]; then \
|
|
||||||
cp /lib/aarch64-linux-gnu/libz.so.1.2.11 /lib/aarch64-linux-gnu/libz.so.1; \
|
|
||||||
else \
|
|
||||||
echo "Unsupported architecture: $TARGETARCH" && exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Export the binary to the clean distroless image.
|
|
||||||
FROM gcr.io/distroless/cc-debian12:latest AS base
|
|
||||||
|
|
||||||
ARG OUTPUT_DIR
|
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
# Copy required library dependencies
|
|
||||||
COPY --from=libs /lib /lib
|
|
||||||
COPY --from=busybox:stable /bin/busybox /bin/busybox
|
|
||||||
|
|
||||||
WORKDIR /greptime
|
|
||||||
COPY --from=builder /out/target/${OUTPUT_DIR}/greptime /greptime/bin/greptime
|
|
||||||
ENV PATH=/greptime/bin/:$PATH
|
|
||||||
|
|
||||||
ENV MALLOC_CONF="prof:true,prof_active:false"
|
|
||||||
|
|
||||||
ENTRYPOINT ["greptime"]
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
FROM ubuntu:22.04 AS builder
|
FROM ubuntu:22.04 as builder
|
||||||
|
|
||||||
ARG CARGO_PROFILE
|
ARG CARGO_PROFILE
|
||||||
ARG FEATURES
|
ARG FEATURES
|
||||||
ARG OUTPUT_DIR
|
ARG OUTPUT_DIR
|
||||||
|
|
||||||
ENV LANG=en_US.utf8
|
ENV LANG en_US.utf8
|
||||||
WORKDIR /greptimedb
|
WORKDIR /greptimedb
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
@@ -23,7 +23,7 @@ RUN --mount=type=cache,target=/var/cache/apt \
|
|||||||
# Install Rust.
|
# Install Rust.
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path --default-toolchain none -y
|
||||||
ENV PATH=/root/.cargo/bin/:$PATH
|
ENV PATH /root/.cargo/bin/:$PATH
|
||||||
|
|
||||||
# Build the project in release mode.
|
# Build the project in release mode.
|
||||||
RUN --mount=target=. \
|
RUN --mount=target=. \
|
||||||
@@ -35,7 +35,7 @@ RUN --mount=target=. \
|
|||||||
|
|
||||||
# Export the binary to the clean image.
|
# Export the binary to the clean image.
|
||||||
# TODO(zyy17): Maybe should use the more secure container image.
|
# TODO(zyy17): Maybe should use the more secure container image.
|
||||||
FROM ubuntu:22.04 AS base
|
FROM ubuntu:22.04 as base
|
||||||
|
|
||||||
ARG OUTPUT_DIR
|
ARG OUTPUT_DIR
|
||||||
|
|
||||||
@@ -45,8 +45,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get \
|
|||||||
|
|
||||||
WORKDIR /greptime
|
WORKDIR /greptime
|
||||||
COPY --from=builder /out/target/${OUTPUT_DIR}/greptime /greptime/bin/
|
COPY --from=builder /out/target/${OUTPUT_DIR}/greptime /greptime/bin/
|
||||||
ENV PATH=/greptime/bin/:$PATH
|
ENV PATH /greptime/bin/:$PATH
|
||||||
|
|
||||||
ENV MALLOC_CONF="prof:true,prof_active:false"
|
|
||||||
|
|
||||||
ENTRYPOINT ["greptime"]
|
ENTRYPOINT ["greptime"]
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ ARG TARGETARCH
|
|||||||
|
|
||||||
ADD $TARGETARCH/greptime /greptime/bin/
|
ADD $TARGETARCH/greptime /greptime/bin/
|
||||||
|
|
||||||
ENV PATH=/greptime/bin/:$PATH
|
ENV PATH /greptime/bin/:$PATH
|
||||||
|
|
||||||
ENV MALLOC_CONF="prof:true,prof_active:false"
|
|
||||||
|
|
||||||
ENTRYPOINT ["greptime"]
|
ENTRYPOINT ["greptime"]
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
FROM ubuntu:22.04 AS libs
|
|
||||||
|
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
# Copy required library dependencies based on architecture
|
|
||||||
# TARGETARCH values: amd64, arm64
|
|
||||||
# Ubuntu library paths: x86_64-linux-gnu, aarch64-linux-gnu
|
|
||||||
RUN if [ "$TARGETARCH" = "amd64" ]; then \
|
|
||||||
mkdir -p /output/x86_64-linux-gnu && \
|
|
||||||
cp /lib/x86_64-linux-gnu/libz.so.1.2.11 /output/x86_64-linux-gnu/libz.so.1; \
|
|
||||||
elif [ "$TARGETARCH" = "arm64" ]; then \
|
|
||||||
mkdir -p /output/aarch64-linux-gnu && \
|
|
||||||
cp /lib/aarch64-linux-gnu/libz.so.1.2.11 /output/aarch64-linux-gnu/libz.so.1; \
|
|
||||||
else \
|
|
||||||
echo "Unsupported architecture: $TARGETARCH" && exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
FROM gcr.io/distroless/cc-debian12:latest
|
|
||||||
|
|
||||||
# The root path under which contains all the dependencies to build this Dockerfile.
|
|
||||||
ARG DOCKER_BUILD_ROOT=.
|
|
||||||
# The binary name of GreptimeDB executable.
|
|
||||||
# Defaults to "greptime", but sometimes in other projects it might be different.
|
|
||||||
ARG TARGET_BIN=greptime
|
|
||||||
|
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
# Copy required library dependencies
|
|
||||||
COPY --from=libs /output /lib
|
|
||||||
COPY --from=busybox:stable /bin/busybox /bin/busybox
|
|
||||||
|
|
||||||
ADD $TARGETARCH/$TARGET_BIN /greptime/bin/
|
|
||||||
|
|
||||||
ENV PATH=/greptime/bin/:$PATH
|
|
||||||
|
|
||||||
ENV TARGET_BIN=$TARGET_BIN
|
|
||||||
|
|
||||||
ENV MALLOC_CONF="prof:true,prof_active:false"
|
|
||||||
|
|
||||||
ENTRYPOINT ["greptime"]
|
|
||||||
@@ -14,10 +14,8 @@ ARG TARGETARCH
|
|||||||
|
|
||||||
ADD $TARGETARCH/$TARGET_BIN /greptime/bin/
|
ADD $TARGETARCH/$TARGET_BIN /greptime/bin/
|
||||||
|
|
||||||
ENV PATH=/greptime/bin/:$PATH
|
ENV PATH /greptime/bin/:$PATH
|
||||||
|
|
||||||
ENV TARGET_BIN=$TARGET_BIN
|
ENV TARGET_BIN=$TARGET_BIN
|
||||||
|
|
||||||
ENV MALLOC_CONF="prof:true,prof_active:false"
|
|
||||||
|
|
||||||
ENTRYPOINT ["sh", "-c", "exec $TARGET_BIN \"$@\"", "--"]
|
ENTRYPOINT ["sh", "-c", "exec $TARGET_BIN \"$@\"", "--"]
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ RUN apt-get update && apt-get install -y \
|
|||||||
git \
|
git \
|
||||||
unzip \
|
unzip \
|
||||||
build-essential \
|
build-essential \
|
||||||
pkg-config \
|
pkg-config
|
||||||
openssh-client
|
|
||||||
|
|
||||||
# Install protoc
|
# Install protoc
|
||||||
ARG PROTOBUF_VERSION=29.3
|
ARG PROTOBUF_VERSION=29.3
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ ARG PROTOBUF_VERSION=29.3
|
|||||||
|
|
||||||
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip && \
|
RUN curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip && \
|
||||||
unzip protoc-${PROTOBUF_VERSION}-linux-x86_64.zip -d protoc3;
|
unzip protoc-${PROTOBUF_VERSION}-linux-x86_64.zip -d protoc3;
|
||||||
|
|
||||||
RUN mv protoc3/bin/* /usr/local/bin/
|
RUN mv protoc3/bin/* /usr/local/bin/
|
||||||
RUN mv protoc3/include/* /usr/local/include/
|
RUN mv protoc3/include/* /usr/local/include/
|
||||||
|
|
||||||
|
|||||||
@@ -34,48 +34,6 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- greptimedb
|
- greptimedb
|
||||||
|
|
||||||
etcd-tls:
|
|
||||||
<<: *etcd_common_settings
|
|
||||||
container_name: etcd-tls
|
|
||||||
ports:
|
|
||||||
- 2378:2378
|
|
||||||
- 2381:2381
|
|
||||||
command:
|
|
||||||
- --name=etcd-tls
|
|
||||||
- --data-dir=/var/lib/etcd
|
|
||||||
- --initial-advertise-peer-urls=https://etcd-tls:2381
|
|
||||||
- --listen-peer-urls=https://0.0.0.0:2381
|
|
||||||
- --listen-client-urls=https://0.0.0.0:2378
|
|
||||||
- --advertise-client-urls=https://etcd-tls:2378
|
|
||||||
- --heartbeat-interval=250
|
|
||||||
- --election-timeout=1250
|
|
||||||
- --initial-cluster=etcd-tls=https://etcd-tls:2381
|
|
||||||
- --initial-cluster-state=new
|
|
||||||
- --initial-cluster-token=etcd-tls-cluster
|
|
||||||
- --cert-file=/certs/server.crt
|
|
||||||
- --key-file=/certs/server-key.pem
|
|
||||||
- --peer-cert-file=/certs/server.crt
|
|
||||||
- --peer-key-file=/certs/server-key.pem
|
|
||||||
- --trusted-ca-file=/certs/ca.crt
|
|
||||||
- --peer-trusted-ca-file=/certs/ca.crt
|
|
||||||
- --client-cert-auth
|
|
||||||
- --peer-client-cert-auth
|
|
||||||
volumes:
|
|
||||||
- ./greptimedb-cluster-docker-compose/etcd-tls:/var/lib/etcd
|
|
||||||
- ./greptimedb-cluster-docker-compose/certs:/certs:ro
|
|
||||||
environment:
|
|
||||||
- ETCDCTL_API=3
|
|
||||||
- ETCDCTL_CACERT=/certs/ca.crt
|
|
||||||
- ETCDCTL_CERT=/certs/server.crt
|
|
||||||
- ETCDCTL_KEY=/certs/server-key.pem
|
|
||||||
healthcheck:
|
|
||||||
test: [ "CMD", "etcdctl", "--endpoints=https://etcd-tls:2378", "--cacert=/certs/ca.crt", "--cert=/certs/server.crt", "--key=/certs/server-key.pem", "endpoint", "health" ]
|
|
||||||
interval: 10s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 5
|
|
||||||
networks:
|
|
||||||
- greptimedb
|
|
||||||
|
|
||||||
metasrv:
|
metasrv:
|
||||||
image: *greptimedb_image
|
image: *greptimedb_image
|
||||||
container_name: metasrv
|
container_name: metasrv
|
||||||
|
|||||||
@@ -48,4 +48,4 @@ Please refer to [SQL query](./query.sql) for GreptimeDB and Clickhouse, and [que
|
|||||||
|
|
||||||
## Addition
|
## Addition
|
||||||
- You can tune GreptimeDB's configuration to get better performance.
|
- You can tune GreptimeDB's configuration to get better performance.
|
||||||
- You can setup GreptimeDB to use S3 as storage, see [here](https://docs.greptime.com/user-guide/deployments-administration/configuration#storage-options).
|
- You can setup GreptimeDB to use S3 as storage, see [here](https://docs.greptime.com/user-guide/deployments/configuration#storage-options).
|
||||||
|
|||||||
@@ -13,19 +13,4 @@ Log Level changed from Some("info") to "trace,flow=debug"%
|
|||||||
|
|
||||||
The data is a string in the format of `global_level,module1=level1,module2=level2,...` that follows the same rule of `RUST_LOG`.
|
The data is a string in the format of `global_level,module1=level1,module2=level2,...` that follows the same rule of `RUST_LOG`.
|
||||||
|
|
||||||
The module is the module name of the log, and the level is the log level. The log level can be one of the following: `trace`, `debug`, `info`, `warn`, `error`, `off`(case insensitive).
|
The module is the module name of the log, and the level is the log level. The log level can be one of the following: `trace`, `debug`, `info`, `warn`, `error`, `off`(case insensitive).
|
||||||
|
|
||||||
# Enable/Disable Trace on the Fly
|
|
||||||
|
|
||||||
## HTTP API
|
|
||||||
|
|
||||||
example:
|
|
||||||
```bash
|
|
||||||
curl --data "true" 127.0.0.1:4000/debug/enable_trace
|
|
||||||
```
|
|
||||||
And database will reply with something like:
|
|
||||||
```
|
|
||||||
trace enabled%
|
|
||||||
```
|
|
||||||
|
|
||||||
Possible values are "true" or "false".
|
|
||||||
@@ -30,8 +30,6 @@ curl https://raw.githubusercontent.com/brendangregg/FlameGraph/master/flamegraph
|
|||||||
|
|
||||||
## Profiling
|
## Profiling
|
||||||
|
|
||||||
### Enable memory profiling for greptimedb binary
|
|
||||||
|
|
||||||
Start GreptimeDB instance with environment variables:
|
Start GreptimeDB instance with environment variables:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -42,48 +40,6 @@ MALLOC_CONF=prof:true ./target/debug/greptime standalone start
|
|||||||
_RJEM_MALLOC_CONF=prof:true ./target/debug/greptime standalone start
|
_RJEM_MALLOC_CONF=prof:true ./target/debug/greptime standalone start
|
||||||
```
|
```
|
||||||
|
|
||||||
### Memory profiling for greptimedb docker image
|
|
||||||
|
|
||||||
We have memory profiling enabled and activated by default in our official docker
|
|
||||||
image.
|
|
||||||
|
|
||||||
This behavior is controlled by configuration `enable_heap_profiling`:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[memory]
|
|
||||||
# Whether to enable heap profiling activation during startup.
|
|
||||||
# Default is true.
|
|
||||||
enable_heap_profiling = true
|
|
||||||
```
|
|
||||||
|
|
||||||
To disable memory profiling, set `enable_heap_profiling` to `false`.
|
|
||||||
|
|
||||||
### Memory profiling control
|
|
||||||
|
|
||||||
You can control heap profiling activation using the new HTTP APIs:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Check current profiling status
|
|
||||||
curl -X GET localhost:4000/debug/prof/mem/status
|
|
||||||
|
|
||||||
# Activate heap profiling (if not already active)
|
|
||||||
curl -X POST localhost:4000/debug/prof/mem/activate
|
|
||||||
|
|
||||||
# Deactivate heap profiling
|
|
||||||
curl -X POST localhost:4000/debug/prof/mem/deactivate
|
|
||||||
|
|
||||||
# Activate gdump feature that dumps memory profiling data every time virtual memory usage exceeds previous maximum value.
|
|
||||||
curl -X POST localhost:4000/debug/prof/mem/gdump -d 'activate=true'
|
|
||||||
|
|
||||||
# Deactivate gdump.
|
|
||||||
curl -X POST localhost:4000/debug/prof/mem/gdump -d 'activate=false'
|
|
||||||
|
|
||||||
# Retrieve current gdump status.
|
|
||||||
curl -X GET localhost:4000/debug/prof/mem/gdump
|
|
||||||
```
|
|
||||||
|
|
||||||
### Dump memory profiling data
|
|
||||||
|
|
||||||
Dump memory profiling data through HTTP API:
|
Dump memory profiling data through HTTP API:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
72
docs/how-to/how-to-write-aggregate-function.md
Normal file
72
docs/how-to/how-to-write-aggregate-function.md
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
Currently, our query engine is based on DataFusion, so all aggregate function is executed by DataFusion, through its UDAF interface. You can find DataFusion's UDAF example [here](https://github.com/apache/arrow-datafusion/blob/arrow2/datafusion-examples/examples/simple_udaf.rs). Basically, we provide the same way as DataFusion to write aggregate functions: both are centered in a struct called "Accumulator" to accumulates states along the way in aggregation.
|
||||||
|
|
||||||
|
However, DataFusion's UDAF implementation has a huge restriction, that it requires user to provide a concrete "Accumulator". Take `Median` aggregate function for example, to aggregate a `u32` datatype column, you have to write a `MedianU32`, and use `SELECT MEDIANU32(x)` in SQL. `MedianU32` cannot be used to aggregate a `i32` datatype column. Or, there's another way: you can use a special type that can hold all kinds of data (like our `Value` enum or Arrow's `ScalarValue`), and `match` all the way up to do aggregate calculations. It might work, though rather tedious. (But I think it's DataFusion's preferred way to write UDAF.)
|
||||||
|
|
||||||
|
So is there a way we can make an aggregate function that automatically match the input data's type? For example, a `Median` aggregator that can work on both `u32` column and `i32`? The answer is yes until we find a way to bypass DataFusion's restriction, a restriction that DataFusion simply doesn't pass the input data's type when creating an Accumulator.
|
||||||
|
|
||||||
|
> There's an example in `my_sum_udaf_example.rs`, take that as quick start.
|
||||||
|
|
||||||
|
# 1. Impl `AggregateFunctionCreator` trait for your accumulator creator.
|
||||||
|
|
||||||
|
You must first define a struct that will be used to create your accumulator. For example,
|
||||||
|
|
||||||
|
```Rust
|
||||||
|
#[as_aggr_func_creator]
|
||||||
|
#[derive(Debug, AggrFuncTypeStore)]
|
||||||
|
struct MySumAccumulatorCreator {}
|
||||||
|
```
|
||||||
|
|
||||||
|
Attribute macro `#[as_aggr_func_creator]` and derive macro `#[derive(Debug, AggrFuncTypeStore)]` must both be annotated on the struct. They work together to provide a storage of aggregate function's input data types, which are needed for creating generic accumulator later.
|
||||||
|
|
||||||
|
> Note that the `as_aggr_func_creator` macro will add fields to the struct, so the struct cannot be defined as an empty struct without field like `struct Foo;`, neither as a new type like `struct Foo(bar)`.
|
||||||
|
|
||||||
|
Then impl `AggregateFunctionCreator` trait on it. The definition of the trait is:
|
||||||
|
|
||||||
|
```Rust
|
||||||
|
pub trait AggregateFunctionCreator: Send + Sync + Debug {
|
||||||
|
fn creator(&self) -> AccumulatorCreatorFunction;
|
||||||
|
fn output_type(&self) -> ConcreteDataType;
|
||||||
|
fn state_types(&self) -> Vec<ConcreteDataType>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can use input data's type in methods that return output type and state types (just invoke `input_types()`).
|
||||||
|
|
||||||
|
The output type is aggregate function's output data's type. For example, `SUM` aggregate function's output type is `u64` for a `u32` datatype column. The state types are accumulator's internal states' types. Take `AVG` aggregate function on a `i32` column as example, its state types are `i64` (for sum) and `u64` (for count).
|
||||||
|
|
||||||
|
The `creator` function is where you define how an accumulator (that will be used in DataFusion) is created. You define "how" to create the accumulator (instead of "what" to create), using the input data's type as arguments. With input datatype known, you can create accumulator generically.
|
||||||
|
|
||||||
|
# 2. Impl `Accumulator` trait for your accumulator.
|
||||||
|
|
||||||
|
The accumulator is where you store the aggregate calculation states and evaluate a result. You must impl `Accumulator` trait for it. The trait's definition is:
|
||||||
|
|
||||||
|
```Rust
|
||||||
|
pub trait Accumulator: Send + Sync + Debug {
|
||||||
|
fn state(&self) -> Result<Vec<Value>>;
|
||||||
|
fn update_batch(&mut self, values: &[VectorRef]) -> Result<()>;
|
||||||
|
fn merge_batch(&mut self, states: &[VectorRef]) -> Result<()>;
|
||||||
|
fn evaluate(&self) -> Result<Value>;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The DataFusion basically executes aggregate like this:
|
||||||
|
|
||||||
|
1. Partitioning all input data for aggregate. Create an accumulator for each part.
|
||||||
|
2. Call `update_batch` on each accumulator with partitioned data, to let you update your aggregate calculation.
|
||||||
|
3. Call `state` to get each accumulator's internal state, the medial calculation result.
|
||||||
|
4. Call `merge_batch` to merge all accumulator's internal state to one.
|
||||||
|
5. Execute `evaluate` on the chosen one to get the final calculation result.
|
||||||
|
|
||||||
|
Once you know the meaning of each method, you can easily write your accumulator. You can refer to `Median` accumulator or `SUM` accumulator defined in file `my_sum_udaf_example.rs` for more details.
|
||||||
|
|
||||||
|
# 3. Register your aggregate function to our query engine.
|
||||||
|
|
||||||
|
You can call `register_aggregate_function` method in query engine to register your aggregate function. To do that, you have to new an instance of struct `AggregateFunctionMeta`. The struct has three fields, first is the name of your aggregate function's name. The function name is case-sensitive due to DataFusion's restriction. We strongly recommend using lowercase for your name. If you have to use uppercase name, wrap your aggregate function with quotation marks. For example, if you define an aggregate function named "my_aggr", you can use "`SELECT MY_AGGR(x)`"; if you define "my_AGGR", you have to use "`SELECT "my_AGGR"(x)`".
|
||||||
|
|
||||||
|
The second field is arg_counts ,the count of the arguments. Like accumulator `percentile`, calculating the p_number of the column. We need to input the value of column and the value of p to calculate, and so the count of the arguments is two.
|
||||||
|
|
||||||
|
The third field is a function about how to create your accumulator creator that you defined in step 1 above. Create creator, that's a bit intertwined, but it is how we make DataFusion use a newly created aggregate function each time it executes a SQL, preventing the stored input types from affecting each other. The key detail can be starting looking at our `DfContextProviderAdapter` struct's `get_aggregate_meta` method.
|
||||||
|
|
||||||
|
# (Optional) 4. Make your aggregate function automatically registered.
|
||||||
|
|
||||||
|
If you've written a great aggregate function that wants to let everyone use it, you can make it automatically register to our query engine at start time. It's quick and simple, just refer to the `AggregateFunctions::register` function in `common/function/src/scalars/aggregate/mod.rs`.
|
||||||
@@ -76,7 +76,7 @@ pub trait CompactionStrategy {
|
|||||||
```
|
```
|
||||||
|
|
||||||
The most suitable compaction strategy for time-series scenario would be
|
The most suitable compaction strategy for time-series scenario would be
|
||||||
a hybrid strategy that combines time window compaction with size-tired compaction, just like [Cassandra](https://cassandra.apache.org/doc/latest/cassandra/managing/operating/compaction/twcs.html) and [ScyllaDB](https://docs.scylladb.com/stable/architecture/compaction/compaction-strategies.html#time-window-compaction-strategy-twcs) does.
|
a hybrid strategy that combines time window compaction with size-tired compaction, just like [Cassandra](https://cassandra.apache.org/doc/latest/cassandra/operating/compaction/twcs.html) and [ScyllaDB](https://docs.scylladb.com/stable/architecture/compaction/compaction-strategies.html#time-window-compaction-strategy-twcs) does.
|
||||||
|
|
||||||
We can first group SSTs in level n into buckets according to some predefined time window. Within that window,
|
We can first group SSTs in level n into buckets according to some predefined time window. Within that window,
|
||||||
SSTs are compacted in a size-tired manner (find SSTs with similar size and compact them to level n+1).
|
SSTs are compacted in a size-tired manner (find SSTs with similar size and compact them to level n+1).
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ In order to do those things while maintaining a low memory footprint, you need t
|
|||||||
- Greptime Flow's is built on top of [Hydroflow](https://github.com/hydro-project/hydroflow).
|
- Greptime Flow's is built on top of [Hydroflow](https://github.com/hydro-project/hydroflow).
|
||||||
- We have three choices for the Dataflow/Streaming process framework for our simple continuous aggregation feature:
|
- We have three choices for the Dataflow/Streaming process framework for our simple continuous aggregation feature:
|
||||||
1. Based on the timely/differential dataflow crate that [materialize](https://github.com/MaterializeInc/materialize) based on. Later, it's proved too obscure for a simple usage, and is hard to customize memory usage control.
|
1. Based on the timely/differential dataflow crate that [materialize](https://github.com/MaterializeInc/materialize) based on. Later, it's proved too obscure for a simple usage, and is hard to customize memory usage control.
|
||||||
2. Based on a simple dataflow framework that we write from ground up, like what [arroyo](https://www.arroyo.dev/) or [risingwave](https://www.risingwave.dev/) did, for example the core streaming logic of [arroyo](https://github.com/ArroyoSystems/arroyo/blob/master/crates/arroyo-datastream/src/lib.rs) only takes up to 2000 line of codes. However, it means maintaining another layer of dataflow framework, which might seem easy in the beginning, but I fear it might be too burdensome to maintain once we need more features.
|
2. Based on a simple dataflow framework that we write from ground up, like what [arroyo](https://www.arroyo.dev/) or [risingwave](https://www.risingwave.dev/) did, for example the core streaming logic of [arroyo](https://github.com/ArroyoSystems/arroyo/blob/master/arroyo-datastream/src/lib.rs) only takes up to 2000 line of codes. However, it means maintaining another layer of dataflow framework, which might seem easy in the beginning, but I fear it might be too burdensome to maintain once we need more features.
|
||||||
3. Based on a simple and lower level dataflow framework that someone else write, like [hydroflow](https://github.com/hydro-project/hydroflow), this approach combines the best of both worlds. Firstly, it boasts ease of comprehension and customization. Secondly, the dataflow framework offers precisely the necessary features for crafting uncomplicated single-node dataflow programs while delivering decent performance.
|
3. Based on a simple and lower level dataflow framework that someone else write, like [hydroflow](https://github.com/hydro-project/hydroflow), this approach combines the best of both worlds. Firstly, it boasts ease of comprehension and customization. Secondly, the dataflow framework offers precisely the necessary features for crafting uncomplicated single-node dataflow programs while delivering decent performance.
|
||||||
|
|
||||||
Hence, we choose the third option, and use a simple logical plan that's anagonistic to the underlying dataflow framework, as it only describe how the dataflow graph should be doing, not how it do that. And we built operator in hydroflow to execute the plan. And the result hydroflow graph is wrapped in a engine that only support data in/out and tick event to flush and compute the result. This provide a thin middle layer that's easy to maintain and allow switching to other dataflow framework if necessary.
|
Hence, we choose the third option, and use a simple logical plan that's anagonistic to the underlying dataflow framework, as it only describe how the dataflow graph should be doing, not how it do that. And we built operator in hydroflow to execute the plan. And the result hydroflow graph is wrapped in a engine that only support data in/out and tick event to flush and compute the result. This provide a thin middle layer that's easy to maintain and allow switching to other dataflow framework if necessary.
|
||||||
|
|||||||
@@ -1,154 +0,0 @@
|
|||||||
---
|
|
||||||
Feature Name: Repartition
|
|
||||||
Tracking Issue: https://github.com/GreptimeTeam/greptimedb/issues/6558
|
|
||||||
Date: 2025-06-20
|
|
||||||
Author: "Ruihang Xia <waynestxia@gmail.com>"
|
|
||||||
---
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
|
|
||||||
This RFC proposes a method for repartitioning a table, to adjust the partition rule and data distribution.
|
|
||||||
|
|
||||||
# Motivation
|
|
||||||
|
|
||||||
With time passing, the data distribution and skew pattern of a table might change. We need a way to repartition the table to suit the new pattern.
|
|
||||||
|
|
||||||
# Details
|
|
||||||
|
|
||||||
Here is a rough workflow diagram of the entire repartition process, each step is described in detail below.
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant Frontend
|
|
||||||
participant Metasrv
|
|
||||||
participant Datanodes
|
|
||||||
participant Region0 as Region 0
|
|
||||||
|
|
||||||
Frontend->>Frontend: Process request, validation etc.
|
|
||||||
Frontend->>Metasrv: Submit procedure
|
|
||||||
Metasrv->>Metasrv: Compute diff and generate migration plan
|
|
||||||
Metasrv->>Metasrv: Allocate necessary region resources (with Paas)
|
|
||||||
Metasrv->>Datanodes: Stop compaction and snapshot
|
|
||||||
rect rgb(255, 225, 225)
|
|
||||||
note over Frontend, Region0: No Ingestion Period
|
|
||||||
Metasrv->>Frontend: Stop processing write requests
|
|
||||||
Metasrv->>Metasrv: Update metadata
|
|
||||||
Metasrv->>Frontend: Start processing read requests
|
|
||||||
end
|
|
||||||
Metasrv->>Datanodes: Update region rule, stage version changes from now on
|
|
||||||
Region0->>Region0: Compute new manifests for all regions
|
|
||||||
Region0->>Datanodes: Submit manifest changes
|
|
||||||
Metasrv->>Datanodes: Recover compaction and snapshot, make staged changes visible
|
|
||||||
|
|
||||||
note over Frontend, Datanodes: Reload Cache
|
|
||||||
Metasrv->>Metasrv: Release resources (with Paas)
|
|
||||||
Metasrv->>Metasrv: Schedule optional compaction (to remote compactor)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Preprocessing
|
|
||||||
|
|
||||||
This phase is for static analysis of the new partition rule. The server can know whether the repartitioning is possible, how to do the repartitioning, and how much resources are needed.
|
|
||||||
|
|
||||||
In theory, the input and output partition rules for repartitioning can be completely unrelated. But in practice, to avoid a very large change set, we'll only allow two simple kinds of change. One splits one region into two regions (region split) and another merges two regions into one (region merge).
|
|
||||||
|
|
||||||
After validating the new partition rule using the same validation logic as table creation, we compute the difference between the old and new partition rules. The resulting diff may contain several independent groups of changes. During subsequent processing, each group of changes can be handled independently and can succeed or fail without affecting other groups or creating non-idempotently retryable scenarios.
|
|
||||||
|
|
||||||
Next, we generate a repartition plan for each group of changes. Each plan contains this information for all regions involved in that particular plan. And one target region will only be referenced by a single plan.
|
|
||||||
|
|
||||||
With those plans, we can determine the resource requirements for the repartition operation, where resources here primarily refer to Regions. Metasrv will coordinate with PaaS layer to pre-allocate the necessary regions at this stage. These new regions start completely empty, and their metadata and manifests will be populated during subsequent modification steps.
|
|
||||||
|
|
||||||
## Data Processing
|
|
||||||
|
|
||||||
This phase is primarily for region's change, including region's metadata (route table and the corresponding rule) and manifest.
|
|
||||||
|
|
||||||
Once we start processing one plan through a procedure, we'll first stop the region's compaction and snapshot. This is to avoid any states being removed due to compaction (which may removes old SST files) and snapshot (which may removes old manifest files).
|
|
||||||
|
|
||||||
Metasrv will trying to update the metadata of partition, or the region route table (related to `PartitionRuleManager`). This step is in the "no ingestion" scope, so no new data will be ingested. Since this won't take much time, the affection to the cluster is minimized. Metasrv will also update the region rule to corresponding regions on Datanodes.
|
|
||||||
|
|
||||||
Every regions and all the ingestion requests to the region server will have a version of region rule, to identify under which rule the request is processed. The version can be something like `hash(region_rule)`. Once the region rule on region server is updated, all ingestion request with old rule will be rejected, and all requests with new rule will be accepted but not visible. They can still be flushed to persisted storage, but their version change (new manifest) will be staged.
|
|
||||||
|
|
||||||
Then region 0 (or let metasrv to pick any operational region) will compute the new manifests for all target regions. This step is done by first reading all old manifests, and remapping the files with new partition rule, to get the content of new manifests. Notice this step only handles the manifests before region rule change on region server, and won't touch those staged manifests, as they are already with the new rule.
|
|
||||||
|
|
||||||
Those new manifest will be submitted to the corresponding target regions by region 0 via a `RegionEdit` request. If this request falls after a few retries, region 0 will try to rollback this change by directly overwriting the manifest on object storage. and report this failure to metasrv and let the entire repartition procedure to fail. And we can also optionally compute the new manifest for those staged version changes (like another repartition) and submit them to the target regions to make the also visible even if the repartition fails.
|
|
||||||
|
|
||||||
In the other hand, a successful `RegionEdit` request also acknowledges those staged version changes and make them visible.
|
|
||||||
|
|
||||||
After this step, the repartition is done in the data plane. We can start to process compaction and snapshot again.
|
|
||||||
|
|
||||||
## Postprocessing
|
|
||||||
|
|
||||||
After the main processing is done, we can do some extra postprocessing to reduce the performance impact of repartition. Including reloading caches in frontend's route table, metasrv's kv cache and datanode's read/write/page cache etc.
|
|
||||||
|
|
||||||
We can also schedule an optional compaction to reorganize all the data file under the new partition rule to reduce potential fragmentation or read amplification.
|
|
||||||
|
|
||||||
## Procedure
|
|
||||||
|
|
||||||
Here describe the repartition procedure step by step:
|
|
||||||
|
|
||||||
- <on frontend> Validating repartition request
|
|
||||||
- <on frontend> Initialize the repartition procedure
|
|
||||||
- Calculate rule diff and repartition plan group
|
|
||||||
- Allocate necessary new regions
|
|
||||||
- Lock the table key
|
|
||||||
- For each repartition subprocedure
|
|
||||||
- Stop compaction and snapshot
|
|
||||||
- Forbid new ingestion requests, update metadata, allow ingestion requests.
|
|
||||||
- Update region rule to regions
|
|
||||||
- Pick one region to calculate new manifest for all regions in this repartition group
|
|
||||||
- Let that region to apply new manifest to each region via `RegionEdit`
|
|
||||||
- If failed after some retries, revert this manifest change to other succeeded regions and mark this failure.
|
|
||||||
- If all succeeded, acknowledge those staged version changes and make them visible.
|
|
||||||
- Return result
|
|
||||||
- Collect results from subprocedure.
|
|
||||||
- For those who failed, we need to restart those regions to force reconstruct their status from manifests
|
|
||||||
- For those who succeeded, collect and merge their rule diff
|
|
||||||
- Unlock the table key
|
|
||||||
- Report the result to user.
|
|
||||||
- <in background> Reload cache
|
|
||||||
- <in background> Maybe trigger a special compaction
|
|
||||||
|
|
||||||
In addition of sequential step, rollback is also an important part of this procedure. There are three steps can be rolled back when unrecoverable failure occurs.
|
|
||||||
|
|
||||||
If the metadata update is not committed, we can overwrite the metadata to previous version. This step is scoped in the "no ingestion" period, so no new data will be ingested and the status of both datanode and metasrv will be consistent.
|
|
||||||
|
|
||||||
If the `RegionEdit` to other regions is not acknowledged, or partial acknowledged, we can directly overwrite the manifest on object storage from the central region (who computes the new manifest), and force region server to reload corresponding region to load its state from object storage to recover.
|
|
||||||
|
|
||||||
If the staged version changes are not acknowledged, we can re-compute manifest based on old rule for staged data, and apply them directly like above. This is like another smaller repartition for those staged data.
|
|
||||||
|
|
||||||
## Region rule validation and diff calculation
|
|
||||||
|
|
||||||
In the current codebase, the rule checker is not complete. It can't check uniqueness and completeness of the rule. This RFC also propose a new way to validate the rule.
|
|
||||||
|
|
||||||
The proposed validation way is based on a check-point system, which first generates a group of check-points from the rule, and then check if all the point is covered and only covered by one rule.
|
|
||||||
|
|
||||||
All the partition rule expressionis limited to be the form of `<column> <operator> <value>`, and the operator is limited to be comparison operators. Those expressions are allowed to be nested with `AND` and `OR` operators. Based on this, we can first extract all the unique values on each column, adding and subtracting a little epsilon to cover its left and right boundary.
|
|
||||||
|
|
||||||
Since we accept integer, float and string as the value type, compute on them directly is not convenient. So we'll first normalize them to a common type and only need to preserve the relative partial ordering. This also avoids the problem of "what is next/previous value" of string and "what's a good precision" for float.
|
|
||||||
|
|
||||||
After normalization, we get a set of scatter points for each column. Then we can generate a set of check-points by combining all the scatter points like building a cartesian product. This might bring a large number of check-points, so we can do an prune optimization to remove some of them by merging some of the expression zones. Those expressions who have identical N-1 edge sub-expressions with one adjacent edge can be merged together. This prune check is with a time complexity of O(N * M * log(M)), where N is the number of active dimensions and M is the number of expression zones. Diff calculation is also done by finding different expression zones between the old and new rule set, and check if we can transform one to another by merging some of the expression zones.
|
|
||||||
|
|
||||||
The step to validate the check-points set against expressions can be treated as a tiny expression of `PhysicalExpr`. This evaluation will give a boolean matrix of K*M shape, where K is the number of check-points. We then check in each row of the matrix, if there is one and only one true value.
|
|
||||||
|
|
||||||
## Compute and use new manifest
|
|
||||||
|
|
||||||
We can generate a new set of manifest file based on old manifest and two versions of rule. From abvoe rule processing part, we can tell how a new rule & region is from previous one. So a simple way to get the new manifest is also apply the step of change to manifest files. E.g., if region A is from region B and C, we simply combine all file IDs from B and C to generate the content of A.
|
|
||||||
|
|
||||||
If necessary, we can do this better by involving some metadata related to data, like min-max statistics of each file, and pre-evaluate over min-max to filter out unneeded files when generating new manifest.
|
|
||||||
|
|
||||||
The way to use new manifest needs one more extra step based on the current implementation. We'll need to record either in manifest or in file metadata, of what rule is used when generating (flush or compaction) a SST file. Then in every single read request, we need to append the current region rule as predicate to the read request, to ensure no data belong to other regions will be read. We can use the stored region rule to reduce the number of new predicates to apply, by removing the identical predicate between the current region rule and the stored region rule. So ideally in a table that has not been repartitioned recently, the overhead of checking region rule is minimal.
|
|
||||||
|
|
||||||
## Pre-required tasks
|
|
||||||
|
|
||||||
In above steps, we assume some functionalities are implemented. Here list them with where they are used and how to implement them.
|
|
||||||
|
|
||||||
### Cross-region read
|
|
||||||
|
|
||||||
The current data directory structure is `{table_id}/{region_id}/[data/metadata]/{file_id}`, every region can only access files under their own directory. After repartition, data file may be placed in other previous old regions. So we need to support cross-region read. This new access method allows region to access any file under the same table. Related tracking issue is <https://github.com/GreptimeTeam/greptimedb/issues/6409>.
|
|
||||||
|
|
||||||
### Global GC worker
|
|
||||||
|
|
||||||
This is to simplify state management of data files. As one file may be referenced in multiple manifests, or no manifest at all. After this, every region and the repartition process only need to care about generateing and using new files, without tracking whether a file should be deleted or not. Leaving the deletion to the global GC worker. This worker basically works by counting reference from manifest file, and remove unused one. Related tracking issue is **TBD**.
|
|
||||||
|
|
||||||
# Alternatives
|
|
||||||
|
|
||||||
In the "Data Processing" section, we can enlarge the "no ingestion" period to include almost all the steps. This can simplify the entire procedure by a lot, but will bring a longer time of ingestion pause which may not be acceptable.
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
---
|
|
||||||
Feature Name: Compatibility Test Framework
|
|
||||||
Tracking Issue: TBD
|
|
||||||
Date: 2025-07-04
|
|
||||||
Author: "Ruihang Xia <waynestxia@gmail.com>"
|
|
||||||
---
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
|
|
||||||
This RFC proposes a compatibility test framework for GreptimeDB to ensure backward/forward compatibility for different versions of GreptimeDB.
|
|
||||||
|
|
||||||
# Motivation
|
|
||||||
|
|
||||||
In current practice, we don't have a systematic way to test and ensure the compatibility of different versions of GreptimeDB. Each time we release a new version, we need to manually test the compatibility with ad-hoc cases. This is not only time-consuming, but also prone to errors and unmaintainable. Highly rely on the release manager to ensure the compatibility of different versions of GreptimeDB.
|
|
||||||
|
|
||||||
We don't have a detailed guide on the release SoP of how to test and ensure the compatibility of the new version. And has broken the compatibility of the new version many times (`v0.14.1` and `v0.15.1` are two examples, which are both released right after the major release).
|
|
||||||
|
|
||||||
# Details
|
|
||||||
|
|
||||||
This RFC proposes a compatibility test framework that is easy to maintain, extend and run. It can tell the compatibility between any given two versions of GreptimeDB, both backward and forward. It's based on the Sqlness library but used in a different way.
|
|
||||||
|
|
||||||
Generally speaking, the framework is composed of two parts:
|
|
||||||
|
|
||||||
1. Test cases: A set of test cases that are maintained dedicatedly for the compatibility test. Still in the `.sql` and `.result` format.
|
|
||||||
2. Test framework: A new sqlness runner that is used to run the test cases. With some new features that is not required by the integration sqlness test.
|
|
||||||
|
|
||||||
## Test Cases
|
|
||||||
|
|
||||||
### Structure
|
|
||||||
|
|
||||||
The case set is organized in three parts:
|
|
||||||
|
|
||||||
- `1.feature`: Use a new feature
|
|
||||||
- `2.verify`: Verify database behavior
|
|
||||||
- `3.cleanup`: Paired with `1.feature`, cleanup the test environment.
|
|
||||||
|
|
||||||
These three parts are organized in a tree structure, and should be run in sequence:
|
|
||||||
|
|
||||||
```
|
|
||||||
compatibility_test/
|
|
||||||
├── 1.feature/
|
|
||||||
│ ├── feature-a/
|
|
||||||
│ ├── feature-b/
|
|
||||||
│ └── feature-c/
|
|
||||||
├── 2.verify/
|
|
||||||
│ ├── verify-metadata/
|
|
||||||
│ ├── verify-data/
|
|
||||||
│ └── verify-schema/
|
|
||||||
└── 3.cleanup/
|
|
||||||
├── cleanup-a/
|
|
||||||
├── cleanup-b/
|
|
||||||
└── cleanup-c/
|
|
||||||
```
|
|
||||||
|
|
||||||
### Example
|
|
||||||
|
|
||||||
For example, for a new feature like adding new index option ([#6416](https://github.com/GreptimeTeam/greptimedb/pull/6416)), we (who implement the feature) create a new test case like this:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- path: compatibility_test/1.feature/index-option/granularity_and_false_positive_rate.sql
|
|
||||||
|
|
||||||
-- SQLNESS ARG since=0.15.0
|
|
||||||
-- SQLNESS IGNORE_RESULT
|
|
||||||
CREATE TABLE granularity_and_false_positive_rate (ts timestamp time index, val double) with ("index.granularity" = "8192", "index.false_positive_rate" = "0.01");
|
|
||||||
```
|
|
||||||
|
|
||||||
And
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- path: compatibility_test/3.cleanup/index-option/granularity_and_false_positive_rate.sql
|
|
||||||
drop table granularity_and_false_positive_rate;
|
|
||||||
```
|
|
||||||
|
|
||||||
Since this new feature don't require some special way to verify the database behavior, we can reuse existing test cases in `2.verify/` to verify the database behavior. For example, we can reuse the `verify-metadata` test case to verify the metadata of the table.
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- path: compatibility_test/2.verify/verify-metadata/show-create-table.sql
|
|
||||||
|
|
||||||
-- SQLNESS TEMPLATE TABLE="SHOW TABLES";
|
|
||||||
SHOW CREATE TABLE $TABLE;
|
|
||||||
```
|
|
||||||
|
|
||||||
In this example, we use some new sqlness features that will be introduced in the next section (`since`, `IGNORE_RESULT`, `TEMPLATE`).
|
|
||||||
|
|
||||||
### Maintenance
|
|
||||||
|
|
||||||
Each time implement a new feature that should be covered by the compatibility test, we should create a new test case in `1.feature/` and `3.cleanup/` for them. And check if existing cases in `2.verify/` can be reused to verify the database behavior.
|
|
||||||
|
|
||||||
This simulates an enthusiastic user who uses all the new features at the first time. All the new Maintenance burden is on the feature implementer to write one more test case for the new feature, to "fixation" the behavior. And once there is a breaking change in the future, it can be detected by the compatibility test framework automatically.
|
|
||||||
|
|
||||||
Another topic is about deprecation. If a feature is deprecated, we should also mark it in the test case. Still use above example, assume we deprecate the `index.granularity` and `index.false_positive_rate` index options in `v0.99.0`, we can mark them as:
|
|
||||||
```sql
|
|
||||||
-- SQLNESS ARG since=0.15.0 till=0.99.0
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
This tells the framework to ignore this feature in version `v0.99.0` and later. Currently, we have so many experimental features that are scheduled to be broken in the future, this is a good way to mark them.
|
|
||||||
|
|
||||||
## Test Framework
|
|
||||||
|
|
||||||
This section is about new sqlness features required by this framework.
|
|
||||||
|
|
||||||
### Since and Till
|
|
||||||
|
|
||||||
Follows the `ARG` interceptor in sqlness, we can mark a feature is available between two given versions. Only the `since` is required:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- SQLNESS ARG since=VERSION_STRING [till=VERSION_STRING]
|
|
||||||
```
|
|
||||||
|
|
||||||
### IGNORE_RESULT
|
|
||||||
|
|
||||||
`IGNORE_RESULT` is a new interceptor, it tells the runner to ignore the result of the query, only check whether the query is executed successfully.
|
|
||||||
|
|
||||||
This is useful to reduce the Maintenance burden of the test cases, unlike the integration sqlness test, in most cases we don't care about the result of the query, only need to make sure the query is executed successfully.
|
|
||||||
|
|
||||||
### TEMPLATE
|
|
||||||
|
|
||||||
`TEMPLATE` is another new interceptor, it can generate queries from a template based on a runtime data.
|
|
||||||
|
|
||||||
In above example, we need to run the `SHOW CREATE TABLE` query for all existing tables, so we can use the `TEMPLATE` interceptor to generate the query with a dynamic table list.
|
|
||||||
|
|
||||||
### RUNNER
|
|
||||||
|
|
||||||
There are also some extra requirement for the runner itself:
|
|
||||||
|
|
||||||
- It should run the test cases in sequence, first `1.feature/`, then `2.verify/`, and finally `3.cleanup/`.
|
|
||||||
- It should be able to fetch required version automatically to finish the test.
|
|
||||||
- It should handle the `since` and `till` properly.
|
|
||||||
|
|
||||||
On the `1.feature` phase, the runner needs to identify all features need to be tested by version number. And then restart with a new version (the `to` version) to run `2.verify/` and `3.cleanup/` phase.
|
|
||||||
|
|
||||||
## Test Report
|
|
||||||
|
|
||||||
Finally, we can run the compatibility test to verify the compatibility between any given two versions of GreptimeDB, for example:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# check backward compatibility between v0.15.0 and v0.16.0 when releasing v0.16.0
|
|
||||||
./sqlness run --from=0.15.0 --to=0.16.0
|
|
||||||
|
|
||||||
# check forward compatibility when downgrading from v0.15.0 to v0.13.0
|
|
||||||
./sqlness run --from=0.15.0 --to=0.13.0
|
|
||||||
```
|
|
||||||
|
|
||||||
We can also use a script to run the compatibility test for all the versions in a given range to give a quick report with all versions we need.
|
|
||||||
|
|
||||||
And we always bump the version in `Cargo.toml` to the next major release version, so the next major release version can be used as "latest" unpublished version for scenarios like local testing.
|
|
||||||
|
|
||||||
# Alternatives
|
|
||||||
|
|
||||||
There was a previous attempt to implement a compatibility test framework that was disabled due to some reasons [#3728](https://github.com/GreptimeTeam/greptimedb/issues/3728).
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
---
|
|
||||||
Feature Name: "global-gc-worker"
|
|
||||||
Tracking Issue: https://github.com/GreptimeTeam/greptimedb/issues/6571
|
|
||||||
Date: 2025-07-23
|
|
||||||
Author: "discord9 <discord9@163.com>"
|
|
||||||
---
|
|
||||||
|
|
||||||
# Global GC Worker
|
|
||||||
|
|
||||||
## Summary
|
|
||||||
|
|
||||||
This RFC proposes the integration of a garbage collection (GC) mechanism within the Compaction process. This mechanism aims to manage and remove stale files that are no longer actively used by any system component, thereby reclaiming storage space.
|
|
||||||
|
|
||||||
## Motivation
|
|
||||||
|
|
||||||
With the introduction of features such as table repartitioning, a substantial number of Parquet files can become obsolete. Furthermore, failures during manifest updates may result in orphaned files that are never referenced by the system. Therefore, a periodic garbage collection mechanism is essential to reclaim storage space by systematically removing these unused files.
|
|
||||||
|
|
||||||
## Details
|
|
||||||
|
|
||||||
### Overview
|
|
||||||
|
|
||||||
The garbage collection process will be integrated directly into the Compaction process. Upon the completion of a Compaction for a given region, the GC worker will be automatically triggered. Its primary function will be to identify and subsequently delete obsolete files that have persisted beyond their designated retention period. This integration ensures that garbage collection is performed in close conjunction with data lifecycle management, effectively leveraging the compaction process's inherent knowledge of file states.
|
|
||||||
|
|
||||||
This design prioritizes correctness and safety by explicitly linking GC execution to a well-defined operational boundary: the successful completion of a compaction cycle.
|
|
||||||
|
|
||||||
### Terminology
|
|
||||||
|
|
||||||
- **Unused File**: Refers to a file present in the storage directory that has never been formally recorded in any manifest. A common scenario for this includes cases where a new SST file is successfully written to storage, but the subsequent update to the manifest fails, leaving the file unreferenced.
|
|
||||||
- **Obsolete File**: Denotes a file that was previously recorded in a manifest but has since been explicitly marked for removal. This typically occurs following operations such as data repartitioning or compaction.
|
|
||||||
|
|
||||||
### GC Worker Process
|
|
||||||
|
|
||||||
The GC worker operates as an integral part of the Compaction process. Once a Compaction for a specific region is completed, the GC worker is automatically triggered. Executing this process on a `datanode` is preferred to eliminate the overhead associated with having to set object storage configurations in the `metasrv`.
|
|
||||||
|
|
||||||
The detailed process is as follows:
|
|
||||||
|
|
||||||
1. **Invocation**: Upon the successful completion of a Compaction for a region, the GC worker is invoked.
|
|
||||||
2. **Manifest Reading**: The worker reads the region's primary manifest to obtain a comprehensive list of all files marked as obsolete. Concurrently, it reads any temporary manifests generated by long-running queries to identify files that are currently in active use, thereby preventing their premature deletion.
|
|
||||||
3. **Lingering Time Check (Obsolete Files)**: For each identified obsolete file, the GC worker evaluates its "lingering time." Which is the time passed after it had been removed from manifest.
|
|
||||||
4. **Deletion Marking (Obsolete Files)**: Files that have exceeded their maximum configurable lingering time and are not referenced by any active temporary manifests are marked for deletion.
|
|
||||||
5. **Lingering Time (Unused Files)**: Unused files (those never recorded in any manifest) are also subject to a configurable maximum lingering time before they are eligible for deletion.
|
|
||||||
|
|
||||||
Following flowchart illustrates the GC worker's process:
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
flowchart TD
|
|
||||||
A[Compaction Completed] --> B[Trigger GC Worker]
|
|
||||||
B --> C[Scan Region Manifest]
|
|
||||||
C --> D[Identify File Types]
|
|
||||||
D --> E[Unused Files<br/>Never recorded in manifest]
|
|
||||||
D --> F[Obsolete Files<br/>Previously in manifest<br/>but marked for removal]
|
|
||||||
E --> G[Check Lingering Time]
|
|
||||||
F --> G
|
|
||||||
G --> H{File exceeds<br/>configured lingering time?}
|
|
||||||
H -->|No| I[Skip deletion]
|
|
||||||
H -->|Yes| J[Check Temporary Manifest]
|
|
||||||
J --> K{File in use by<br/>active queries?}
|
|
||||||
K -->|Yes| L[Retain file<br/>Wait for next GC cycle]
|
|
||||||
K -->|No| M[Safely delete file]
|
|
||||||
I --> N[End GC cycle]
|
|
||||||
L --> N
|
|
||||||
M --> O[Update Manifest]
|
|
||||||
O --> N
|
|
||||||
N --> P[Wait for next Compaction]
|
|
||||||
P --> A
|
|
||||||
style A fill:#e1f5fe
|
|
||||||
style B fill:#f3e5f5
|
|
||||||
style M fill:#e8f5e8
|
|
||||||
style L fill:#fff3e0
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Handling Obsolete Files
|
|
||||||
|
|
||||||
An obsolete file is permanently deleted only if two conditions are met:
|
|
||||||
1. The time elapsed since its removal from the manifest (its obsolescence timestamp) exceeds a configurable threshold.
|
|
||||||
2. It is not currently referenced by any active temporary manifests.
|
|
||||||
|
|
||||||
|
|
||||||
#### Handling Unused Files
|
|
||||||
|
|
||||||
With the integration of the GC worker into the Compaction process, the risk of accidentally deleting newly created SST files that have not yet been recorded in the manifest is significantly mitigated. Consequently, the concept of "Unused Files" as a distinct category primarily susceptible to accidental deletion is largely resolved. Any files that are genuinely "unused" (i.e., never referenced by any manifest, including temporary ones) can be safely deleted after a configurable maximum lingering time.
|
|
||||||
|
|
||||||
For debugging and auditing purposes, a comprehensive list of recently deleted files can be maintained.
|
|
||||||
|
|
||||||
### Ensuring Read Consistency
|
|
||||||
|
|
||||||
To prevent the GC worker from inadvertently deleting files that are actively being utilized by long-running analytical queries, a robust protection mechanism is introduced. This mechanism relies on temporary manifests that are actively kept "alive" by the queries using them.
|
|
||||||
|
|
||||||
When a long-running query is detected (e.g., by a slow query recorder), it will write a temporary manifest to the region's manifest directory. This manifest lists all files required for the query. However, simply creating this file is not enough, as a query runner might crash, leaving the temporary manifest orphaned and preventing garbage collection indefinitely.
|
|
||||||
|
|
||||||
To address this, the following "heartbeat" mechanism is implemented:
|
|
||||||
1. **Periodic Updates**: The process executing the long-running query is responsible for periodically updating the modification timestamp of its temporary manifest file (i.e., "touching" the file). This serves as a heartbeat, signaling that the query is still active.
|
|
||||||
2. **GC Worker Verification**: When the GC worker runs, it scans for temporary manifests. For each one it finds, it checks the file's last modification time.
|
|
||||||
3. **Stale File Handling**: If a temporary manifest's last modification time is older than a configurable threshold, the GC worker considers it stale (left over from a crashed or terminated query). The GC worker will then delete this stale temporary manifest. Files that were protected only by this stale manifest are no longer shielded from garbage collection.
|
|
||||||
|
|
||||||
This approach ensures that only files for genuinely active queries are protected. The lifecycle of the temporary manifest is managed dynamically: it is created when a long query starts, kept alive through periodic updates, and is either deleted by the query upon normal completion or automatically cleaned up by the GC worker if the query terminates unexpectedly.
|
|
||||||
|
|
||||||
This mechanism may be too complex to implement at once. We can consider a two-phased approach:
|
|
||||||
1. **Phase 1 (Simple Time-Based Deletion)**: Initially, implement a simpler GC strategy that deletes obsolete files based solely on a configurable lingering time. This provides a baseline for space reclamation without the complexity of temporary manifests.
|
|
||||||
2. **Phase 2 (Consistency-Aware GC)**: Based on the practical effectiveness and observed issues from Phase 1, we can then decide whether to implement the full temporary manifest and heartbeat mechanism to handle long-running queries. This iterative approach allows for a quicker initial implementation while gathering real-world data to justify the need for a more complex solution.
|
|
||||||
|
|
||||||
## Drawbacks
|
|
||||||
|
|
||||||
- **Dependency on Compaction Frequency**: The integration of the GC worker with Compaction means that GC cycles are directly tied to the frequency of compactions. In environments with infrequent compaction operations, obsolete files may accumulate for extended periods before being reclaimed, potentially leading to increased storage consumption.
|
|
||||||
- **Race Condition with Long-Running Queries**: A potential race condition exists if a long-running query initiates but haven't write its temporary manifest in time, while a compaction process simultaneously begins and marks files used by that query as obsolete. This scenario could lead to the premature deletion of files still required by the active query. To mitigate this, the threshold time for writing a temporary manifest should be significantly shorter than the lingering time configured for obsolete files, ensuring that next GC worker runs do not delete files that are now referenced by a temporary manifest if the query is still running.
|
|
||||||
Also the read replica shouldn't be later in manifest version for more than the lingering time of obsolete files, otherwise it might ref to files that are already deleted by the GC worker.
|
|
||||||
- need to upload tmp manifest to object storage, which may introduce additional complexity and potential performance overhead. But since long-running queries are typically not frequent, the performance impact is expected to be minimal.
|
|
||||||
|
|
||||||
one potential race condition with region-migration is illustrated below:
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant gc_worker as GC Worker(same dn as region 1)
|
|
||||||
participant region1 as Region 1 (Leader → Follower)
|
|
||||||
participant region2 as Region 2 (Follower → Leader)
|
|
||||||
participant region_dir as Region Directory
|
|
||||||
|
|
||||||
gc_worker->>region1: Start GC, get region manifest
|
|
||||||
activate region1
|
|
||||||
region1-->>gc_worker: Region 1 manifest
|
|
||||||
deactivate region1
|
|
||||||
gc_worker->>region_dir: Scan region directory
|
|
||||||
|
|
||||||
Note over region1,region2: Region Migration Occurs
|
|
||||||
region1-->>region2: Downgrade to Follower
|
|
||||||
region2-->>region1: Becomes Leader
|
|
||||||
|
|
||||||
region2->>region_dir: Add new file
|
|
||||||
|
|
||||||
gc_worker->>region_dir: Continue scanning
|
|
||||||
gc_worker-->>region_dir: Discovers new file
|
|
||||||
Note over gc_worker: New file not in Region 1's manifest
|
|
||||||
gc_worker->>gc_worker: Mark file as orphan(incorrectly)
|
|
||||||
```
|
|
||||||
which could cause gc worker to incorrectly mark the new file as orphan and delete it, if config the lingering time for orphan files(files not mentioned anywhere(in used or unused)) is not long enough.
|
|
||||||
|
|
||||||
A good enough solution could be to use lock to prevent gc worker to happen on the region if region migration is happening on the region, and vise versa.
|
|
||||||
|
|
||||||
The race condition between gc worker and repartition also needs to be considered carefully. For now, acquiring lock for both region-migration and repartition during gc worker process could be a simple solution.
|
|
||||||
|
|
||||||
## Conclusion and Rationale
|
|
||||||
|
|
||||||
This section summarizes the key aspects and trade-offs of the proposed integrated GC worker, highlighting its advantages and potential challenges.
|
|
||||||
|
|
||||||
| Aspect | Current Proposal (Integrated GC) |
|
|
||||||
| :--- | :--- |
|
|
||||||
| **Implementation Complexity** | **Medium**. Requires careful integration with the compaction process and the slow query recorder for temporary manifest management. |
|
|
||||||
| **Reliability** | **High**. Integration with compaction and leveraging temporary manifests from long-running queries significantly mitigates the risk of incorrect deletion. Accurate management of lingering times for obsolete files and prevention of accidental deletion of newly created SSTs enhance data safety. |
|
|
||||||
| **Performance Overhead** | **Low to Medium**. The GC worker runs post-compaction, minimizing direct impact on write paths. Overhead from temporary manifest management by the slow query recorder is expected to be acceptable for long-running queries. |
|
|
||||||
| **Impact on Other Components** | **Moderate**. Requires modifications to the compaction process to trigger GC and the slow query recorder to manage temporary manifests. This introduces some coupling but enhances overall data safety. |
|
|
||||||
| **Deletion Strategy** | **State- and Time-Based**. Obsolete files are deleted based on a configurable lingering time, which is paused if the file is referenced by a temporary manifest. Unused files (never in a manifest) are also subject to a lingering time. |
|
|
||||||
|
|
||||||
## Unresolved Questions and Future Work
|
|
||||||
|
|
||||||
This section outlines key areas requiring further discussion and defines potential avenues for future development.
|
|
||||||
|
|
||||||
* **Slow Query Recorder Implementation**: Detailed specifications for modify slow query recorder's implementation and its precise interaction mechanisms with temporary manifests are needed.
|
|
||||||
* **Configurable Lingering Times**: Establish and make configurable the specific lingering times for both obsolete and unused files to optimize storage reclamation and data availability.
|
|
||||||
|
|
||||||
## Alternatives
|
|
||||||
|
|
||||||
### 1. Standalone GC Service
|
|
||||||
|
|
||||||
Instead of integrating the GC worker directly into the Compaction process, a standalone GC service could be implemented. This service would operate independently, periodically scanning the storage for obsolete and unused files based on manifest information and predefined retention policies.
|
|
||||||
|
|
||||||
**Pros:**
|
|
||||||
* **Decoupling**: Separates GC logic from compaction, allowing independent scaling and deployment.
|
|
||||||
* **Flexibility**: Can be configured to run at different frequencies and with different strategies than compaction.
|
|
||||||
|
|
||||||
**Cons:**
|
|
||||||
* **Increased Complexity**: Requires a separate service to manage, monitor, and coordinate with other components.
|
|
||||||
* **Potential for Redundancy**: May duplicate some file scanning logic already present in compaction.
|
|
||||||
* **Consistency Challenges**: Ensuring read consistency would require more complex coordination mechanisms between the standalone GC service and active queries, potentially involving a distributed lock manager or a more sophisticated temporary manifest system.
|
|
||||||
|
|
||||||
This alternative could be implemented in the future if the integrated GC worker proves insufficient or if there is a need for more advanced GC strategies.
|
|
||||||
|
|
||||||
### 2. Manifest-Driven Deletion (No Lingering Time)
|
|
||||||
|
|
||||||
This alternative would involve immediate deletion of files once they are removed from the manifest, without a lingering time.
|
|
||||||
|
|
||||||
**Pros:**
|
|
||||||
* **Simplicity**: Simplifies the GC logic by removing the need for lingering time management.
|
|
||||||
* **Immediate Space Reclamation**: Storage space is reclaimed as soon as files are marked for deletion.
|
|
||||||
|
|
||||||
**Cons:**
|
|
||||||
* **Increased Risk of Data Loss**: Higher risk of deleting files still in use by long-running queries or other processes if not perfectly synchronized.
|
|
||||||
* **Complex Read Consistency**: Requires extremely robust and immediate mechanisms to ensure that no active queries are referencing files marked for deletion, potentially leading to performance bottlenecks or complex error handling.
|
|
||||||
* **Debugging Challenges**: Difficult to debug issues related to premature file deletion due to the immediate nature of the operation.
|
|
||||||
@@ -1,112 +0,0 @@
|
|||||||
---
|
|
||||||
Feature Name: Async Index Build
|
|
||||||
Tracking Issue: https://github.com/GreptimeTeam/greptimedb/issues/6756
|
|
||||||
Date: 2025-08-16
|
|
||||||
Author: "SNC123 <sinhco@outlook.com>"
|
|
||||||
---
|
|
||||||
|
|
||||||
# Summary
|
|
||||||
This RFC proposes an asynchronous index build mechanism in the database, with a configuration option to choose between synchronous and asynchronous modes, aiming to improve flexibility and adapt to different workload requirements.
|
|
||||||
|
|
||||||
# Motivation
|
|
||||||
Currently, index creation is performed synchronously, which may lead to prolonged write suspension and impact business continuity. As data volume grows, the time required for index building increases significantly. An asynchronous solution is urgently needed to enhance user experience and system throughput.
|
|
||||||
|
|
||||||
# Details
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
The following table highlights the difference between async and sync index approach:
|
|
||||||
|
|
||||||
| Approach | Trigger | Data Source | Additional Index Metadata Installation | Fine-grained `FileMeta` Index |
|
|
||||||
| :--- | :--- | :--- | :--- | :--- |
|
|
||||||
| Sync Index | On `write_sst` | Memory (on flush) / Disk (on compact) | Not required(already installed synchronously) | Not required |
|
|
||||||
| Async Index | 4 trigger types | Disk | Required | Required |
|
|
||||||
|
|
||||||
The index build mode (synchronous or asynchronous) can be selected via configuration file.
|
|
||||||
|
|
||||||
### Four Trigger Types
|
|
||||||
|
|
||||||
This RFC introduces four `IndexBuildType`s to trigger index building:
|
|
||||||
|
|
||||||
- **Manual Rebuild**: Triggered by the user via `ADMIN build_index("table_name")`, for scenarios like recovering from failed builds or migrating data. SST files whose `ColumnIndexMetadata` (see below) is already consistent with the `RegionMetadata` will be skipped.
|
|
||||||
- **Schema Change**: Automatically triggered when the schema of an indexed column is altered.
|
|
||||||
- **Flush**: Automatically builds indexes for new SST files created by a flush.
|
|
||||||
- **Compact**: Automatically builds indexes for new SST files created by a compaction.
|
|
||||||
|
|
||||||
### Additional Index Metadata Installation
|
|
||||||
|
|
||||||
Previously, index information in the in-memory `FileMeta` was updated synchronously. The async approach requires an explicit installation step.
|
|
||||||
|
|
||||||
A race condition can occur when compaction and index building run concurrently, leading to:
|
|
||||||
1. Building an index for a file that is about to be deleted by compaction.
|
|
||||||
2. Creating an unnecessary index file and an incorrect manifest record.
|
|
||||||
3. On restart, replaying the manifest could load metadata for a non-existent file.
|
|
||||||
|
|
||||||
To prevent this, the system checks if a file's `FileMeta` is in a `compacting` state before updating the manifest. If it is, the installation is aborted.
|
|
||||||
|
|
||||||
### Fine-grained `FileMeta` Index
|
|
||||||
|
|
||||||
The original `FileMeta` only stored file-level index information. However, manual rebuilds require column-level details to identify files inconsistent with the current DDL. Therefore, the `indexes` field in `FileMeta` is updated as follows:
|
|
||||||
```rust
|
|
||||||
struct FileMeta {
|
|
||||||
...
|
|
||||||
// From file-level:
|
|
||||||
// available_indexes: SmallVec<[IndexType; 4]>
|
|
||||||
// To column-level:
|
|
||||||
indexes: Vec<ColumnIndexMetadata>,
|
|
||||||
...
|
|
||||||
}
|
|
||||||
pub struct ColumnIndexMetadata {
|
|
||||||
pub column_id: ColumnId,
|
|
||||||
pub created_indexes: IndexTypes,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Process
|
|
||||||
|
|
||||||
The index building process is similar to a flush and is illustrated below:
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
Region0->>Region0: Triggered by one of 4 conditions, targets specific files
|
|
||||||
loop For each target file
|
|
||||||
Region0->>IndexBuildScheduler: Submits an index build task
|
|
||||||
end
|
|
||||||
IndexBuildScheduler->>IndexBuildTask: Executes the task
|
|
||||||
IndexBuildTask->>Storage Interfaces: Reads SST data from disk
|
|
||||||
IndexBuildTask->>IndexBuildTask: Builds the index file
|
|
||||||
alt Index file size > 0
|
|
||||||
IndexBuildTask->>Region0: Sends IndexBuildFinished notification
|
|
||||||
end
|
|
||||||
alt File exists in Version and is not compacting
|
|
||||||
Region0->>Storage Interfaces: Updates manifest and Version
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
### Task Triggering and Scheduling
|
|
||||||
|
|
||||||
The process starts with one of the four `IndexBuildType` triggers. In `handle_rebuild_index`, the `RegionWorkerLoop` identifies target SSTs from the request or the current region version. It then creates an `IndexBuildTask` for each file and submits it to the `index_build_scheduler`.
|
|
||||||
|
|
||||||
Similar to Flush and Compact operations, index build tasks are ultimately dispatched to the LocalScheduler. Resource usage can be adjusted via configuration files. Since asynchronous index tasks are both memory-intensive and IO-intensive but have lower priority, it is recommended to allocate fewer resources to them compared to compaction and flush tasks—for example, limiting them to 1/8 of the CPU cores.
|
|
||||||
|
|
||||||
### Index Building and Notification
|
|
||||||
|
|
||||||
The scheduled `IndexBuildTask` executes its `index_build` method. It uses an `indexer_builder` to create an `Indexer` that reads SST data and builds the index. If a new index file is created (`IndexOutput.file_size > 0`), the task sends an `IndexBuildFinished` notification back to the `RegionWorkerLoop`.
|
|
||||||
|
|
||||||
### Index Metadata Installation
|
|
||||||
|
|
||||||
Upon receiving the `IndexBuildFinished` notification in `handle_index_build_finished`, the `RegionWorkerLoop` verifies that the file still exists in the current `version` and is not being compacted. If the check passes, it calls `manifest_ctx.update_manifest` to apply a `RegionEdit` with the new index information, completing the installation.
|
|
||||||
|
|
||||||
# Drawbacks
|
|
||||||
|
|
||||||
Asynchronous index building may consume extra system resources, potentially affecting overall performance during peak periods.
|
|
||||||
|
|
||||||
There may be a delay before the new index becomes available for queries, which could impact certain use cases.
|
|
||||||
|
|
||||||
# Unresolved Questions and Future Work
|
|
||||||
|
|
||||||
**Resource Management and Throttling**: The resource consumption (CPU, I/O) of background index building can be managed and limited to some extent by configuring a dedicated background thread pool. However, this approach cannot fully eliminate resource contention, especially under heavy workloads or when I/O is highly competitive. Additional throttling mechanisms or dynamic prioritization may still be necessary to avoid impacting foreground operations.
|
|
||||||
|
|
||||||
# Alternatives
|
|
||||||
|
|
||||||
Instead of being triggered by events like Flush or Compact, index building could be performed in batches during scheduled maintenance windows. This offers predictable resource usage but delays index availability.
|
|
||||||
@@ -1,463 +0,0 @@
|
|||||||
---
|
|
||||||
Feature Name: "laminar-flow"
|
|
||||||
Tracking Issue: https://github.com/GreptimeTeam/greptimedb/issues/TBD
|
|
||||||
Date: 2025-09-08
|
|
||||||
Author: "discord9 <discord9@163.com>"
|
|
||||||
---
|
|
||||||
|
|
||||||
# laminar Flow
|
|
||||||
|
|
||||||
## Summary
|
|
||||||
|
|
||||||
This RFC proposes a redesign of the flow architecture where flownode becomes a lightweight in-memory state management node with an embedded frontend for direct computation. This approach optimizes resource utilization and improves scalability by eliminating network hops while maintaining clear separation between coordination and computation tasks.
|
|
||||||
|
|
||||||
## Motivation
|
|
||||||
|
|
||||||
The current flow architecture has several limitations:
|
|
||||||
|
|
||||||
1. **Resource Inefficiency**: Flownodes perform both state management and computation, leading to resource duplication and inefficient utilization.
|
|
||||||
2. **Scalability Constraints**: Computation resources are tied to flownode instances, limiting horizontal scaling capabilities.
|
|
||||||
3. **State Management Complexity**: Mixing computation with state management makes the system harder to maintain and debug.
|
|
||||||
4. **Network Overhead**: Additional network hops between flownode and separate frontend nodes add latency.
|
|
||||||
|
|
||||||
The laminar Flow architecture addresses these issues by:
|
|
||||||
- Consolidating computation within flownode through embedded frontend
|
|
||||||
- Eliminating network overhead by removing separate frontend node communication
|
|
||||||
- Simplifying state management by focusing flownode on its core responsibility
|
|
||||||
- Improving system scalability and maintainability
|
|
||||||
|
|
||||||
## Details
|
|
||||||
|
|
||||||
### Architecture Overview
|
|
||||||
|
|
||||||
The laminar Flow architecture transforms flownode into a lightweight coordinator that maintains flow state with an embedded frontend for computation. The key components involved are:
|
|
||||||
|
|
||||||
1. **Flownode**: Maintains in-memory state, coordinates computation, and includes an embedded frontend for query execution
|
|
||||||
2. **Embedded Frontend**: Executes **incremental** computations within the flownode
|
|
||||||
3. **Datanode**: Stores final results and source data
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
graph TB
|
|
||||||
subgraph "laminar Flow Architecture"
|
|
||||||
subgraph Flownode["Flownode (State Manager + Embedded Frontend)"]
|
|
||||||
StateMap["Flow State Map<br/>Map<Timestamp, (Map<Key, Value>, Sequence)>"]
|
|
||||||
Coordinator["Computation Coordinator"]
|
|
||||||
subgraph EmbeddedFrontend["Embedded Frontend"]
|
|
||||||
QueryEngine["Query Engine"]
|
|
||||||
AggrState["__aggr_state Executor"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
subgraph Datanode["Datanode"]
|
|
||||||
Storage["Data Storage"]
|
|
||||||
Results["Result Tables"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
Coordinator -->|Internal Query| EmbeddedFrontend
|
|
||||||
EmbeddedFrontend -->|Incremental States| Coordinator
|
|
||||||
Flownode -->|Incremental Results| Datanode
|
|
||||||
EmbeddedFrontend -.->|Read Data| Datanode
|
|
||||||
```
|
|
||||||
|
|
||||||
### Core Components
|
|
||||||
|
|
||||||
#### 1. Flow State Management
|
|
||||||
|
|
||||||
Flownode maintains a state map for each flow:
|
|
||||||
|
|
||||||
```rust
|
|
||||||
type FlowState = Map<Timestamp, (Map<Key, Value>, Sequence)>;
|
|
||||||
```
|
|
||||||
|
|
||||||
Where:
|
|
||||||
- **Timestamp**: Time window identifier for aggregation groups
|
|
||||||
- **Key**: Aggregation group expressions (`group_exprs`)
|
|
||||||
- **Value**: Aggregation expressions results (`aggr_exprs`)
|
|
||||||
- **Sequence**: Computation progress marker for incremental updates
|
|
||||||
|
|
||||||
#### 2. Incremental Computation Process
|
|
||||||
|
|
||||||
The computation process follows these steps:
|
|
||||||
|
|
||||||
1. **Trigger Evaluation**: Flownode determines when to trigger computation based on:
|
|
||||||
- Time intervals (periodic updates)
|
|
||||||
- Data volume thresholds
|
|
||||||
- Sequence progress requirements
|
|
||||||
|
|
||||||
2. **Query Execution**: Flownode executes `__aggr_state` queries using its embedded frontend with:
|
|
||||||
- Time window filters
|
|
||||||
- Sequence range constraints
|
|
||||||
|
|
||||||
3. **State Update**: Flownode receives partial state results and updates its internal state:
|
|
||||||
- Merges new values with existing aggregation state
|
|
||||||
- Updates sequence markers to track progress
|
|
||||||
- Identifies changed time windows for result computation
|
|
||||||
|
|
||||||
4. **Result Materialization**: Flownode computes final results using `__aggr_merge` operations:
|
|
||||||
- Processes only updated time windows(and time series) for efficiency
|
|
||||||
- Writes results back to datanode directly through its embedded frontend
|
|
||||||
|
|
||||||
### Detailed Workflow
|
|
||||||
|
|
||||||
#### Incremental State Query
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- Example incremental state query executed by embedded frontend
|
|
||||||
SELECT
|
|
||||||
__aggr_state(avg(value)) as state,
|
|
||||||
time_window,
|
|
||||||
group_key
|
|
||||||
FROM source_table
|
|
||||||
WHERE
|
|
||||||
timestamp >= :window_start
|
|
||||||
AND timestamp < :window_end
|
|
||||||
AND __sequence >= :last_sequence
|
|
||||||
AND __sequence < :current_sequence
|
|
||||||
-- sequence range is actually written in grpc header, but shown here for clarity
|
|
||||||
GROUP BY time_window, group_key;
|
|
||||||
```
|
|
||||||
|
|
||||||
#### State Merge Process
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
sequenceDiagram
|
|
||||||
participant F as Flownode (Coordinator)
|
|
||||||
participant EF as Embedded Frontend (Lightweight)
|
|
||||||
participant DN as Datanode (Heavy Computation)
|
|
||||||
|
|
||||||
F->>F: Evaluate trigger conditions
|
|
||||||
F->>EF: Execute __aggr_state query with sequence range
|
|
||||||
EF->>DN: Send query to datanode (Heavy scan & aggregation)
|
|
||||||
DN->>DN: Scan data and compute partial aggregation state (Heavy CPU/I/O)
|
|
||||||
DN->>EF: Return aggregated state results
|
|
||||||
EF->>F: Forward state results (Lightweight merge)
|
|
||||||
F->>F: Merge with existing state
|
|
||||||
F->>F: Update sequence markers (Lightweight)
|
|
||||||
F->>EF: Compute incremental results with __aggr_merge
|
|
||||||
EF->>DN: Write incremental results to datanode
|
|
||||||
```
|
|
||||||
|
|
||||||
### Refill Implementation and State Management
|
|
||||||
|
|
||||||
#### Refill Process
|
|
||||||
|
|
||||||
Refill is implemented as a straightforward `__aggr_state` query with time and sequence constraints:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- Refill query for flow state recovery
|
|
||||||
SELECT
|
|
||||||
__aggr_state(aggregation_functions) as state,
|
|
||||||
time_window,
|
|
||||||
group_keys
|
|
||||||
FROM source_table
|
|
||||||
WHERE
|
|
||||||
timestamp >= :refill_start_time
|
|
||||||
AND timestamp < :refill_end_time
|
|
||||||
AND __sequence >= :start_sequence
|
|
||||||
AND __sequence < :end_sequence
|
|
||||||
-- sequence range is actually written in grpc header, but shown here for clarity
|
|
||||||
GROUP BY time_window, group_keys;
|
|
||||||
```
|
|
||||||
|
|
||||||
#### State Recovery Strategy
|
|
||||||
|
|
||||||
1. **Recent Data (Stream Mode)**: For recent time windows, flownode refills state using incremental queries
|
|
||||||
2. **Historical Data (Batch Mode)**: For older time windows, flownode triggers batch computation directly and no need to refill state
|
|
||||||
3. **Hybrid Approach**: Combines stream and batch processing based on data age and availability
|
|
||||||
|
|
||||||
#### Mirror Write Optimization
|
|
||||||
|
|
||||||
Mirror writes are simplified to only transmit timestamps to flownode:
|
|
||||||
|
|
||||||
```rust
|
|
||||||
struct MirrorWrite {
|
|
||||||
timestamps: Vec<Timestamp>,
|
|
||||||
// Removed: actual data payload
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This optimization:
|
|
||||||
- Eliminates network overhead by using embedded frontend
|
|
||||||
- Enables flownode to track pending time windows efficiently
|
|
||||||
- Allows flownode to decide processing mode (stream vs batch) based on timestamp age
|
|
||||||
|
|
||||||
Another optimization could be just send dirty time windows range for each flow to flownode directly, no need to send timestamps one by one.
|
|
||||||
|
|
||||||
### Query Optimization Strategies
|
|
||||||
|
|
||||||
#### Sequence-Based Incremental Processing
|
|
||||||
|
|
||||||
The core optimization relies on sequence-constrained queries:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- Optimized incremental query
|
|
||||||
SELECT __aggr_state(expr)
|
|
||||||
FROM table
|
|
||||||
WHERE time_range AND sequence_range
|
|
||||||
```
|
|
||||||
|
|
||||||
Benefits:
|
|
||||||
- **Reduced Scan Volume**: Only processes data since last computation
|
|
||||||
- **Efficient Resource Usage**: Minimizes CPU and I/O overhead
|
|
||||||
- **Predictable Performance**: Query cost scales with incremental data size
|
|
||||||
|
|
||||||
#### Time Window Partitioning
|
|
||||||
|
|
||||||
```mermaid
|
|
||||||
graph LR
|
|
||||||
subgraph "Time Windows"
|
|
||||||
W1["Window 1<br/>09:00-09:05"]
|
|
||||||
W2["Window 2<br/>09:05-09:10"]
|
|
||||||
W3["Window 3<br/>09:10-09:15"]
|
|
||||||
end
|
|
||||||
|
|
||||||
subgraph "Processing Strategy"
|
|
||||||
W1 --> Batch["Batch Mode<br/>(Old Data)"]
|
|
||||||
W2 --> Stream["Stream Mode<br/>(Recent Data)"]
|
|
||||||
W3 --> Stream2["Stream Mode<br/>(Current Data)"]
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
### Performance Characteristics
|
|
||||||
|
|
||||||
#### Memory Usage
|
|
||||||
|
|
||||||
- **Flownode**: O(active_time_windows × group_cardinality) for state storage
|
|
||||||
- **Embedded Frontend**: O(query_batch_size) for temporary computation
|
|
||||||
- **Overall**: Significantly reduced compared to current architecture
|
|
||||||
|
|
||||||
#### Computation Distribution
|
|
||||||
|
|
||||||
- **Direct Processing**: Queries processed directly within flownode's embedded frontend
|
|
||||||
- **Fault Tolerance**: Simplified error handling with fewer distributed components
|
|
||||||
- **Scalability**: Computation capacity scales with flownode instances
|
|
||||||
|
|
||||||
#### Network Optimization
|
|
||||||
|
|
||||||
- **Reduced Payload**: Mirror writes only contain timestamps
|
|
||||||
- **Efficient Queries**: Sequence constraints minimize data transfer
|
|
||||||
- **Result Caching**: State results cached in flownode memory
|
|
||||||
|
|
||||||
### Sequential Read Implementation for Incremental Queries
|
|
||||||
|
|
||||||
#### Sequence Management
|
|
||||||
|
|
||||||
Flow maintains two critical sequences to track incremental query progress for each region:
|
|
||||||
|
|
||||||
- **`memtable_last_seq`**: Tracks the latest sequence number read from the memtable
|
|
||||||
- **`sst_last_seq`**: Tracks the latest sequence number read from SST files
|
|
||||||
|
|
||||||
These sequences enable precise incremental data processing by defining the exact range of data to query in subsequent iterations.
|
|
||||||
|
|
||||||
#### Query Protocol
|
|
||||||
|
|
||||||
When executing incremental queries, flownode provides both sequence parameters to datanode:
|
|
||||||
|
|
||||||
```rust
|
|
||||||
struct GrpcHeader {
|
|
||||||
...
|
|
||||||
// Sequence tracking for incremental reads
|
|
||||||
memtable_last_seq: HashMap<RegionId, SequenceNumber>,
|
|
||||||
sst_last_seqs: HashMap<RegionId, SequenceNumber>,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The datanode processes these parameters to return only the data within the specified sequence ranges, ensuring efficient incremental processing.
|
|
||||||
|
|
||||||
#### Sequence Invalidation and Refill Mechanism
|
|
||||||
|
|
||||||
A critical challenge occurs when data referenced by `memtable_last_seq` gets flushed from memory to disk. Since SST files only maintain a single maximum sequence number for the entire file (rather than per-record sequence tracking), precise incremental queries become impossible for the affected time ranges.
|
|
||||||
|
|
||||||
**Detection of Invalidation:**
|
|
||||||
```rust
|
|
||||||
// When memtable_last_seq data has been flushed to SST
|
|
||||||
if memtable_last_seq_flushed_to_disk {
|
|
||||||
// Incremental query is no longer feasible
|
|
||||||
// Need to trigger refill for affected time ranges
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Refill Process:**
|
|
||||||
1. **Identify Affected Time Range**: Query the time range corresponding to the flushed `memtable_last_seq` data
|
|
||||||
2. **Full Recomputation**: Execute a complete aggregation query for the affected time windows
|
|
||||||
3. **State Replacement**: Replace the existing flow state for these time ranges with newly computed values
|
|
||||||
4. **Sequence Update**: Update `memtable_last_seq` to the current latest sequence, while `sst_last_seq` continues normal incremental updates
|
|
||||||
|
|
||||||
```sql
|
|
||||||
-- Refill query when memtable data has been flushed
|
|
||||||
SELECT
|
|
||||||
__aggr_state(aggregation_functions) as state,
|
|
||||||
time_window,
|
|
||||||
group_keys
|
|
||||||
FROM source_table
|
|
||||||
WHERE
|
|
||||||
timestamp >= :affected_time_start
|
|
||||||
AND timestamp < :affected_time_end
|
|
||||||
-- Full scan required since sequence precision is lost in SST
|
|
||||||
GROUP BY time_window, group_keys;
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Datanode Implementation Requirements
|
|
||||||
|
|
||||||
Datanode must implement enhanced query processing capabilities to support sequence-based incremental reads:
|
|
||||||
|
|
||||||
**Input Processing:**
|
|
||||||
- Accept `memtable_last_seq` and `sst_last_seq` parameters in query requests
|
|
||||||
- Filter data based on sequence ranges across both memtable and SST storage layers
|
|
||||||
|
|
||||||
**Output Enhancement:**
|
|
||||||
```rust
|
|
||||||
struct OutputMeta {
|
|
||||||
pub plan: Option<Arc<dyn ExecutionPlan>>,
|
|
||||||
pub cost: OutputCost,
|
|
||||||
pub sequence_info: HashMap<RegionId, SequenceInfo>, // New field for sequence tracking per regions involved in the query
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SequenceInfo {
|
|
||||||
// Sequence tracking for next iteration
|
|
||||||
max_memtable_seq: SequenceNumber, // Highest sequence from memtable in this result
|
|
||||||
max_sst_seq: SequenceNumber, // Highest sequence from SST in this result
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
**Sequence Tracking Logic:**
|
|
||||||
datanode already impl `max_sst_seq` in leader range read, can reuse similar logic for `max_memtable_seq`.
|
|
||||||
|
|
||||||
#### Sequence Update Strategy
|
|
||||||
|
|
||||||
**Normal Incremental Updates:**
|
|
||||||
- Update both `memtable_last_seq` and `sst_last_seq` after successful query execution
|
|
||||||
- Use returned `max_memtable_seq` and `max_sst_seq` values for next iteration
|
|
||||||
|
|
||||||
**Refill Scenario:**
|
|
||||||
- Reset `memtable_last_seq` to current maximum after refill completion
|
|
||||||
- Continue normal `sst_last_seq` updates based on successful query responses
|
|
||||||
- Maintain separate tracking to detect future flush events
|
|
||||||
|
|
||||||
#### Performance Considerations
|
|
||||||
|
|
||||||
**Sequence Range Optimization:**
|
|
||||||
- Minimize sequence range spans to reduce scan overhead
|
|
||||||
- Batch multiple small incremental updates when beneficial
|
|
||||||
- Balance between query frequency and processing efficiency
|
|
||||||
|
|
||||||
**Memory Management:**
|
|
||||||
- Monitor memtable flush frequency to predict refill requirements
|
|
||||||
- Implement adaptive query scheduling based on flush patterns
|
|
||||||
- Optimize state storage to handle frequent updates efficiently
|
|
||||||
|
|
||||||
This sequential read implementation ensures reliable incremental processing while gracefully handling the complexities of storage architecture, maintaining both correctness and performance in the face of background compaction and flush operations.
|
|
||||||
|
|
||||||
## Implementation Plan
|
|
||||||
|
|
||||||
### Phase 1: Core Infrastructure
|
|
||||||
|
|
||||||
1. **State Management**: Implement in-memory state map in flownode
|
|
||||||
2. **Query Interface**: Integrate `__aggr_state` query interface in embedded frontend(Already done in previous query pushdown optimizer work)
|
|
||||||
3. **Basic Coordination**: Implement query dispatch and result collection
|
|
||||||
4. **Sequence Tracking**: Implement sequence-based incremental processing(Can use similar interface which leader range read use)
|
|
||||||
|
|
||||||
After phase 1, the system should support basic flow operations with incremental updates.
|
|
||||||
|
|
||||||
### Phase 2: Optimization Features
|
|
||||||
|
|
||||||
1. **Refill Logic**: Develop state recovery mechanisms
|
|
||||||
2. **Mirror Write Optimization**: Simplify mirror write protocol
|
|
||||||
|
|
||||||
### Phase 3: Advanced Features
|
|
||||||
|
|
||||||
1. **Load Balancing**: Implement intelligent resource allocation for partitioned flow(Flow distributed executed on multiple flownodes)
|
|
||||||
2. **Fault Tolerance**: Add retry mechanisms and error handling
|
|
||||||
3. **Performance Tuning**: Optimize query batching and state management
|
|
||||||
|
|
||||||
## Drawbacks
|
|
||||||
|
|
||||||
### Reduced Network Communication
|
|
||||||
|
|
||||||
- **Eliminated Hops**: Direct communication between flownode and datanode through embedded frontend
|
|
||||||
- **Reduced Latency**: No separate frontend node communication overhead
|
|
||||||
- **Simplified Network Topology**: Fewer network dependencies and failure points
|
|
||||||
|
|
||||||
### Complexity in Error Handling
|
|
||||||
|
|
||||||
- **Distributed Failures**: Need to handle failures across multiple components
|
|
||||||
- **State Consistency**: Ensuring state consistency during partial failures
|
|
||||||
- **Recovery Complexity**: More complex recovery procedures
|
|
||||||
|
|
||||||
### Datanode Resource Requirements
|
|
||||||
|
|
||||||
- **Computation Load**: Datanode handles the heavy computational workload for flow queries
|
|
||||||
- **Query Interference**: Flow queries may impact regular query performance on datanode
|
|
||||||
- **Resource Contention**: Need careful resource management and isolation on datanode
|
|
||||||
|
|
||||||
## Alternatives
|
|
||||||
|
|
||||||
### Alternative 1: Enhanced Current Architecture
|
|
||||||
|
|
||||||
Keep computation in flownode but optimize through:
|
|
||||||
- Better resource management
|
|
||||||
- Improved query optimization
|
|
||||||
- Enhanced state persistence
|
|
||||||
|
|
||||||
**Pros:**
|
|
||||||
- Simpler architecture
|
|
||||||
- Fewer network hops
|
|
||||||
- Easier debugging
|
|
||||||
|
|
||||||
**Cons:**
|
|
||||||
- Limited scalability
|
|
||||||
- Resource inefficiency
|
|
||||||
- Harder to optimize computation distribution
|
|
||||||
|
|
||||||
### Alternative 2: Embedded Computation
|
|
||||||
|
|
||||||
Embed lightweight computation engines within flownode:
|
|
||||||
|
|
||||||
**Pros:**
|
|
||||||
- Reduced network communication
|
|
||||||
- Better performance for simple queries
|
|
||||||
- Simpler deployment
|
|
||||||
|
|
||||||
**Cons:**
|
|
||||||
- Limited scalability
|
|
||||||
- Resource constraints
|
|
||||||
- Harder to leverage existing frontend optimizations
|
|
||||||
|
|
||||||
## Future Work
|
|
||||||
|
|
||||||
### Advanced Query Optimization
|
|
||||||
|
|
||||||
- **Parallel Processing**: Enable parallel execution of flow queries
|
|
||||||
- **Query Caching**: Cache frequently executed query patterns
|
|
||||||
|
|
||||||
### Enhanced State Management
|
|
||||||
|
|
||||||
- **State Compression**: Implement efficient state serialization
|
|
||||||
- **Distributed State**: Support state distribution across multiple flownodes
|
|
||||||
- **State Persistence**: Add optional state persistence for durability
|
|
||||||
|
|
||||||
### Monitoring and Observability
|
|
||||||
|
|
||||||
- **Performance Metrics**: Track query execution times and resource usage
|
|
||||||
- **State Visualization**: Provide tools for state inspection and debugging
|
|
||||||
- **Health Monitoring**: Monitor system health and performance characteristics
|
|
||||||
|
|
||||||
### Integration Improvements
|
|
||||||
|
|
||||||
- **Embedded Frontend Optimization**: Optimize embedded frontend query planning and execution
|
|
||||||
- **Datanode Optimization**: Optimize result writing from flownode
|
|
||||||
- **Metasrv Coordination**: Enhanced metadata management and coordination
|
|
||||||
|
|
||||||
## Conclusion
|
|
||||||
|
|
||||||
The laminar Flow architecture represents a significant improvement over the current flow system by separating state management from computation execution. This design enables better resource utilization, improved scalability, and simplified maintenance while maintaining the core functionality of continuous aggregation.
|
|
||||||
|
|
||||||
The key benefits include:
|
|
||||||
|
|
||||||
1. **Improved Scalability**: Computation can scale independently of state management
|
|
||||||
2. **Better Resource Utilization**: Eliminates network overhead and leverages embedded frontend infrastructure
|
|
||||||
3. **Simplified Architecture**: Clear separation of concerns between components
|
|
||||||
4. **Enhanced Performance**: Sequence-based incremental processing reduces computational overhead
|
|
||||||
|
|
||||||
While the architecture introduces some complexity in terms of distributed coordination and error handling, the benefits significantly outweigh the drawbacks, making it a compelling evolution of the flow system.
|
|
||||||
18
flake.lock
generated
18
flake.lock
generated
@@ -8,11 +8,11 @@
|
|||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760078406,
|
"lastModified": 1745735608,
|
||||||
"narHash": "sha256-JeJK0ZA845PtkCHkfo4KjeI1mYrsr2s3cxBYKhF4BoE=",
|
"narHash": "sha256-L0jzm815XBFfF2wCFmR+M1CF+beIEFj6SxlqVKF59Ec=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "351277c60d104944122ee389cdf581c5ce2c6732",
|
"rev": "c39a78eba6ed2a022cc3218db90d485077101496",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -41,11 +41,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1759994382,
|
"lastModified": 1748162331,
|
||||||
"narHash": "sha256-wSK+3UkalDZRVHGCRikZ//CyZUJWDJkBDTQX1+G77Ow=",
|
"narHash": "sha256-rqc2RKYTxP3tbjA+PB3VMRQNnjesrT0pEofXQTrMsS8=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5da4a26309e796daa7ffca72df93dbe53b8164c7",
|
"rev": "7c43f080a7f28b2774f3b3f43234ca11661bf334",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -65,11 +65,11 @@
|
|||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760014945,
|
"lastModified": 1745694049,
|
||||||
"narHash": "sha256-ySdl7F9+oeWNHVrg3QL/brazqmJvYFEdpGnF3pyoDH8=",
|
"narHash": "sha256-fxvRYH/tS7hGQeg9zCVh5RBcSWT+JGJet7RA8Ss+rC0=",
|
||||||
"owner": "rust-lang",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"rev": "90d2e1ce4dfe7dc49250a8b88a0f08ffdb9cb23f",
|
"rev": "d8887c0758bbd2d5f752d5bd405d4491e90e7ed6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -15,11 +15,13 @@
|
|||||||
let
|
let
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
|
libgit2
|
||||||
|
libz
|
||||||
];
|
];
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
rustToolchain = fenix.packages.${system}.fromToolchainName {
|
rustToolchain = fenix.packages.${system}.fromToolchainName {
|
||||||
name = (lib.importTOML ./rust-toolchain.toml).toolchain.channel;
|
name = (lib.importTOML ./rust-toolchain.toml).toolchain.channel;
|
||||||
sha256 = "sha256-GCGEXGZeJySLND0KU5TdtTrqFV76TF3UdvAHSUegSsk=";
|
sha256 = "sha256-tJJr8oqX3YD+ohhPK7jlt/7kvKBnBqJVjYtoFr520d4=";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ If you use the [Helm Chart](https://github.com/GreptimeTeam/helm-charts) to depl
|
|||||||
- `monitoring.enabled=true`: Deploys a standalone GreptimeDB instance dedicated to monitoring the cluster;
|
- `monitoring.enabled=true`: Deploys a standalone GreptimeDB instance dedicated to monitoring the cluster;
|
||||||
- `grafana.enabled=true`: Deploys Grafana and automatically imports the monitoring dashboard;
|
- `grafana.enabled=true`: Deploys Grafana and automatically imports the monitoring dashboard;
|
||||||
|
|
||||||
The standalone GreptimeDB instance will collect metrics from your cluster, and the dashboard will be available in the Grafana UI. For detailed deployment instructions, please refer to our [Kubernetes deployment guide](https://docs.greptime.com/user-guide/deployments-administration/deploy-on-kubernetes/overview).
|
The standalone GreptimeDB instance will collect metrics from your cluster, and the dashboard will be available in the Grafana UI. For detailed deployment instructions, please refer to our [Kubernetes deployment guide](https://docs.greptime.com/user-guide/deployments-administration/deploy-on-kubernetes/getting-started).
|
||||||
|
|
||||||
### Self-host Prometheus and import dashboards manually
|
### Self-host Prometheus and import dashboards manually
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -21,14 +21,14 @@
|
|||||||
# Resources
|
# Resources
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
| Datanode Memory per Instance | `sum(process_resident_memory_bytes{instance=~"$datanode"}) by (instance, pod)`<br/>`max(greptime_memory_limit_in_bytes{instance=~"$datanode"})` | `timeseries` | Current memory usage by instance | `prometheus` | `bytes` | `[{{instance}}]-[{{ pod }}]` |
|
| Datanode Memory per Instance | `sum(process_resident_memory_bytes{instance=~"$datanode"}) by (instance, pod)` | `timeseries` | Current memory usage by instance | `prometheus` | `decbytes` | `[{{instance}}]-[{{ pod }}]` |
|
||||||
| Datanode CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{instance=~"$datanode"}[$__rate_interval]) * 1000) by (instance, pod)`<br/>`max(greptime_cpu_limit_in_millicores{instance=~"$datanode"})` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
| Datanode CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{instance=~"$datanode"}[$__rate_interval]) * 1000) by (instance, pod)` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
| Frontend Memory per Instance | `sum(process_resident_memory_bytes{instance=~"$frontend"}) by (instance, pod)`<br/>`max(greptime_memory_limit_in_bytes{instance=~"$frontend"})` | `timeseries` | Current memory usage by instance | `prometheus` | `bytes` | `[{{ instance }}]-[{{ pod }}]` |
|
| Frontend Memory per Instance | `sum(process_resident_memory_bytes{instance=~"$frontend"}) by (instance, pod)` | `timeseries` | Current memory usage by instance | `prometheus` | `decbytes` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
| Frontend CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{instance=~"$frontend"}[$__rate_interval]) * 1000) by (instance, pod)`<br/>`max(greptime_cpu_limit_in_millicores{instance=~"$frontend"})` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]-cpu` |
|
| Frontend CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{instance=~"$frontend"}[$__rate_interval]) * 1000) by (instance, pod)` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]-cpu` |
|
||||||
| Metasrv Memory per Instance | `sum(process_resident_memory_bytes{instance=~"$metasrv"}) by (instance, pod)`<br/>`max(greptime_memory_limit_in_bytes{instance=~"$metasrv"})` | `timeseries` | Current memory usage by instance | `prometheus` | `bytes` | `[{{ instance }}]-[{{ pod }}]-resident` |
|
| Metasrv Memory per Instance | `sum(process_resident_memory_bytes{instance=~"$metasrv"}) by (instance, pod)` | `timeseries` | Current memory usage by instance | `prometheus` | `decbytes` | `[{{ instance }}]-[{{ pod }}]-resident` |
|
||||||
| Metasrv CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{instance=~"$metasrv"}[$__rate_interval]) * 1000) by (instance, pod)`<br/>`max(greptime_cpu_limit_in_millicores{instance=~"$metasrv"})` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
| Metasrv CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{instance=~"$metasrv"}[$__rate_interval]) * 1000) by (instance, pod)` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
| Flownode Memory per Instance | `sum(process_resident_memory_bytes{instance=~"$flownode"}) by (instance, pod)`<br/>`max(greptime_memory_limit_in_bytes{instance=~"$flownode"})` | `timeseries` | Current memory usage by instance | `prometheus` | `bytes` | `[{{ instance }}]-[{{ pod }}]` |
|
| Flownode Memory per Instance | `sum(process_resident_memory_bytes{instance=~"$flownode"}) by (instance, pod)` | `timeseries` | Current memory usage by instance | `prometheus` | `decbytes` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
| Flownode CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{instance=~"$flownode"}[$__rate_interval]) * 1000) by (instance, pod)`<br/>`max(greptime_cpu_limit_in_millicores{instance=~"$flownode"})` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
| Flownode CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{instance=~"$flownode"}[$__rate_interval]) * 1000) by (instance, pod)` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
# Frontend Requests
|
# Frontend Requests
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
@@ -72,28 +72,20 @@
|
|||||||
| Region Worker Handle Bulk Insert Requests | `histogram_quantile(0.95, sum by(le,instance, stage, pod) (rate(greptime_region_worker_handle_write_bucket[$__rate_interval])))`<br/>`sum by(instance, stage, pod) (rate(greptime_region_worker_handle_write_sum[$__rate_interval]))/sum by(instance, stage, pod) (rate(greptime_region_worker_handle_write_count[$__rate_interval]))` | `timeseries` | Per-stage elapsed time for region worker to handle bulk insert region requests. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{stage}}]-P95` |
|
| Region Worker Handle Bulk Insert Requests | `histogram_quantile(0.95, sum by(le,instance, stage, pod) (rate(greptime_region_worker_handle_write_bucket[$__rate_interval])))`<br/>`sum by(instance, stage, pod) (rate(greptime_region_worker_handle_write_sum[$__rate_interval]))/sum by(instance, stage, pod) (rate(greptime_region_worker_handle_write_count[$__rate_interval]))` | `timeseries` | Per-stage elapsed time for region worker to handle bulk insert region requests. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{stage}}]-P95` |
|
||||||
| Active Series and Field Builders Count | `sum by(instance, pod) (greptime_mito_memtable_active_series_count)`<br/>`sum by(instance, pod) (greptime_mito_memtable_field_builder_count)` | `timeseries` | Compaction oinput output bytes | `prometheus` | `none` | `[{{instance}}]-[{{pod}}]-series` |
|
| Active Series and Field Builders Count | `sum by(instance, pod) (greptime_mito_memtable_active_series_count)`<br/>`sum by(instance, pod) (greptime_mito_memtable_field_builder_count)` | `timeseries` | Compaction oinput output bytes | `prometheus` | `none` | `[{{instance}}]-[{{pod}}]-series` |
|
||||||
| Region Worker Convert Requests | `histogram_quantile(0.95, sum by(le, instance, stage, pod) (rate(greptime_datanode_convert_region_request_bucket[$__rate_interval])))`<br/>`sum by(le,instance, stage, pod) (rate(greptime_datanode_convert_region_request_sum[$__rate_interval]))/sum by(le,instance, stage, pod) (rate(greptime_datanode_convert_region_request_count[$__rate_interval]))` | `timeseries` | Per-stage elapsed time for region worker to decode requests. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{stage}}]-P95` |
|
| Region Worker Convert Requests | `histogram_quantile(0.95, sum by(le, instance, stage, pod) (rate(greptime_datanode_convert_region_request_bucket[$__rate_interval])))`<br/>`sum by(le,instance, stage, pod) (rate(greptime_datanode_convert_region_request_sum[$__rate_interval]))/sum by(le,instance, stage, pod) (rate(greptime_datanode_convert_region_request_count[$__rate_interval]))` | `timeseries` | Per-stage elapsed time for region worker to decode requests. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{stage}}]-P95` |
|
||||||
| Cache Miss | `sum by (instance,pod, type) (rate(greptime_mito_cache_miss{instance=~"$datanode"}[$__rate_interval]))` | `timeseries` | The local cache miss of the datanode. | `prometheus` | -- | `[{{instance}}]-[{{pod}}]-[{{type}}]` |
|
|
||||||
# OpenDAL
|
# OpenDAL
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
| QPS per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode"}[$__rate_interval]))` | `timeseries` | QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| QPS per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode"}[$__rate_interval]))` | `timeseries` | QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
||||||
| Read QPS per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation=~"read\|Reader::read"}[$__rate_interval]))` | `timeseries` | Read QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Read QPS per Instance | `sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation="read"}[$__rate_interval]))` | `timeseries` | Read QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
||||||
| Read P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode",operation=~"read\|Reader::read"}[$__rate_interval])))` | `timeseries` | Read P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Read P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode",operation="read"}[$__rate_interval])))` | `timeseries` | Read P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-{{scheme}}` |
|
||||||
| Write QPS per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation=~"write\|Writer::write\|Writer::close"}[$__rate_interval]))` | `timeseries` | Write QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Write QPS per Instance | `sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation="write"}[$__rate_interval]))` | `timeseries` | Write QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-{{scheme}}` |
|
||||||
| Write P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation =~ "Writer::write\|Writer::close\|write"}[$__rate_interval])))` | `timeseries` | Write P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Write P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation="write"}[$__rate_interval])))` | `timeseries` | Write P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
||||||
| List QPS per Instance | `sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation="list"}[$__rate_interval]))` | `timeseries` | List QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
| List QPS per Instance | `sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation="list"}[$__rate_interval]))` | `timeseries` | List QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
||||||
| List P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation="list"}[$__rate_interval])))` | `timeseries` | List P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
| List P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation="list"}[$__rate_interval])))` | `timeseries` | List P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
||||||
| Other Requests per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode",operation!~"read\|write\|list\|stat"}[$__rate_interval]))` | `timeseries` | Other Requests per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Other Requests per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode",operation!~"read\|write\|list\|stat"}[$__rate_interval]))` | `timeseries` | Other Requests per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
||||||
| Other Request P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation!~"read\|write\|list\|Writer::write\|Writer::close\|Reader::read"}[$__rate_interval])))` | `timeseries` | Other Request P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Other Request P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation!~"read\|write\|list"}[$__rate_interval])))` | `timeseries` | Other Request P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
||||||
| Opendal traffic | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_bytes_sum{instance=~"$datanode"}[$__rate_interval]))` | `timeseries` | Total traffic as in bytes by instance and operation | `prometheus` | `decbytes` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Opendal traffic | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_bytes_sum{instance=~"$datanode"}[$__rate_interval]))` | `timeseries` | Total traffic as in bytes by instance and operation | `prometheus` | `decbytes` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
||||||
| OpenDAL errors per Instance | `sum by(instance, pod, scheme, operation, error) (rate(opendal_operation_errors_total{instance=~"$datanode", error!="NotFound"}[$__rate_interval]))` | `timeseries` | OpenDAL error counts per Instance. | `prometheus` | -- | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]-[{{error}}]` |
|
| OpenDAL errors per Instance | `sum by(instance, pod, scheme, operation, error) (rate(opendal_operation_errors_total{instance=~"$datanode", error!="NotFound"}[$__rate_interval]))` | `timeseries` | OpenDAL error counts per Instance. | `prometheus` | -- | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]-[{{error}}]` |
|
||||||
# Remote WAL
|
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
|
||||||
| Triggered region flush total | `meta_triggered_region_flush_total` | `timeseries` | Triggered region flush total | `prometheus` | `none` | `{{pod}}-{{topic_name}}` |
|
|
||||||
| Triggered region checkpoint total | `meta_triggered_region_checkpoint_total` | `timeseries` | Triggered region checkpoint total | `prometheus` | `none` | `{{pod}}-{{topic_name}}` |
|
|
||||||
| Topic estimated replay size | `meta_topic_estimated_replay_size` | `timeseries` | Topic estimated max replay size | `prometheus` | `bytes` | `{{pod}}-{{topic_name}}` |
|
|
||||||
| Kafka logstore's bytes traffic | `rate(greptime_logstore_kafka_client_bytes_total[$__rate_interval])` | `timeseries` | Kafka logstore's bytes traffic | `prometheus` | `bytes` | `{{pod}}-{{logstore}}` |
|
|
||||||
# Metasrv
|
# Metasrv
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
@@ -110,8 +102,6 @@
|
|||||||
| Meta KV Ops Latency | `histogram_quantile(0.99, sum by(pod, le, op, target) (greptime_meta_kv_request_elapsed_bucket))` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `s` | `{{pod}}-{{op}} p99` |
|
| Meta KV Ops Latency | `histogram_quantile(0.99, sum by(pod, le, op, target) (greptime_meta_kv_request_elapsed_bucket))` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `s` | `{{pod}}-{{op}} p99` |
|
||||||
| Rate of meta KV Ops | `rate(greptime_meta_kv_request_elapsed_count[$__rate_interval])` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `none` | `{{pod}}-{{op}} p99` |
|
| Rate of meta KV Ops | `rate(greptime_meta_kv_request_elapsed_count[$__rate_interval])` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `none` | `{{pod}}-{{op}} p99` |
|
||||||
| DDL Latency | `histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_tables_bucket))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_table))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_view))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_flow))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_drop_table))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_alter_table))` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `s` | `CreateLogicalTables-{{step}} p90` |
|
| DDL Latency | `histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_tables_bucket))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_table))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_view))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_flow))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_drop_table))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_alter_table))` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `s` | `CreateLogicalTables-{{step}} p90` |
|
||||||
| Reconciliation stats | `greptime_meta_reconciliation_stats` | `timeseries` | Reconciliation stats | `prometheus` | `s` | `{{pod}}-{{table_type}}-{{type}}` |
|
|
||||||
| Reconciliation steps | `histogram_quantile(0.9, greptime_meta_reconciliation_procedure_bucket)` | `timeseries` | Elapsed of Reconciliation steps | `prometheus` | `s` | `{{procedure_name}}-{{step}}-P90` |
|
|
||||||
# Flownode
|
# Flownode
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
|||||||
@@ -180,18 +180,13 @@ groups:
|
|||||||
- title: Datanode Memory per Instance
|
- title: Datanode Memory per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current memory usage by instance
|
description: Current memory usage by instance
|
||||||
unit: bytes
|
unit: decbytes
|
||||||
queries:
|
queries:
|
||||||
- expr: sum(process_resident_memory_bytes{instance=~"$datanode"}) by (instance, pod)
|
- expr: sum(process_resident_memory_bytes{instance=~"$datanode"}) by (instance, pod)
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{ pod }}]'
|
legendFormat: '[{{instance}}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_memory_limit_in_bytes{instance=~"$datanode"})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Datanode CPU Usage per Instance
|
- title: Datanode CPU Usage per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current cpu usage by instance
|
description: Current cpu usage by instance
|
||||||
@@ -202,26 +197,16 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_cpu_limit_in_millicores{instance=~"$datanode"})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Frontend Memory per Instance
|
- title: Frontend Memory per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current memory usage by instance
|
description: Current memory usage by instance
|
||||||
unit: bytes
|
unit: decbytes
|
||||||
queries:
|
queries:
|
||||||
- expr: sum(process_resident_memory_bytes{instance=~"$frontend"}) by (instance, pod)
|
- expr: sum(process_resident_memory_bytes{instance=~"$frontend"}) by (instance, pod)
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_memory_limit_in_bytes{instance=~"$frontend"})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Frontend CPU Usage per Instance
|
- title: Frontend CPU Usage per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current cpu usage by instance
|
description: Current cpu usage by instance
|
||||||
@@ -232,26 +217,16 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]-cpu'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]-cpu'
|
||||||
- expr: max(greptime_cpu_limit_in_millicores{instance=~"$frontend"})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Metasrv Memory per Instance
|
- title: Metasrv Memory per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current memory usage by instance
|
description: Current memory usage by instance
|
||||||
unit: bytes
|
unit: decbytes
|
||||||
queries:
|
queries:
|
||||||
- expr: sum(process_resident_memory_bytes{instance=~"$metasrv"}) by (instance, pod)
|
- expr: sum(process_resident_memory_bytes{instance=~"$metasrv"}) by (instance, pod)
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]-resident'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]-resident'
|
||||||
- expr: max(greptime_memory_limit_in_bytes{instance=~"$metasrv"})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Metasrv CPU Usage per Instance
|
- title: Metasrv CPU Usage per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current cpu usage by instance
|
description: Current cpu usage by instance
|
||||||
@@ -262,26 +237,16 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_cpu_limit_in_millicores{instance=~"$metasrv"})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Flownode Memory per Instance
|
- title: Flownode Memory per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current memory usage by instance
|
description: Current memory usage by instance
|
||||||
unit: bytes
|
unit: decbytes
|
||||||
queries:
|
queries:
|
||||||
- expr: sum(process_resident_memory_bytes{instance=~"$flownode"}) by (instance, pod)
|
- expr: sum(process_resident_memory_bytes{instance=~"$flownode"}) by (instance, pod)
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_memory_limit_in_bytes{instance=~"$flownode"})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Flownode CPU Usage per Instance
|
- title: Flownode CPU Usage per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current cpu usage by instance
|
description: Current cpu usage by instance
|
||||||
@@ -292,11 +257,6 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_cpu_limit_in_millicores{instance=~"$flownode"})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Frontend Requests
|
- title: Frontend Requests
|
||||||
panels:
|
panels:
|
||||||
- title: HTTP QPS per Instance
|
- title: HTTP QPS per Instance
|
||||||
@@ -682,15 +642,6 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{stage}}]-AVG'
|
legendFormat: '[{{instance}}]-[{{pod}}]-[{{stage}}]-AVG'
|
||||||
- title: Cache Miss
|
|
||||||
type: timeseries
|
|
||||||
description: The local cache miss of the datanode.
|
|
||||||
queries:
|
|
||||||
- expr: sum by (instance,pod, type) (rate(greptime_mito_cache_miss{instance=~"$datanode"}[$__rate_interval]))
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{type}}]'
|
|
||||||
- title: OpenDAL
|
- title: OpenDAL
|
||||||
panels:
|
panels:
|
||||||
- title: QPS per Instance
|
- title: QPS per Instance
|
||||||
@@ -708,41 +659,41 @@ groups:
|
|||||||
description: Read QPS per Instance.
|
description: Read QPS per Instance.
|
||||||
unit: ops
|
unit: ops
|
||||||
queries:
|
queries:
|
||||||
- expr: sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation=~"read|Reader::read"}[$__rate_interval]))
|
- expr: sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation="read"}[$__rate_interval]))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]'
|
||||||
- title: Read P99 per Instance
|
- title: Read P99 per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Read P99 per Instance.
|
description: Read P99 per Instance.
|
||||||
unit: s
|
unit: s
|
||||||
queries:
|
queries:
|
||||||
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode",operation=~"read|Reader::read"}[$__rate_interval])))
|
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode",operation="read"}[$__rate_interval])))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-{{scheme}}'
|
||||||
- title: Write QPS per Instance
|
- title: Write QPS per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Write QPS per Instance.
|
description: Write QPS per Instance.
|
||||||
unit: ops
|
unit: ops
|
||||||
queries:
|
queries:
|
||||||
- expr: sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation=~"write|Writer::write|Writer::close"}[$__rate_interval]))
|
- expr: sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{instance=~"$datanode", operation="write"}[$__rate_interval]))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-{{scheme}}'
|
||||||
- title: Write P99 per Instance
|
- title: Write P99 per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Write P99 per Instance.
|
description: Write P99 per Instance.
|
||||||
unit: s
|
unit: s
|
||||||
queries:
|
queries:
|
||||||
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation =~ "Writer::write|Writer::close|write"}[$__rate_interval])))
|
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation="write"}[$__rate_interval])))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]'
|
||||||
- title: List QPS per Instance
|
- title: List QPS per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: List QPS per Instance.
|
description: List QPS per Instance.
|
||||||
@@ -778,7 +729,7 @@ groups:
|
|||||||
description: Other Request P99 per Instance.
|
description: Other Request P99 per Instance.
|
||||||
unit: s
|
unit: s
|
||||||
queries:
|
queries:
|
||||||
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation!~"read|write|list|Writer::write|Writer::close|Reader::read"}[$__rate_interval])))
|
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{instance=~"$datanode", operation!~"read|write|list"}[$__rate_interval])))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
@@ -802,48 +753,6 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]-[{{error}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]-[{{error}}]'
|
||||||
- title: Remote WAL
|
|
||||||
panels:
|
|
||||||
- title: Triggered region flush total
|
|
||||||
type: timeseries
|
|
||||||
description: Triggered region flush total
|
|
||||||
unit: none
|
|
||||||
queries:
|
|
||||||
- expr: meta_triggered_region_flush_total
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{topic_name}}'
|
|
||||||
- title: Triggered region checkpoint total
|
|
||||||
type: timeseries
|
|
||||||
description: Triggered region checkpoint total
|
|
||||||
unit: none
|
|
||||||
queries:
|
|
||||||
- expr: meta_triggered_region_checkpoint_total
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{topic_name}}'
|
|
||||||
- title: Topic estimated replay size
|
|
||||||
type: timeseries
|
|
||||||
description: Topic estimated max replay size
|
|
||||||
unit: bytes
|
|
||||||
queries:
|
|
||||||
- expr: meta_topic_estimated_replay_size
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{topic_name}}'
|
|
||||||
- title: Kafka logstore's bytes traffic
|
|
||||||
type: timeseries
|
|
||||||
description: Kafka logstore's bytes traffic
|
|
||||||
unit: bytes
|
|
||||||
queries:
|
|
||||||
- expr: rate(greptime_logstore_kafka_client_bytes_total[$__rate_interval])
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{logstore}}'
|
|
||||||
- title: Metasrv
|
- title: Metasrv
|
||||||
panels:
|
panels:
|
||||||
- title: Region migration datanode
|
- title: Region migration datanode
|
||||||
@@ -990,26 +899,6 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: AlterTable-{{step}} p90
|
legendFormat: AlterTable-{{step}} p90
|
||||||
- title: Reconciliation stats
|
|
||||||
type: timeseries
|
|
||||||
description: Reconciliation stats
|
|
||||||
unit: s
|
|
||||||
queries:
|
|
||||||
- expr: greptime_meta_reconciliation_stats
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{table_type}}-{{type}}'
|
|
||||||
- title: Reconciliation steps
|
|
||||||
type: timeseries
|
|
||||||
description: 'Elapsed of Reconciliation steps '
|
|
||||||
unit: s
|
|
||||||
queries:
|
|
||||||
- expr: histogram_quantile(0.9, greptime_meta_reconciliation_procedure_bucket)
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{procedure_name}}-{{step}}-P90'
|
|
||||||
- title: Flownode
|
- title: Flownode
|
||||||
panels:
|
panels:
|
||||||
- title: Flow Ingest / Output Rate
|
- title: Flow Ingest / Output Rate
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -21,14 +21,14 @@
|
|||||||
# Resources
|
# Resources
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
| Datanode Memory per Instance | `sum(process_resident_memory_bytes{}) by (instance, pod)`<br/>`max(greptime_memory_limit_in_bytes{})` | `timeseries` | Current memory usage by instance | `prometheus` | `bytes` | `[{{instance}}]-[{{ pod }}]` |
|
| Datanode Memory per Instance | `sum(process_resident_memory_bytes{}) by (instance, pod)` | `timeseries` | Current memory usage by instance | `prometheus` | `decbytes` | `[{{instance}}]-[{{ pod }}]` |
|
||||||
| Datanode CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{}[$__rate_interval]) * 1000) by (instance, pod)`<br/>`max(greptime_cpu_limit_in_millicores{})` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
| Datanode CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{}[$__rate_interval]) * 1000) by (instance, pod)` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
| Frontend Memory per Instance | `sum(process_resident_memory_bytes{}) by (instance, pod)`<br/>`max(greptime_memory_limit_in_bytes{})` | `timeseries` | Current memory usage by instance | `prometheus` | `bytes` | `[{{ instance }}]-[{{ pod }}]` |
|
| Frontend Memory per Instance | `sum(process_resident_memory_bytes{}) by (instance, pod)` | `timeseries` | Current memory usage by instance | `prometheus` | `decbytes` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
| Frontend CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{}[$__rate_interval]) * 1000) by (instance, pod)`<br/>`max(greptime_cpu_limit_in_millicores{})` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]-cpu` |
|
| Frontend CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{}[$__rate_interval]) * 1000) by (instance, pod)` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]-cpu` |
|
||||||
| Metasrv Memory per Instance | `sum(process_resident_memory_bytes{}) by (instance, pod)`<br/>`max(greptime_memory_limit_in_bytes{})` | `timeseries` | Current memory usage by instance | `prometheus` | `bytes` | `[{{ instance }}]-[{{ pod }}]-resident` |
|
| Metasrv Memory per Instance | `sum(process_resident_memory_bytes{}) by (instance, pod)` | `timeseries` | Current memory usage by instance | `prometheus` | `decbytes` | `[{{ instance }}]-[{{ pod }}]-resident` |
|
||||||
| Metasrv CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{}[$__rate_interval]) * 1000) by (instance, pod)`<br/>`max(greptime_cpu_limit_in_millicores{})` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
| Metasrv CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{}[$__rate_interval]) * 1000) by (instance, pod)` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
| Flownode Memory per Instance | `sum(process_resident_memory_bytes{}) by (instance, pod)`<br/>`max(greptime_memory_limit_in_bytes{})` | `timeseries` | Current memory usage by instance | `prometheus` | `bytes` | `[{{ instance }}]-[{{ pod }}]` |
|
| Flownode Memory per Instance | `sum(process_resident_memory_bytes{}) by (instance, pod)` | `timeseries` | Current memory usage by instance | `prometheus` | `decbytes` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
| Flownode CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{}[$__rate_interval]) * 1000) by (instance, pod)`<br/>`max(greptime_cpu_limit_in_millicores{})` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
| Flownode CPU Usage per Instance | `sum(rate(process_cpu_seconds_total{}[$__rate_interval]) * 1000) by (instance, pod)` | `timeseries` | Current cpu usage by instance | `prometheus` | `none` | `[{{ instance }}]-[{{ pod }}]` |
|
||||||
# Frontend Requests
|
# Frontend Requests
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
@@ -72,28 +72,20 @@
|
|||||||
| Region Worker Handle Bulk Insert Requests | `histogram_quantile(0.95, sum by(le,instance, stage, pod) (rate(greptime_region_worker_handle_write_bucket[$__rate_interval])))`<br/>`sum by(instance, stage, pod) (rate(greptime_region_worker_handle_write_sum[$__rate_interval]))/sum by(instance, stage, pod) (rate(greptime_region_worker_handle_write_count[$__rate_interval]))` | `timeseries` | Per-stage elapsed time for region worker to handle bulk insert region requests. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{stage}}]-P95` |
|
| Region Worker Handle Bulk Insert Requests | `histogram_quantile(0.95, sum by(le,instance, stage, pod) (rate(greptime_region_worker_handle_write_bucket[$__rate_interval])))`<br/>`sum by(instance, stage, pod) (rate(greptime_region_worker_handle_write_sum[$__rate_interval]))/sum by(instance, stage, pod) (rate(greptime_region_worker_handle_write_count[$__rate_interval]))` | `timeseries` | Per-stage elapsed time for region worker to handle bulk insert region requests. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{stage}}]-P95` |
|
||||||
| Active Series and Field Builders Count | `sum by(instance, pod) (greptime_mito_memtable_active_series_count)`<br/>`sum by(instance, pod) (greptime_mito_memtable_field_builder_count)` | `timeseries` | Compaction oinput output bytes | `prometheus` | `none` | `[{{instance}}]-[{{pod}}]-series` |
|
| Active Series and Field Builders Count | `sum by(instance, pod) (greptime_mito_memtable_active_series_count)`<br/>`sum by(instance, pod) (greptime_mito_memtable_field_builder_count)` | `timeseries` | Compaction oinput output bytes | `prometheus` | `none` | `[{{instance}}]-[{{pod}}]-series` |
|
||||||
| Region Worker Convert Requests | `histogram_quantile(0.95, sum by(le, instance, stage, pod) (rate(greptime_datanode_convert_region_request_bucket[$__rate_interval])))`<br/>`sum by(le,instance, stage, pod) (rate(greptime_datanode_convert_region_request_sum[$__rate_interval]))/sum by(le,instance, stage, pod) (rate(greptime_datanode_convert_region_request_count[$__rate_interval]))` | `timeseries` | Per-stage elapsed time for region worker to decode requests. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{stage}}]-P95` |
|
| Region Worker Convert Requests | `histogram_quantile(0.95, sum by(le, instance, stage, pod) (rate(greptime_datanode_convert_region_request_bucket[$__rate_interval])))`<br/>`sum by(le,instance, stage, pod) (rate(greptime_datanode_convert_region_request_sum[$__rate_interval]))/sum by(le,instance, stage, pod) (rate(greptime_datanode_convert_region_request_count[$__rate_interval]))` | `timeseries` | Per-stage elapsed time for region worker to decode requests. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{stage}}]-P95` |
|
||||||
| Cache Miss | `sum by (instance,pod, type) (rate(greptime_mito_cache_miss{}[$__rate_interval]))` | `timeseries` | The local cache miss of the datanode. | `prometheus` | -- | `[{{instance}}]-[{{pod}}]-[{{type}}]` |
|
|
||||||
# OpenDAL
|
# OpenDAL
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
| QPS per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{}[$__rate_interval]))` | `timeseries` | QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| QPS per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{}[$__rate_interval]))` | `timeseries` | QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
||||||
| Read QPS per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{ operation=~"read\|Reader::read"}[$__rate_interval]))` | `timeseries` | Read QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Read QPS per Instance | `sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{ operation="read"}[$__rate_interval]))` | `timeseries` | Read QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
||||||
| Read P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{operation=~"read\|Reader::read"}[$__rate_interval])))` | `timeseries` | Read P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Read P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{operation="read"}[$__rate_interval])))` | `timeseries` | Read P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-{{scheme}}` |
|
||||||
| Write QPS per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{ operation=~"write\|Writer::write\|Writer::close"}[$__rate_interval]))` | `timeseries` | Write QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Write QPS per Instance | `sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{ operation="write"}[$__rate_interval]))` | `timeseries` | Write QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-{{scheme}}` |
|
||||||
| Write P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{ operation =~ "Writer::write\|Writer::close\|write"}[$__rate_interval])))` | `timeseries` | Write P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Write P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{ operation="write"}[$__rate_interval])))` | `timeseries` | Write P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
||||||
| List QPS per Instance | `sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{ operation="list"}[$__rate_interval]))` | `timeseries` | List QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
| List QPS per Instance | `sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{ operation="list"}[$__rate_interval]))` | `timeseries` | List QPS per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
||||||
| List P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{ operation="list"}[$__rate_interval])))` | `timeseries` | List P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
| List P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{ operation="list"}[$__rate_interval])))` | `timeseries` | List P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]` |
|
||||||
| Other Requests per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{operation!~"read\|write\|list\|stat"}[$__rate_interval]))` | `timeseries` | Other Requests per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Other Requests per Instance | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{operation!~"read\|write\|list\|stat"}[$__rate_interval]))` | `timeseries` | Other Requests per Instance. | `prometheus` | `ops` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
||||||
| Other Request P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{ operation!~"read\|write\|list\|Writer::write\|Writer::close\|Reader::read"}[$__rate_interval])))` | `timeseries` | Other Request P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Other Request P99 per Instance | `histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{ operation!~"read\|write\|list"}[$__rate_interval])))` | `timeseries` | Other Request P99 per Instance. | `prometheus` | `s` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
||||||
| Opendal traffic | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_bytes_sum{}[$__rate_interval]))` | `timeseries` | Total traffic as in bytes by instance and operation | `prometheus` | `decbytes` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
| Opendal traffic | `sum by(instance, pod, scheme, operation) (rate(opendal_operation_bytes_sum{}[$__rate_interval]))` | `timeseries` | Total traffic as in bytes by instance and operation | `prometheus` | `decbytes` | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]` |
|
||||||
| OpenDAL errors per Instance | `sum by(instance, pod, scheme, operation, error) (rate(opendal_operation_errors_total{ error!="NotFound"}[$__rate_interval]))` | `timeseries` | OpenDAL error counts per Instance. | `prometheus` | -- | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]-[{{error}}]` |
|
| OpenDAL errors per Instance | `sum by(instance, pod, scheme, operation, error) (rate(opendal_operation_errors_total{ error!="NotFound"}[$__rate_interval]))` | `timeseries` | OpenDAL error counts per Instance. | `prometheus` | -- | `[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]-[{{error}}]` |
|
||||||
# Remote WAL
|
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
|
||||||
| Triggered region flush total | `meta_triggered_region_flush_total` | `timeseries` | Triggered region flush total | `prometheus` | `none` | `{{pod}}-{{topic_name}}` |
|
|
||||||
| Triggered region checkpoint total | `meta_triggered_region_checkpoint_total` | `timeseries` | Triggered region checkpoint total | `prometheus` | `none` | `{{pod}}-{{topic_name}}` |
|
|
||||||
| Topic estimated replay size | `meta_topic_estimated_replay_size` | `timeseries` | Topic estimated max replay size | `prometheus` | `bytes` | `{{pod}}-{{topic_name}}` |
|
|
||||||
| Kafka logstore's bytes traffic | `rate(greptime_logstore_kafka_client_bytes_total[$__rate_interval])` | `timeseries` | Kafka logstore's bytes traffic | `prometheus` | `bytes` | `{{pod}}-{{logstore}}` |
|
|
||||||
# Metasrv
|
# Metasrv
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
@@ -110,8 +102,6 @@
|
|||||||
| Meta KV Ops Latency | `histogram_quantile(0.99, sum by(pod, le, op, target) (greptime_meta_kv_request_elapsed_bucket))` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `s` | `{{pod}}-{{op}} p99` |
|
| Meta KV Ops Latency | `histogram_quantile(0.99, sum by(pod, le, op, target) (greptime_meta_kv_request_elapsed_bucket))` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `s` | `{{pod}}-{{op}} p99` |
|
||||||
| Rate of meta KV Ops | `rate(greptime_meta_kv_request_elapsed_count[$__rate_interval])` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `none` | `{{pod}}-{{op}} p99` |
|
| Rate of meta KV Ops | `rate(greptime_meta_kv_request_elapsed_count[$__rate_interval])` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `none` | `{{pod}}-{{op}} p99` |
|
||||||
| DDL Latency | `histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_tables_bucket))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_table))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_view))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_flow))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_drop_table))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_alter_table))` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `s` | `CreateLogicalTables-{{step}} p90` |
|
| DDL Latency | `histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_tables_bucket))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_table))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_view))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_create_flow))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_drop_table))`<br/>`histogram_quantile(0.9, sum by(le, pod, step) (greptime_meta_procedure_alter_table))` | `timeseries` | Gauge of load information of each datanode, collected via heartbeat between datanode and metasrv. This information is for metasrv to schedule workloads. | `prometheus` | `s` | `CreateLogicalTables-{{step}} p90` |
|
||||||
| Reconciliation stats | `greptime_meta_reconciliation_stats` | `timeseries` | Reconciliation stats | `prometheus` | `s` | `{{pod}}-{{table_type}}-{{type}}` |
|
|
||||||
| Reconciliation steps | `histogram_quantile(0.9, greptime_meta_reconciliation_procedure_bucket)` | `timeseries` | Elapsed of Reconciliation steps | `prometheus` | `s` | `{{procedure_name}}-{{step}}-P90` |
|
|
||||||
# Flownode
|
# Flownode
|
||||||
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
| Title | Query | Type | Description | Datasource | Unit | Legend Format |
|
||||||
| --- | --- | --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- | --- | --- |
|
||||||
|
|||||||
@@ -180,18 +180,13 @@ groups:
|
|||||||
- title: Datanode Memory per Instance
|
- title: Datanode Memory per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current memory usage by instance
|
description: Current memory usage by instance
|
||||||
unit: bytes
|
unit: decbytes
|
||||||
queries:
|
queries:
|
||||||
- expr: sum(process_resident_memory_bytes{}) by (instance, pod)
|
- expr: sum(process_resident_memory_bytes{}) by (instance, pod)
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{ pod }}]'
|
legendFormat: '[{{instance}}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_memory_limit_in_bytes{})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Datanode CPU Usage per Instance
|
- title: Datanode CPU Usage per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current cpu usage by instance
|
description: Current cpu usage by instance
|
||||||
@@ -202,26 +197,16 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_cpu_limit_in_millicores{})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Frontend Memory per Instance
|
- title: Frontend Memory per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current memory usage by instance
|
description: Current memory usage by instance
|
||||||
unit: bytes
|
unit: decbytes
|
||||||
queries:
|
queries:
|
||||||
- expr: sum(process_resident_memory_bytes{}) by (instance, pod)
|
- expr: sum(process_resident_memory_bytes{}) by (instance, pod)
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_memory_limit_in_bytes{})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Frontend CPU Usage per Instance
|
- title: Frontend CPU Usage per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current cpu usage by instance
|
description: Current cpu usage by instance
|
||||||
@@ -232,26 +217,16 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]-cpu'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]-cpu'
|
||||||
- expr: max(greptime_cpu_limit_in_millicores{})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Metasrv Memory per Instance
|
- title: Metasrv Memory per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current memory usage by instance
|
description: Current memory usage by instance
|
||||||
unit: bytes
|
unit: decbytes
|
||||||
queries:
|
queries:
|
||||||
- expr: sum(process_resident_memory_bytes{}) by (instance, pod)
|
- expr: sum(process_resident_memory_bytes{}) by (instance, pod)
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]-resident'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]-resident'
|
||||||
- expr: max(greptime_memory_limit_in_bytes{})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Metasrv CPU Usage per Instance
|
- title: Metasrv CPU Usage per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current cpu usage by instance
|
description: Current cpu usage by instance
|
||||||
@@ -262,26 +237,16 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_cpu_limit_in_millicores{})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Flownode Memory per Instance
|
- title: Flownode Memory per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current memory usage by instance
|
description: Current memory usage by instance
|
||||||
unit: bytes
|
unit: decbytes
|
||||||
queries:
|
queries:
|
||||||
- expr: sum(process_resident_memory_bytes{}) by (instance, pod)
|
- expr: sum(process_resident_memory_bytes{}) by (instance, pod)
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_memory_limit_in_bytes{})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Flownode CPU Usage per Instance
|
- title: Flownode CPU Usage per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Current cpu usage by instance
|
description: Current cpu usage by instance
|
||||||
@@ -292,11 +257,6 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
legendFormat: '[{{ instance }}]-[{{ pod }}]'
|
||||||
- expr: max(greptime_cpu_limit_in_millicores{})
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: limit
|
|
||||||
- title: Frontend Requests
|
- title: Frontend Requests
|
||||||
panels:
|
panels:
|
||||||
- title: HTTP QPS per Instance
|
- title: HTTP QPS per Instance
|
||||||
@@ -682,15 +642,6 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{stage}}]-AVG'
|
legendFormat: '[{{instance}}]-[{{pod}}]-[{{stage}}]-AVG'
|
||||||
- title: Cache Miss
|
|
||||||
type: timeseries
|
|
||||||
description: The local cache miss of the datanode.
|
|
||||||
queries:
|
|
||||||
- expr: sum by (instance,pod, type) (rate(greptime_mito_cache_miss{}[$__rate_interval]))
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{type}}]'
|
|
||||||
- title: OpenDAL
|
- title: OpenDAL
|
||||||
panels:
|
panels:
|
||||||
- title: QPS per Instance
|
- title: QPS per Instance
|
||||||
@@ -708,41 +659,41 @@ groups:
|
|||||||
description: Read QPS per Instance.
|
description: Read QPS per Instance.
|
||||||
unit: ops
|
unit: ops
|
||||||
queries:
|
queries:
|
||||||
- expr: sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{ operation=~"read|Reader::read"}[$__rate_interval]))
|
- expr: sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{ operation="read"}[$__rate_interval]))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]'
|
||||||
- title: Read P99 per Instance
|
- title: Read P99 per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Read P99 per Instance.
|
description: Read P99 per Instance.
|
||||||
unit: s
|
unit: s
|
||||||
queries:
|
queries:
|
||||||
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{operation=~"read|Reader::read"}[$__rate_interval])))
|
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{operation="read"}[$__rate_interval])))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-{{scheme}}'
|
||||||
- title: Write QPS per Instance
|
- title: Write QPS per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Write QPS per Instance.
|
description: Write QPS per Instance.
|
||||||
unit: ops
|
unit: ops
|
||||||
queries:
|
queries:
|
||||||
- expr: sum by(instance, pod, scheme, operation) (rate(opendal_operation_duration_seconds_count{ operation=~"write|Writer::write|Writer::close"}[$__rate_interval]))
|
- expr: sum by(instance, pod, scheme) (rate(opendal_operation_duration_seconds_count{ operation="write"}[$__rate_interval]))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-{{scheme}}'
|
||||||
- title: Write P99 per Instance
|
- title: Write P99 per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: Write P99 per Instance.
|
description: Write P99 per Instance.
|
||||||
unit: s
|
unit: s
|
||||||
queries:
|
queries:
|
||||||
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{ operation =~ "Writer::write|Writer::close|write"}[$__rate_interval])))
|
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme) (rate(opendal_operation_duration_seconds_bucket{ operation="write"}[$__rate_interval])))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]'
|
||||||
- title: List QPS per Instance
|
- title: List QPS per Instance
|
||||||
type: timeseries
|
type: timeseries
|
||||||
description: List QPS per Instance.
|
description: List QPS per Instance.
|
||||||
@@ -778,7 +729,7 @@ groups:
|
|||||||
description: Other Request P99 per Instance.
|
description: Other Request P99 per Instance.
|
||||||
unit: s
|
unit: s
|
||||||
queries:
|
queries:
|
||||||
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{ operation!~"read|write|list|Writer::write|Writer::close|Reader::read"}[$__rate_interval])))
|
- expr: histogram_quantile(0.99, sum by(instance, pod, le, scheme, operation) (rate(opendal_operation_duration_seconds_bucket{ operation!~"read|write|list"}[$__rate_interval])))
|
||||||
datasource:
|
datasource:
|
||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
@@ -802,48 +753,6 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]-[{{error}}]'
|
legendFormat: '[{{instance}}]-[{{pod}}]-[{{scheme}}]-[{{operation}}]-[{{error}}]'
|
||||||
- title: Remote WAL
|
|
||||||
panels:
|
|
||||||
- title: Triggered region flush total
|
|
||||||
type: timeseries
|
|
||||||
description: Triggered region flush total
|
|
||||||
unit: none
|
|
||||||
queries:
|
|
||||||
- expr: meta_triggered_region_flush_total
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{topic_name}}'
|
|
||||||
- title: Triggered region checkpoint total
|
|
||||||
type: timeseries
|
|
||||||
description: Triggered region checkpoint total
|
|
||||||
unit: none
|
|
||||||
queries:
|
|
||||||
- expr: meta_triggered_region_checkpoint_total
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{topic_name}}'
|
|
||||||
- title: Topic estimated replay size
|
|
||||||
type: timeseries
|
|
||||||
description: Topic estimated max replay size
|
|
||||||
unit: bytes
|
|
||||||
queries:
|
|
||||||
- expr: meta_topic_estimated_replay_size
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{topic_name}}'
|
|
||||||
- title: Kafka logstore's bytes traffic
|
|
||||||
type: timeseries
|
|
||||||
description: Kafka logstore's bytes traffic
|
|
||||||
unit: bytes
|
|
||||||
queries:
|
|
||||||
- expr: rate(greptime_logstore_kafka_client_bytes_total[$__rate_interval])
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{logstore}}'
|
|
||||||
- title: Metasrv
|
- title: Metasrv
|
||||||
panels:
|
panels:
|
||||||
- title: Region migration datanode
|
- title: Region migration datanode
|
||||||
@@ -990,26 +899,6 @@ groups:
|
|||||||
type: prometheus
|
type: prometheus
|
||||||
uid: ${metrics}
|
uid: ${metrics}
|
||||||
legendFormat: AlterTable-{{step}} p90
|
legendFormat: AlterTable-{{step}} p90
|
||||||
- title: Reconciliation stats
|
|
||||||
type: timeseries
|
|
||||||
description: Reconciliation stats
|
|
||||||
unit: s
|
|
||||||
queries:
|
|
||||||
- expr: greptime_meta_reconciliation_stats
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{pod}}-{{table_type}}-{{type}}'
|
|
||||||
- title: Reconciliation steps
|
|
||||||
type: timeseries
|
|
||||||
description: 'Elapsed of Reconciliation steps '
|
|
||||||
unit: s
|
|
||||||
queries:
|
|
||||||
- expr: histogram_quantile(0.9, greptime_meta_reconciliation_procedure_bucket)
|
|
||||||
datasource:
|
|
||||||
type: prometheus
|
|
||||||
uid: ${metrics}
|
|
||||||
legendFormat: '{{procedure_name}}-{{step}}-P90'
|
|
||||||
- title: Flownode
|
- title: Flownode
|
||||||
panels:
|
panels:
|
||||||
- title: Flow Ingest / Output Rate
|
- title: Flow Ingest / Output Rate
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ check_dashboards_generation() {
|
|||||||
./grafana/scripts/gen-dashboards.sh
|
./grafana/scripts/gen-dashboards.sh
|
||||||
|
|
||||||
if [[ -n "$(git diff --name-only grafana/dashboards/metrics)" ]]; then
|
if [[ -n "$(git diff --name-only grafana/dashboards/metrics)" ]]; then
|
||||||
echo "Error: The dashboards are not generated correctly. You should execute the 'make dashboards' command."
|
echo "Error: The dashboards are not generated correctly. You should execute the `make dashboards` command."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,14 +29,11 @@ excludes = [
|
|||||||
# enterprise
|
# enterprise
|
||||||
"src/common/meta/src/rpc/ddl/trigger.rs",
|
"src/common/meta/src/rpc/ddl/trigger.rs",
|
||||||
"src/operator/src/expr_helper/trigger.rs",
|
"src/operator/src/expr_helper/trigger.rs",
|
||||||
"src/sql/src/statements/alter/trigger.rs",
|
|
||||||
"src/sql/src/statements/create/trigger.rs",
|
"src/sql/src/statements/create/trigger.rs",
|
||||||
"src/sql/src/statements/show/trigger.rs",
|
"src/sql/src/statements/show/trigger.rs",
|
||||||
"src/sql/src/statements/drop/trigger.rs",
|
"src/sql/src/statements/drop/trigger.rs",
|
||||||
"src/sql/src/parsers/alter_parser/trigger.rs",
|
|
||||||
"src/sql/src/parsers/create_parser/trigger.rs",
|
"src/sql/src/parsers/create_parser/trigger.rs",
|
||||||
"src/sql/src/parsers/show_parser/trigger.rs",
|
"src/sql/src/parsers/show_parser/trigger.rs",
|
||||||
"src/mito2/src/extension.rs",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[properties]
|
[properties]
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "nightly-2025-10-01"
|
channel = "nightly-2025-05-19"
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
from multiprocessing import Pool
|
from multiprocessing import Pool
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
def find_rust_files(directory):
|
def find_rust_files(directory):
|
||||||
@@ -24,10 +24,6 @@ def find_rust_files(directory):
|
|||||||
if "test" in root.lower():
|
if "test" in root.lower():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Skip the target directory
|
|
||||||
if "target" in Path(root).parts:
|
|
||||||
continue
|
|
||||||
|
|
||||||
for file in files:
|
for file in files:
|
||||||
# Skip files with "test" in the filename
|
# Skip files with "test" in the filename
|
||||||
if "test" in file.lower():
|
if "test" in file.lower():
|
||||||
|
|||||||
@@ -1,265 +0,0 @@
|
|||||||
# Copyright 2023 Greptime Team
|
|
||||||
#
|
|
||||||
# Licensed 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.
|
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def load_udeps_report(report_path):
|
|
||||||
try:
|
|
||||||
with open(report_path, "r") as f:
|
|
||||||
return json.load(f)
|
|
||||||
except FileNotFoundError:
|
|
||||||
print(f"Error: Report file '{report_path}' not found.")
|
|
||||||
return None
|
|
||||||
except json.JSONDecodeError as e:
|
|
||||||
print(f"Error: Invalid JSON in report file: {e}")
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def extract_unused_dependencies(report):
|
|
||||||
"""
|
|
||||||
Extract and organize unused dependencies from the cargo-udeps JSON report.
|
|
||||||
|
|
||||||
The cargo-udeps report has this structure:
|
|
||||||
{
|
|
||||||
"unused_deps": {
|
|
||||||
"package_name v0.1.0 (/path/to/package)": {
|
|
||||||
"normal": ["dep1", "dep2"],
|
|
||||||
"development": ["dev_dep1"],
|
|
||||||
"build": ["build_dep1"],
|
|
||||||
"manifest_path": "/path/to/Cargo.toml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Args:
|
|
||||||
report (dict): The parsed JSON report from cargo-udeps
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Organized unused dependencies by package name:
|
|
||||||
{
|
|
||||||
"package_name": {
|
|
||||||
"dependencies": [("dep1", "normal"), ("dev_dep1", "dev")],
|
|
||||||
"manifest_path": "/path/to/Cargo.toml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
if not report or "unused_deps" not in report:
|
|
||||||
return {}
|
|
||||||
|
|
||||||
unused_deps = {}
|
|
||||||
for package_full_name, deps_info in report["unused_deps"].items():
|
|
||||||
package_name = package_full_name.split(" ")[0]
|
|
||||||
|
|
||||||
all_unused = []
|
|
||||||
if deps_info.get("normal"):
|
|
||||||
all_unused.extend([(dep, "normal") for dep in deps_info["normal"]])
|
|
||||||
if deps_info.get("development"):
|
|
||||||
all_unused.extend([(dep, "dev") for dep in deps_info["development"]])
|
|
||||||
if deps_info.get("build"):
|
|
||||||
all_unused.extend([(dep, "build") for dep in deps_info["build"]])
|
|
||||||
|
|
||||||
if all_unused:
|
|
||||||
unused_deps[package_name] = {
|
|
||||||
"dependencies": all_unused,
|
|
||||||
"manifest_path": deps_info.get("manifest_path", "unknown"),
|
|
||||||
}
|
|
||||||
|
|
||||||
return unused_deps
|
|
||||||
|
|
||||||
|
|
||||||
def get_section_pattern(dep_type):
|
|
||||||
"""
|
|
||||||
Get regex patterns to identify different dependency sections in Cargo.toml.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
dep_type (str): Type of dependency ("normal", "dev", or "build")
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
list: List of regex patterns to match the appropriate section headers
|
|
||||||
|
|
||||||
"""
|
|
||||||
patterns = {
|
|
||||||
"normal": [r"\[dependencies\]", r"\[dependencies\..*?\]"],
|
|
||||||
"dev": [r"\[dev-dependencies\]", r"\[dev-dependencies\..*?\]"],
|
|
||||||
"build": [r"\[build-dependencies\]", r"\[build-dependencies\..*?\]"],
|
|
||||||
}
|
|
||||||
return patterns.get(dep_type, [])
|
|
||||||
|
|
||||||
|
|
||||||
def remove_dependency_line(content, dep_name, section_start, section_end):
|
|
||||||
"""
|
|
||||||
Remove a dependency line from a specific section of a Cargo.toml file.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
content (str): The entire content of the Cargo.toml file
|
|
||||||
dep_name (str): Name of the dependency to remove (e.g., "serde", "tokio")
|
|
||||||
section_start (int): Starting position of the section in the content
|
|
||||||
section_end (int): Ending position of the section in the content
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
tuple: (new_content, removed) where:
|
|
||||||
- new_content (str): The modified content with dependency removed
|
|
||||||
- removed (bool): True if dependency was found and removed, False otherwise
|
|
||||||
|
|
||||||
Example input content format:
|
|
||||||
content = '''
|
|
||||||
[package]
|
|
||||||
name = "my-crate"
|
|
||||||
version = "0.1.0"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
serde = "1.0"
|
|
||||||
tokio = { version = "1.0", features = ["full"] }
|
|
||||||
serde_json.workspace = true
|
|
||||||
|
|
||||||
[dev-dependencies]
|
|
||||||
tempfile = "3.0"
|
|
||||||
'''
|
|
||||||
|
|
||||||
# If dep_name = "serde", section_start = start of [dependencies],
|
|
||||||
# section_end = start of [dev-dependencies], this function will:
|
|
||||||
# 1. Extract the section: "serde = "1.0"\ntokio = { version = "1.0", features = ["full"] }\nserde_json.workspace = true\n"
|
|
||||||
# 2. Find and remove the line: "serde = "1.0""
|
|
||||||
# 3. Return the modified content with that line removed
|
|
||||||
"""
|
|
||||||
section_content = content[section_start:section_end]
|
|
||||||
|
|
||||||
dep_patterns = [
|
|
||||||
rf"^{re.escape(dep_name)}\s*=.*$", # e.g., "serde = "1.0""
|
|
||||||
rf"^{re.escape(dep_name)}\.workspace\s*=.*$", # e.g., "serde_json.workspace = true"
|
|
||||||
]
|
|
||||||
|
|
||||||
for pattern in dep_patterns:
|
|
||||||
match = re.search(pattern, section_content, re.MULTILINE)
|
|
||||||
if match:
|
|
||||||
line_start = section_start + match.start() # Start of the matched line
|
|
||||||
line_end = section_start + match.end() # End of the matched line
|
|
||||||
|
|
||||||
if line_end < len(content) and content[line_end] == "\n":
|
|
||||||
line_end += 1
|
|
||||||
|
|
||||||
return content[:line_start] + content[line_end:], True
|
|
||||||
|
|
||||||
return content, False
|
|
||||||
|
|
||||||
|
|
||||||
def remove_dependency_from_toml(file_path, dep_name, dep_type):
|
|
||||||
"""
|
|
||||||
Remove a specific dependency from a Cargo.toml file.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
file_path (str): Path to the Cargo.toml file
|
|
||||||
dep_name (str): Name of the dependency to remove
|
|
||||||
dep_type (str): Type of dependency ("normal", "dev", or "build")
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
bool: True if dependency was successfully removed, False otherwise
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
with open(file_path, "r") as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
section_patterns = get_section_pattern(dep_type)
|
|
||||||
if not section_patterns:
|
|
||||||
return False
|
|
||||||
|
|
||||||
for pattern in section_patterns:
|
|
||||||
section_match = re.search(pattern, content, re.IGNORECASE)
|
|
||||||
if not section_match:
|
|
||||||
continue
|
|
||||||
|
|
||||||
section_start = section_match.end()
|
|
||||||
next_section = re.search(r"\n\s*\[", content[section_start:])
|
|
||||||
section_end = (
|
|
||||||
section_start + next_section.start() if next_section else len(content)
|
|
||||||
)
|
|
||||||
|
|
||||||
new_content, removed = remove_dependency_line(
|
|
||||||
content, dep_name, section_start, section_end
|
|
||||||
)
|
|
||||||
if removed:
|
|
||||||
with open(file_path, "w") as f:
|
|
||||||
f.write(new_content)
|
|
||||||
return True
|
|
||||||
|
|
||||||
return False
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error processing {file_path}: {e}")
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def process_unused_dependencies(unused_deps):
|
|
||||||
"""
|
|
||||||
Process and remove all unused dependencies from their respective Cargo.toml files.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
unused_deps (dict): Dictionary of unused dependencies organized by package:
|
|
||||||
{
|
|
||||||
"package_name": {
|
|
||||||
"dependencies": [("dep1", "normal"), ("dev_dep1", "dev")],
|
|
||||||
"manifest_path": "/path/to/Cargo.toml"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
"""
|
|
||||||
if not unused_deps:
|
|
||||||
print("No unused dependencies found.")
|
|
||||||
return
|
|
||||||
|
|
||||||
total_removed = 0
|
|
||||||
total_failed = 0
|
|
||||||
|
|
||||||
for package, info in unused_deps.items():
|
|
||||||
deps = info["dependencies"]
|
|
||||||
manifest_path = info["manifest_path"]
|
|
||||||
|
|
||||||
if not os.path.exists(manifest_path):
|
|
||||||
print(f"Manifest file not found: {manifest_path}")
|
|
||||||
total_failed += len(deps)
|
|
||||||
continue
|
|
||||||
|
|
||||||
for dep, dep_type in deps:
|
|
||||||
if remove_dependency_from_toml(manifest_path, dep, dep_type):
|
|
||||||
print(f"Removed {dep} from {package}")
|
|
||||||
total_removed += 1
|
|
||||||
else:
|
|
||||||
print(f"Failed to remove {dep} from {package}")
|
|
||||||
total_failed += 1
|
|
||||||
|
|
||||||
print(f"Removed {total_removed} dependencies")
|
|
||||||
if total_failed > 0:
|
|
||||||
print(f"Failed to remove {total_failed} dependencies")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
report_path = sys.argv[1]
|
|
||||||
else:
|
|
||||||
report_path = "udeps-report.json"
|
|
||||||
|
|
||||||
report = load_udeps_report(report_path)
|
|
||||||
if report is None:
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
unused_deps = extract_unused_dependencies(report)
|
|
||||||
process_unused_dependencies(unused_deps)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Generate TLS certificates for etcd testing
|
|
||||||
# This script creates certificates for TLS-enabled etcd in testing environments
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
CERT_DIR="${1:-$(dirname "$0")/../tests-integration/fixtures/etcd-tls-certs}"
|
|
||||||
DAYS="${2:-365}"
|
|
||||||
|
|
||||||
echo "Generating TLS certificates for etcd in ${CERT_DIR}..."
|
|
||||||
|
|
||||||
mkdir -p "${CERT_DIR}"
|
|
||||||
cd "${CERT_DIR}"
|
|
||||||
|
|
||||||
echo "Generating CA private key..."
|
|
||||||
openssl genrsa -out ca-key.pem 2048
|
|
||||||
|
|
||||||
echo "Generating CA certificate..."
|
|
||||||
openssl req -new -x509 -key ca-key.pem -out ca.crt -days "${DAYS}" \
|
|
||||||
-subj "/C=US/ST=CA/L=SF/O=Greptime/CN=etcd-ca"
|
|
||||||
|
|
||||||
# Create server certificate config with Subject Alternative Names
|
|
||||||
echo "Creating server certificate configuration..."
|
|
||||||
cat > server.conf << 'EOF'
|
|
||||||
[req]
|
|
||||||
distinguished_name = req
|
|
||||||
[v3_req]
|
|
||||||
basicConstraints = CA:FALSE
|
|
||||||
keyUsage = keyEncipherment, dataEncipherment
|
|
||||||
subjectAltName = @alt_names
|
|
||||||
[alt_names]
|
|
||||||
DNS.1 = localhost
|
|
||||||
DNS.2 = etcd-tls
|
|
||||||
DNS.3 = 127.0.0.1
|
|
||||||
IP.1 = 127.0.0.1
|
|
||||||
IP.2 = ::1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo "Generating server private key..."
|
|
||||||
openssl genrsa -out server-key.pem 2048
|
|
||||||
|
|
||||||
echo "Generating server certificate signing request..."
|
|
||||||
openssl req -new -key server-key.pem -out server.csr \
|
|
||||||
-subj "/CN=etcd-tls"
|
|
||||||
|
|
||||||
echo "Generating server certificate..."
|
|
||||||
openssl x509 -req -in server.csr -CA ca.crt \
|
|
||||||
-CAkey ca-key.pem -CAcreateserial -out server.crt \
|
|
||||||
-days "${DAYS}" -extensions v3_req -extfile server.conf
|
|
||||||
|
|
||||||
echo "Generating client private key..."
|
|
||||||
openssl genrsa -out client-key.pem 2048
|
|
||||||
|
|
||||||
echo "Generating client certificate signing request..."
|
|
||||||
openssl req -new -key client-key.pem -out client.csr \
|
|
||||||
-subj "/CN=etcd-client"
|
|
||||||
|
|
||||||
echo "Generating client certificate..."
|
|
||||||
openssl x509 -req -in client.csr -CA ca.crt \
|
|
||||||
-CAkey ca-key.pem -CAcreateserial -out client.crt \
|
|
||||||
-days "${DAYS}"
|
|
||||||
|
|
||||||
echo "Setting proper file permissions..."
|
|
||||||
chmod 644 ca.crt server.crt client.crt
|
|
||||||
chmod 600 ca-key.pem server-key.pem client-key.pem
|
|
||||||
|
|
||||||
# Clean up intermediate files
|
|
||||||
rm -f server.csr client.csr server.conf
|
|
||||||
|
|
||||||
echo "TLS certificates generated successfully in ${CERT_DIR}"
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
CERT_DIR="${1:-$(dirname "$0")/../tests-integration/fixtures/certs}"
|
|
||||||
DAYS="${2:-365}"
|
|
||||||
|
|
||||||
mkdir -p "${CERT_DIR}"
|
|
||||||
cd "${CERT_DIR}"
|
|
||||||
|
|
||||||
echo "Generating CA certificate..."
|
|
||||||
openssl req -new -x509 -days "${DAYS}" -nodes -text \
|
|
||||||
-out root.crt -keyout root.key \
|
|
||||||
-subj "/CN=GreptimeDBRootCA"
|
|
||||||
|
|
||||||
|
|
||||||
echo "Generating server certificate..."
|
|
||||||
openssl req -new -nodes -text \
|
|
||||||
-out server.csr -keyout server.key \
|
|
||||||
-subj "/CN=greptime"
|
|
||||||
|
|
||||||
openssl x509 -req -in server.csr -text -days "${DAYS}" \
|
|
||||||
-CA root.crt -CAkey root.key -CAcreateserial \
|
|
||||||
-out server.crt \
|
|
||||||
-extensions v3_req -extfile <(printf "[v3_req]\nsubjectAltName=DNS:localhost,IP:127.0.0.1")
|
|
||||||
|
|
||||||
echo "Generating client certificate..."
|
|
||||||
# Make sure the client certificate is for the greptimedb user
|
|
||||||
openssl req -new -nodes -text \
|
|
||||||
-out client.csr -keyout client.key \
|
|
||||||
-subj "/CN=greptimedb"
|
|
||||||
|
|
||||||
openssl x509 -req -in client.csr -CA root.crt -CAkey root.key -CAcreateserial \
|
|
||||||
-out client.crt -days 365 -extensions v3_req -extfile <(printf "[v3_req]\nsubjectAltName=DNS:localhost")
|
|
||||||
|
|
||||||
rm -f *.csr
|
|
||||||
|
|
||||||
echo "TLS certificates generated successfully in ${CERT_DIR}"
|
|
||||||
|
|
||||||
chmod 644 root.key
|
|
||||||
chmod 644 client.key
|
|
||||||
chmod 644 server.key
|
|
||||||
149
scripts/install.sh
Normal file → Executable file
149
scripts/install.sh
Normal file → Executable file
@@ -53,54 +53,6 @@ get_arch_type() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verify SHA256 checksum
|
|
||||||
verify_sha256() {
|
|
||||||
file="$1"
|
|
||||||
expected_sha256="$2"
|
|
||||||
|
|
||||||
if command -v sha256sum >/dev/null 2>&1; then
|
|
||||||
actual_sha256=$(sha256sum "$file" | cut -d' ' -f1)
|
|
||||||
elif command -v shasum >/dev/null 2>&1; then
|
|
||||||
actual_sha256=$(shasum -a 256 "$file" | cut -d' ' -f1)
|
|
||||||
else
|
|
||||||
echo "Warning: No SHA256 verification tool found (sha256sum or shasum). Skipping checksum verification."
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$actual_sha256" = "$expected_sha256" ]; then
|
|
||||||
echo "SHA256 checksum verified successfully."
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo "Error: SHA256 checksum verification failed!"
|
|
||||||
echo "Expected: $expected_sha256"
|
|
||||||
echo "Actual: $actual_sha256"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Prompt for user confirmation (compatible with different shells)
|
|
||||||
prompt_confirmation() {
|
|
||||||
message="$1"
|
|
||||||
printf "%s (y/N): " "$message"
|
|
||||||
|
|
||||||
# Try to read user input, fallback if read fails
|
|
||||||
answer=""
|
|
||||||
if read answer </dev/tty 2>/dev/null; then
|
|
||||||
case "$answer" in
|
|
||||||
[Yy]|[Yy][Ee][Ss])
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
echo "Cannot read user input. Defaulting to No."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
download_artifact() {
|
download_artifact() {
|
||||||
if [ -n "${OS_TYPE}" ] && [ -n "${ARCH_TYPE}" ]; then
|
if [ -n "${OS_TYPE}" ] && [ -n "${ARCH_TYPE}" ]; then
|
||||||
# Use the latest stable released version.
|
# Use the latest stable released version.
|
||||||
@@ -119,104 +71,17 @@ download_artifact() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Downloading ${BIN}, OS: ${OS_TYPE}, Arch: ${ARCH_TYPE}, Version: ${VERSION}"
|
echo "Downloading ${BIN}, OS: ${OS_TYPE}, Arch: ${ARCH_TYPE}, Version: ${VERSION}"
|
||||||
PKG_NAME="${BIN}-${OS_TYPE}-${ARCH_TYPE}-${VERSION}"
|
PACKAGE_NAME="${BIN}-${OS_TYPE}-${ARCH_TYPE}-${VERSION}.tar.gz"
|
||||||
PACKAGE_NAME="${PKG_NAME}.tar.gz"
|
|
||||||
SHA256_FILE="${PKG_NAME}.sha256sum"
|
|
||||||
|
|
||||||
if [ -n "${PACKAGE_NAME}" ]; then
|
if [ -n "${PACKAGE_NAME}" ]; then
|
||||||
# Check if files already exist and prompt for override
|
wget "https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download/${VERSION}/${PACKAGE_NAME}"
|
||||||
if [ -f "${PACKAGE_NAME}" ]; then
|
|
||||||
echo "File ${PACKAGE_NAME} already exists."
|
|
||||||
if prompt_confirmation "Do you want to override it?"; then
|
|
||||||
echo "Overriding existing file..."
|
|
||||||
rm -f "${PACKAGE_NAME}"
|
|
||||||
else
|
|
||||||
echo "Skipping download. Using existing file."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "${BIN}" ]; then
|
|
||||||
echo "Binary ${BIN} already exists."
|
|
||||||
if prompt_confirmation "Do you want to override it?"; then
|
|
||||||
echo "Will override existing binary..."
|
|
||||||
rm -f "${BIN}"
|
|
||||||
else
|
|
||||||
echo "Installation cancelled."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download package if not exists
|
|
||||||
if [ ! -f "${PACKAGE_NAME}" ]; then
|
|
||||||
echo "Downloading ${PACKAGE_NAME}..."
|
|
||||||
# Use curl instead of wget for better compatibility
|
|
||||||
if command -v curl >/dev/null 2>&1; then
|
|
||||||
if ! curl -L -o "${PACKAGE_NAME}" "https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download/${VERSION}/${PACKAGE_NAME}"; then
|
|
||||||
echo "Error: Failed to download ${PACKAGE_NAME}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
elif command -v wget >/dev/null 2>&1; then
|
|
||||||
if ! wget -O "${PACKAGE_NAME}" "https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download/${VERSION}/${PACKAGE_NAME}"; then
|
|
||||||
echo "Error: Failed to download ${PACKAGE_NAME}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Error: Neither curl nor wget is available for downloading."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download and verify SHA256 checksum
|
|
||||||
echo "Downloading SHA256 checksum..."
|
|
||||||
sha256_download_success=0
|
|
||||||
if command -v curl >/dev/null 2>&1; then
|
|
||||||
if curl -L -s -o "${SHA256_FILE}" "https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download/${VERSION}/${SHA256_FILE}" 2>/dev/null; then
|
|
||||||
sha256_download_success=1
|
|
||||||
fi
|
|
||||||
elif command -v wget >/dev/null 2>&1; then
|
|
||||||
if wget -q -O "${SHA256_FILE}" "https://github.com/${GITHUB_ORG}/${GITHUB_REPO}/releases/download/${VERSION}/${SHA256_FILE}" 2>/dev/null; then
|
|
||||||
sha256_download_success=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $sha256_download_success -eq 1 ] && [ -f "${SHA256_FILE}" ]; then
|
|
||||||
expected_sha256=$(cat "${SHA256_FILE}" | cut -d' ' -f1)
|
|
||||||
if [ -n "$expected_sha256" ]; then
|
|
||||||
if ! verify_sha256 "${PACKAGE_NAME}" "${expected_sha256}"; then
|
|
||||||
echo "SHA256 verification failed. Removing downloaded file."
|
|
||||||
rm -f "${PACKAGE_NAME}" "${SHA256_FILE}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Warning: Could not parse SHA256 checksum from file."
|
|
||||||
fi
|
|
||||||
rm -f "${SHA256_FILE}"
|
|
||||||
else
|
|
||||||
echo "Warning: Could not download SHA256 checksum file. Skipping verification."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Extract the binary and clean the rest.
|
# Extract the binary and clean the rest.
|
||||||
echo "Extracting ${PACKAGE_NAME}..."
|
tar xvf "${PACKAGE_NAME}" && \
|
||||||
if ! tar xf "${PACKAGE_NAME}"; then
|
mv "${PACKAGE_NAME%.tar.gz}/${BIN}" "${PWD}" && \
|
||||||
echo "Error: Failed to extract ${PACKAGE_NAME}"
|
rm -r "${PACKAGE_NAME}" && \
|
||||||
exit 1
|
rm -r "${PACKAGE_NAME%.tar.gz}" && \
|
||||||
fi
|
echo "Run './${BIN} --help' to get started"
|
||||||
|
|
||||||
# Find the binary in the extracted directory
|
|
||||||
extracted_dir="${PACKAGE_NAME%.tar.gz}"
|
|
||||||
if [ -f "${extracted_dir}/${BIN}" ]; then
|
|
||||||
mv "${extracted_dir}/${BIN}" "${PWD}/"
|
|
||||||
rm -f "${PACKAGE_NAME}"
|
|
||||||
rm -rf "${extracted_dir}"
|
|
||||||
chmod +x "${BIN}"
|
|
||||||
echo "Installation completed successfully!"
|
|
||||||
echo "Run './${BIN} --help' to get started"
|
|
||||||
else
|
|
||||||
echo "Error: Binary ${BIN} not found in extracted archive"
|
|
||||||
rm -f "${PACKAGE_NAME}"
|
|
||||||
rm -rf "${extracted_dir}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ license.workspace = true
|
|||||||
workspace = true
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrow-schema.workspace = true
|
|
||||||
common-base.workspace = true
|
common-base.workspace = true
|
||||||
common-decimal.workspace = true
|
common-decimal.workspace = true
|
||||||
common-error.workspace = true
|
common-error.workspace = true
|
||||||
@@ -20,3 +19,6 @@ paste.workspace = true
|
|||||||
prost.workspace = true
|
prost.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
snafu.workspace = true
|
snafu.workspace = true
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
tonic-build = "0.11"
|
||||||
|
|||||||
@@ -17,10 +17,9 @@ use std::any::Any;
|
|||||||
use common_error::ext::ErrorExt;
|
use common_error::ext::ErrorExt;
|
||||||
use common_error::status_code::StatusCode;
|
use common_error::status_code::StatusCode;
|
||||||
use common_macro::stack_trace_debug;
|
use common_macro::stack_trace_debug;
|
||||||
use common_time::timestamp::TimeUnit;
|
|
||||||
use datatypes::prelude::ConcreteDataType;
|
use datatypes::prelude::ConcreteDataType;
|
||||||
use snafu::Location;
|
|
||||||
use snafu::prelude::*;
|
use snafu::prelude::*;
|
||||||
|
use snafu::Location;
|
||||||
|
|
||||||
pub type Result<T> = std::result::Result<T, Error>;
|
pub type Result<T> = std::result::Result<T, Error>;
|
||||||
|
|
||||||
@@ -67,28 +66,12 @@ pub enum Error {
|
|||||||
#[snafu(implicit)]
|
#[snafu(implicit)]
|
||||||
location: Location,
|
location: Location,
|
||||||
},
|
},
|
||||||
|
|
||||||
#[snafu(display("Invalid time unit: {time_unit}"))]
|
|
||||||
InvalidTimeUnit {
|
|
||||||
time_unit: i32,
|
|
||||||
#[snafu(implicit)]
|
|
||||||
location: Location,
|
|
||||||
},
|
|
||||||
|
|
||||||
#[snafu(display("Inconsistent time unit: {:?}", units))]
|
|
||||||
InconsistentTimeUnit {
|
|
||||||
units: Vec<TimeUnit>,
|
|
||||||
#[snafu(implicit)]
|
|
||||||
location: Location,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ErrorExt for Error {
|
impl ErrorExt for Error {
|
||||||
fn status_code(&self) -> StatusCode {
|
fn status_code(&self) -> StatusCode {
|
||||||
match self {
|
match self {
|
||||||
Error::UnknownColumnDataType { .. }
|
Error::UnknownColumnDataType { .. } => StatusCode::InvalidArguments,
|
||||||
| Error::InvalidTimeUnit { .. }
|
|
||||||
| Error::InconsistentTimeUnit { .. } => StatusCode::InvalidArguments,
|
|
||||||
Error::IntoColumnDataType { .. } | Error::SerializeJson { .. } => {
|
Error::IntoColumnDataType { .. } | Error::SerializeJson { .. } => {
|
||||||
StatusCode::Unexpected
|
StatusCode::Unexpected
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,8 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
#![feature(let_chains)]
|
||||||
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod helper;
|
pub mod helper;
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
pub mod column_def;
|
pub mod column_def;
|
||||||
|
|
||||||
pub mod helper;
|
|
||||||
|
|
||||||
pub mod meta {
|
pub mod meta {
|
||||||
pub use greptime_proto::v1::meta::*;
|
pub use greptime_proto::v1::meta::*;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,18 +14,17 @@
|
|||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use arrow_schema::extension::{EXTENSION_TYPE_METADATA_KEY, EXTENSION_TYPE_NAME_KEY};
|
|
||||||
use datatypes::schema::{
|
use datatypes::schema::{
|
||||||
COMMENT_KEY, ColumnDefaultConstraint, ColumnSchema, FULLTEXT_KEY, FulltextAnalyzer,
|
ColumnDefaultConstraint, ColumnSchema, FulltextAnalyzer, FulltextBackend, FulltextOptions,
|
||||||
FulltextBackend, FulltextOptions, INVERTED_INDEX_KEY, SKIPPING_INDEX_KEY, SkippingIndexOptions,
|
SkippingIndexOptions, SkippingIndexType, COMMENT_KEY, FULLTEXT_KEY, INVERTED_INDEX_KEY,
|
||||||
SkippingIndexType,
|
SKIPPING_INDEX_KEY,
|
||||||
};
|
};
|
||||||
use greptime_proto::v1::{
|
use greptime_proto::v1::{
|
||||||
Analyzer, FulltextBackend as PbFulltextBackend, SkippingIndexType as PbSkippingIndexType,
|
Analyzer, FulltextBackend as PbFulltextBackend, SkippingIndexType as PbSkippingIndexType,
|
||||||
};
|
};
|
||||||
use snafu::ResultExt;
|
use snafu::ResultExt;
|
||||||
|
|
||||||
use crate::error::{self, ConvertColumnDefaultConstraintSnafu, Result};
|
use crate::error::{self, Result};
|
||||||
use crate::helper::ColumnDataTypeWrapper;
|
use crate::helper::ColumnDataTypeWrapper;
|
||||||
use crate::v1::{ColumnDef, ColumnOptions, SemanticType};
|
use crate::v1::{ColumnDef, ColumnOptions, SemanticType};
|
||||||
|
|
||||||
@@ -38,10 +37,8 @@ const SKIPPING_INDEX_GRPC_KEY: &str = "skipping_index";
|
|||||||
|
|
||||||
/// Tries to construct a `ColumnSchema` from the given `ColumnDef`.
|
/// Tries to construct a `ColumnSchema` from the given `ColumnDef`.
|
||||||
pub fn try_as_column_schema(column_def: &ColumnDef) -> Result<ColumnSchema> {
|
pub fn try_as_column_schema(column_def: &ColumnDef) -> Result<ColumnSchema> {
|
||||||
let data_type = ColumnDataTypeWrapper::try_new(
|
let data_type =
|
||||||
column_def.data_type,
|
ColumnDataTypeWrapper::try_new(column_def.data_type, column_def.datatype_extension)?;
|
||||||
column_def.datatype_extension.clone(),
|
|
||||||
)?;
|
|
||||||
|
|
||||||
let constraint = if column_def.default_constraint.is_empty() {
|
let constraint = if column_def.default_constraint.is_empty() {
|
||||||
None
|
None
|
||||||
@@ -69,15 +66,6 @@ pub fn try_as_column_schema(column_def: &ColumnDef) -> Result<ColumnSchema> {
|
|||||||
if let Some(skipping_index) = options.options.get(SKIPPING_INDEX_GRPC_KEY) {
|
if let Some(skipping_index) = options.options.get(SKIPPING_INDEX_GRPC_KEY) {
|
||||||
metadata.insert(SKIPPING_INDEX_KEY.to_string(), skipping_index.to_owned());
|
metadata.insert(SKIPPING_INDEX_KEY.to_string(), skipping_index.to_owned());
|
||||||
}
|
}
|
||||||
if let Some(extension_name) = options.options.get(EXTENSION_TYPE_NAME_KEY) {
|
|
||||||
metadata.insert(EXTENSION_TYPE_NAME_KEY.to_string(), extension_name.clone());
|
|
||||||
}
|
|
||||||
if let Some(extension_metadata) = options.options.get(EXTENSION_TYPE_METADATA_KEY) {
|
|
||||||
metadata.insert(
|
|
||||||
EXTENSION_TYPE_METADATA_KEY.to_string(),
|
|
||||||
extension_metadata.clone(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnSchema::new(&column_def.name, data_type.into(), column_def.is_nullable)
|
ColumnSchema::new(&column_def.name, data_type.into(), column_def.is_nullable)
|
||||||
@@ -89,48 +77,6 @@ pub fn try_as_column_schema(column_def: &ColumnDef) -> Result<ColumnSchema> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tries to construct a `ColumnDef` from the given `ColumnSchema`.
|
|
||||||
///
|
|
||||||
/// TODO(weny): Add tests for this function.
|
|
||||||
pub fn try_as_column_def(column_schema: &ColumnSchema, is_primary_key: bool) -> Result<ColumnDef> {
|
|
||||||
let column_datatype =
|
|
||||||
ColumnDataTypeWrapper::try_from(column_schema.data_type.clone()).map(|w| w.to_parts())?;
|
|
||||||
|
|
||||||
let semantic_type = if column_schema.is_time_index() {
|
|
||||||
SemanticType::Timestamp
|
|
||||||
} else if is_primary_key {
|
|
||||||
SemanticType::Tag
|
|
||||||
} else {
|
|
||||||
SemanticType::Field
|
|
||||||
} as i32;
|
|
||||||
let comment = column_schema
|
|
||||||
.metadata()
|
|
||||||
.get(COMMENT_KEY)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or_default();
|
|
||||||
|
|
||||||
let default_constraint = match column_schema.default_constraint() {
|
|
||||||
None => vec![],
|
|
||||||
Some(v) => v
|
|
||||||
.clone()
|
|
||||||
.try_into()
|
|
||||||
.context(ConvertColumnDefaultConstraintSnafu {
|
|
||||||
column: &column_schema.name,
|
|
||||||
})?,
|
|
||||||
};
|
|
||||||
let options = options_from_column_schema(column_schema);
|
|
||||||
Ok(ColumnDef {
|
|
||||||
name: column_schema.name.clone(),
|
|
||||||
data_type: column_datatype.0 as i32,
|
|
||||||
is_nullable: column_schema.is_nullable(),
|
|
||||||
default_constraint,
|
|
||||||
semantic_type,
|
|
||||||
comment,
|
|
||||||
datatype_extension: column_datatype.1,
|
|
||||||
options,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Constructs a `ColumnOptions` from the given `ColumnSchema`.
|
/// Constructs a `ColumnOptions` from the given `ColumnSchema`.
|
||||||
pub fn options_from_column_schema(column_schema: &ColumnSchema) -> Option<ColumnOptions> {
|
pub fn options_from_column_schema(column_schema: &ColumnSchema) -> Option<ColumnOptions> {
|
||||||
let mut options = ColumnOptions::default();
|
let mut options = ColumnOptions::default();
|
||||||
@@ -149,17 +95,6 @@ pub fn options_from_column_schema(column_schema: &ColumnSchema) -> Option<Column
|
|||||||
.options
|
.options
|
||||||
.insert(SKIPPING_INDEX_GRPC_KEY.to_string(), skipping_index.clone());
|
.insert(SKIPPING_INDEX_GRPC_KEY.to_string(), skipping_index.clone());
|
||||||
}
|
}
|
||||||
if let Some(extension_name) = column_schema.metadata().get(EXTENSION_TYPE_NAME_KEY) {
|
|
||||||
options
|
|
||||||
.options
|
|
||||||
.insert(EXTENSION_TYPE_NAME_KEY.to_string(), extension_name.clone());
|
|
||||||
}
|
|
||||||
if let Some(extension_metadata) = column_schema.metadata().get(EXTENSION_TYPE_METADATA_KEY) {
|
|
||||||
options.options.insert(
|
|
||||||
EXTENSION_TYPE_METADATA_KEY.to_string(),
|
|
||||||
extension_metadata.clone(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
(!options.options.is_empty()).then_some(options)
|
(!options.options.is_empty()).then_some(options)
|
||||||
}
|
}
|
||||||
@@ -291,20 +226,18 @@ mod tests {
|
|||||||
assert!(options.is_none());
|
assert!(options.is_none());
|
||||||
|
|
||||||
let mut schema = ColumnSchema::new("test", ConcreteDataType::string_datatype(), true)
|
let mut schema = ColumnSchema::new("test", ConcreteDataType::string_datatype(), true)
|
||||||
.with_fulltext_options(FulltextOptions::new_unchecked(
|
.with_fulltext_options(FulltextOptions {
|
||||||
true,
|
enable: true,
|
||||||
FulltextAnalyzer::English,
|
analyzer: FulltextAnalyzer::English,
|
||||||
false,
|
case_sensitive: false,
|
||||||
FulltextBackend::Bloom,
|
backend: FulltextBackend::Bloom,
|
||||||
10240,
|
})
|
||||||
0.01,
|
|
||||||
))
|
|
||||||
.unwrap();
|
.unwrap();
|
||||||
schema.set_inverted_index(true);
|
schema.set_inverted_index(true);
|
||||||
let options = options_from_column_schema(&schema).unwrap();
|
let options = options_from_column_schema(&schema).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
options.options.get(FULLTEXT_GRPC_KEY).unwrap(),
|
options.options.get(FULLTEXT_GRPC_KEY).unwrap(),
|
||||||
"{\"enable\":true,\"analyzer\":\"English\",\"case-sensitive\":false,\"backend\":\"bloom\",\"granularity\":10240,\"false-positive-rate-in-10000\":100}"
|
"{\"enable\":true,\"analyzer\":\"English\",\"case-sensitive\":false,\"backend\":\"bloom\"}"
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
options.options.get(INVERTED_INDEX_GRPC_KEY).unwrap(),
|
options.options.get(INVERTED_INDEX_GRPC_KEY).unwrap(),
|
||||||
@@ -314,18 +247,16 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_options_with_fulltext() {
|
fn test_options_with_fulltext() {
|
||||||
let fulltext = FulltextOptions::new_unchecked(
|
let fulltext = FulltextOptions {
|
||||||
true,
|
enable: true,
|
||||||
FulltextAnalyzer::English,
|
analyzer: FulltextAnalyzer::English,
|
||||||
false,
|
case_sensitive: false,
|
||||||
FulltextBackend::Bloom,
|
backend: FulltextBackend::Bloom,
|
||||||
10240,
|
};
|
||||||
0.01,
|
|
||||||
);
|
|
||||||
let options = options_from_fulltext(&fulltext).unwrap().unwrap();
|
let options = options_from_fulltext(&fulltext).unwrap().unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
options.options.get(FULLTEXT_GRPC_KEY).unwrap(),
|
options.options.get(FULLTEXT_GRPC_KEY).unwrap(),
|
||||||
"{\"enable\":true,\"analyzer\":\"English\",\"case-sensitive\":false,\"backend\":\"bloom\",\"granularity\":10240,\"false-positive-rate-in-10000\":100}"
|
"{\"enable\":true,\"analyzer\":\"English\",\"case-sensitive\":false,\"backend\":\"bloom\"}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
// Copyright 2023 Greptime Team
|
|
||||||
//
|
|
||||||
// Licensed 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.
|
|
||||||
|
|
||||||
use greptime_proto::v1::value::ValueData;
|
|
||||||
use greptime_proto::v1::{ColumnDataType, ColumnSchema, Row, SemanticType, Value};
|
|
||||||
|
|
||||||
/// Create a time index [ColumnSchema] with column's name and datatype.
|
|
||||||
/// Other fields are left default.
|
|
||||||
/// Useful when you just want to create a simple [ColumnSchema] without providing much struct fields.
|
|
||||||
pub fn time_index_column_schema(name: &str, datatype: ColumnDataType) -> ColumnSchema {
|
|
||||||
ColumnSchema {
|
|
||||||
column_name: name.to_string(),
|
|
||||||
datatype: datatype as i32,
|
|
||||||
semantic_type: SemanticType::Timestamp as i32,
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a tag [ColumnSchema] with column's name and datatype.
|
|
||||||
/// Other fields are left default.
|
|
||||||
/// Useful when you just want to create a simple [ColumnSchema] without providing much struct fields.
|
|
||||||
pub fn tag_column_schema(name: &str, datatype: ColumnDataType) -> ColumnSchema {
|
|
||||||
ColumnSchema {
|
|
||||||
column_name: name.to_string(),
|
|
||||||
datatype: datatype as i32,
|
|
||||||
semantic_type: SemanticType::Tag as i32,
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a field [ColumnSchema] with column's name and datatype.
|
|
||||||
/// Other fields are left default.
|
|
||||||
/// Useful when you just want to create a simple [ColumnSchema] without providing much struct fields.
|
|
||||||
pub fn field_column_schema(name: &str, datatype: ColumnDataType) -> ColumnSchema {
|
|
||||||
ColumnSchema {
|
|
||||||
column_name: name.to_string(),
|
|
||||||
datatype: datatype as i32,
|
|
||||||
semantic_type: SemanticType::Field as i32,
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a [Row] from [ValueData]s.
|
|
||||||
/// Useful when you don't want to write much verbose codes.
|
|
||||||
pub fn row(values: Vec<ValueData>) -> Row {
|
|
||||||
Row {
|
|
||||||
values: values
|
|
||||||
.into_iter()
|
|
||||||
.map(|x| Value {
|
|
||||||
value_data: Some(x),
|
|
||||||
})
|
|
||||||
.collect::<Vec<_>>(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,13 +17,13 @@ use std::sync::Arc;
|
|||||||
use common_base::secrets::SecretString;
|
use common_base::secrets::SecretString;
|
||||||
use digest::Digest;
|
use digest::Digest;
|
||||||
use sha1::Sha1;
|
use sha1::Sha1;
|
||||||
use snafu::{OptionExt, ensure};
|
use snafu::{ensure, OptionExt};
|
||||||
|
|
||||||
use crate::error::{IllegalParamSnafu, InvalidConfigSnafu, Result, UserPasswordMismatchSnafu};
|
use crate::error::{IllegalParamSnafu, InvalidConfigSnafu, Result, UserPasswordMismatchSnafu};
|
||||||
use crate::user_info::DefaultUserInfo;
|
use crate::user_info::DefaultUserInfo;
|
||||||
use crate::user_provider::static_user_provider::{STATIC_USER_PROVIDER, StaticUserProvider};
|
use crate::user_provider::static_user_provider::{StaticUserProvider, STATIC_USER_PROVIDER};
|
||||||
use crate::user_provider::watch_file_user_provider::{
|
use crate::user_provider::watch_file_user_provider::{
|
||||||
WATCH_FILE_USER_PROVIDER, WatchFileUserProvider,
|
WatchFileUserProvider, WATCH_FILE_USER_PROVIDER,
|
||||||
};
|
};
|
||||||
use crate::{UserInfoRef, UserProviderRef};
|
use crate::{UserInfoRef, UserProviderRef};
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ pub fn userinfo_by_name(username: Option<String>) -> UserInfoRef {
|
|||||||
DefaultUserInfo::with_name(username.unwrap_or_else(|| DEFAULT_USERNAME.to_string()))
|
DefaultUserInfo::with_name(username.unwrap_or_else(|| DEFAULT_USERNAME.to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn user_provider_from_option(opt: &str) -> Result<UserProviderRef> {
|
pub fn user_provider_from_option(opt: &String) -> Result<UserProviderRef> {
|
||||||
let (name, content) = opt.split_once(':').with_context(|| InvalidConfigSnafu {
|
let (name, content) = opt.split_once(':').with_context(|| InvalidConfigSnafu {
|
||||||
value: opt.to_string(),
|
value: opt.to_string(),
|
||||||
msg: "UserProviderOption must be in format `<option>:<value>`",
|
msg: "UserProviderOption must be in format `<option>:<value>`",
|
||||||
@@ -57,7 +57,7 @@ pub fn user_provider_from_option(opt: &str) -> Result<UserProviderRef> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn static_user_provider_from_option(opt: &str) -> Result<StaticUserProvider> {
|
pub fn static_user_provider_from_option(opt: &String) -> Result<StaticUserProvider> {
|
||||||
let (name, content) = opt.split_once(':').with_context(|| InvalidConfigSnafu {
|
let (name, content) = opt.split_once(':').with_context(|| InvalidConfigSnafu {
|
||||||
value: opt.to_string(),
|
value: opt.to_string(),
|
||||||
msg: "UserProviderOption must be in format `<option>:<value>`",
|
msg: "UserProviderOption must be in format `<option>:<value>`",
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ mod user_provider;
|
|||||||
pub mod tests;
|
pub mod tests;
|
||||||
|
|
||||||
pub use common::{
|
pub use common::{
|
||||||
HashedPassword, Identity, Password, auth_mysql, static_user_provider_from_option,
|
auth_mysql, static_user_provider_from_option, user_provider_from_option, userinfo_by_name,
|
||||||
user_provider_from_option, userinfo_by_name,
|
HashedPassword, Identity, Password,
|
||||||
};
|
};
|
||||||
pub use permission::{DefaultPermissionChecker, PermissionChecker, PermissionReq, PermissionResp};
|
pub use permission::{PermissionChecker, PermissionReq, PermissionResp};
|
||||||
pub use user_info::UserInfo;
|
pub use user_info::UserInfo;
|
||||||
pub use user_provider::UserProvider;
|
|
||||||
pub use user_provider::static_user_provider::StaticUserProvider;
|
pub use user_provider::static_user_provider::StaticUserProvider;
|
||||||
|
pub use user_provider::UserProvider;
|
||||||
|
|
||||||
/// pub type alias
|
/// pub type alias
|
||||||
pub type UserInfoRef = std::sync::Arc<dyn UserInfo>;
|
pub type UserInfoRef = std::sync::Arc<dyn UserInfo>;
|
||||||
|
|||||||
@@ -13,15 +13,12 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use api::v1::greptime_request::Request;
|
use api::v1::greptime_request::Request;
|
||||||
use common_telemetry::debug;
|
|
||||||
use sql::statements::statement::Statement;
|
use sql::statements::statement::Statement;
|
||||||
|
|
||||||
use crate::error::{PermissionDeniedSnafu, Result};
|
use crate::error::{PermissionDeniedSnafu, Result};
|
||||||
use crate::user_info::DefaultUserInfo;
|
use crate::{PermissionCheckerRef, UserInfoRef};
|
||||||
use crate::{PermissionCheckerRef, UserInfo, UserInfoRef};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum PermissionReq<'a> {
|
pub enum PermissionReq<'a> {
|
||||||
@@ -35,33 +32,6 @@ pub enum PermissionReq<'a> {
|
|||||||
PromStoreRead,
|
PromStoreRead,
|
||||||
Otlp,
|
Otlp,
|
||||||
LogWrite,
|
LogWrite,
|
||||||
BulkInsert,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<'a> PermissionReq<'a> {
|
|
||||||
/// Returns true if the permission request is for read operations.
|
|
||||||
pub fn is_readonly(&self) -> bool {
|
|
||||||
match self {
|
|
||||||
PermissionReq::GrpcRequest(Request::Query(_))
|
|
||||||
| PermissionReq::PromQuery
|
|
||||||
| PermissionReq::LogQuery
|
|
||||||
| PermissionReq::PromStoreRead => true,
|
|
||||||
PermissionReq::SqlStatement(stmt) => stmt.is_readonly(),
|
|
||||||
|
|
||||||
PermissionReq::GrpcRequest(_)
|
|
||||||
| PermissionReq::Opentsdb
|
|
||||||
| PermissionReq::LineProtocol
|
|
||||||
| PermissionReq::PromStoreWrite
|
|
||||||
| PermissionReq::Otlp
|
|
||||||
| PermissionReq::LogWrite
|
|
||||||
| PermissionReq::BulkInsert => false,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if the permission request is for write operations.
|
|
||||||
pub fn is_write(&self) -> bool {
|
|
||||||
!self.is_readonly()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -94,106 +64,3 @@ impl PermissionChecker for Option<&PermissionCheckerRef> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The default permission checker implementation.
|
|
||||||
/// It checks the permission mode of [DefaultUserInfo].
|
|
||||||
pub struct DefaultPermissionChecker;
|
|
||||||
|
|
||||||
impl DefaultPermissionChecker {
|
|
||||||
/// Returns a new [PermissionCheckerRef] instance.
|
|
||||||
pub fn arc() -> PermissionCheckerRef {
|
|
||||||
Arc::new(DefaultPermissionChecker)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PermissionChecker for DefaultPermissionChecker {
|
|
||||||
fn check_permission(
|
|
||||||
&self,
|
|
||||||
user_info: UserInfoRef,
|
|
||||||
req: PermissionReq,
|
|
||||||
) -> Result<PermissionResp> {
|
|
||||||
if let Some(default_user) = user_info.as_any().downcast_ref::<DefaultUserInfo>() {
|
|
||||||
let permission_mode = default_user.permission_mode();
|
|
||||||
|
|
||||||
if req.is_readonly() && !permission_mode.can_read() {
|
|
||||||
debug!(
|
|
||||||
"Permission denied: read operation not allowed, user = {}, permission = {}",
|
|
||||||
default_user.username(),
|
|
||||||
permission_mode.as_str()
|
|
||||||
);
|
|
||||||
return Ok(PermissionResp::Reject);
|
|
||||||
}
|
|
||||||
|
|
||||||
if req.is_write() && !permission_mode.can_write() {
|
|
||||||
debug!(
|
|
||||||
"Permission denied: write operation not allowed, user = {}, permission = {}",
|
|
||||||
default_user.username(),
|
|
||||||
permission_mode.as_str()
|
|
||||||
);
|
|
||||||
return Ok(PermissionResp::Reject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// default allow all
|
|
||||||
Ok(PermissionResp::Allow)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
use crate::user_info::PermissionMode;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_default_permission_checker_allow_all_operations() {
|
|
||||||
let checker = DefaultPermissionChecker;
|
|
||||||
let user_info =
|
|
||||||
DefaultUserInfo::with_name_and_permission("test_user", PermissionMode::ReadWrite);
|
|
||||||
|
|
||||||
let read_req = PermissionReq::PromQuery;
|
|
||||||
let write_req = PermissionReq::PromStoreWrite;
|
|
||||||
|
|
||||||
let read_result = checker
|
|
||||||
.check_permission(user_info.clone(), read_req)
|
|
||||||
.unwrap();
|
|
||||||
let write_result = checker.check_permission(user_info, write_req).unwrap();
|
|
||||||
|
|
||||||
assert!(matches!(read_result, PermissionResp::Allow));
|
|
||||||
assert!(matches!(write_result, PermissionResp::Allow));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_default_permission_checker_readonly_user() {
|
|
||||||
let checker = DefaultPermissionChecker;
|
|
||||||
let user_info =
|
|
||||||
DefaultUserInfo::with_name_and_permission("readonly_user", PermissionMode::ReadOnly);
|
|
||||||
|
|
||||||
let read_req = PermissionReq::PromQuery;
|
|
||||||
let write_req = PermissionReq::PromStoreWrite;
|
|
||||||
|
|
||||||
let read_result = checker
|
|
||||||
.check_permission(user_info.clone(), read_req)
|
|
||||||
.unwrap();
|
|
||||||
let write_result = checker.check_permission(user_info, write_req).unwrap();
|
|
||||||
|
|
||||||
assert!(matches!(read_result, PermissionResp::Allow));
|
|
||||||
assert!(matches!(write_result, PermissionResp::Reject));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_default_permission_checker_writeonly_user() {
|
|
||||||
let checker = DefaultPermissionChecker;
|
|
||||||
let user_info =
|
|
||||||
DefaultUserInfo::with_name_and_permission("writeonly_user", PermissionMode::WriteOnly);
|
|
||||||
|
|
||||||
let read_req = PermissionReq::LogQuery;
|
|
||||||
let write_req = PermissionReq::LogWrite;
|
|
||||||
|
|
||||||
let read_result = checker
|
|
||||||
.check_permission(user_info.clone(), read_req)
|
|
||||||
.unwrap();
|
|
||||||
let write_result = checker.check_permission(user_info, write_req).unwrap();
|
|
||||||
|
|
||||||
assert!(matches!(read_result, PermissionResp::Reject));
|
|
||||||
assert!(matches!(write_result, PermissionResp::Allow));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ use crate::error::{
|
|||||||
UserPasswordMismatchSnafu,
|
UserPasswordMismatchSnafu,
|
||||||
};
|
};
|
||||||
use crate::user_info::DefaultUserInfo;
|
use crate::user_info::DefaultUserInfo;
|
||||||
use crate::{Identity, Password, UserInfoRef, UserProvider, auth_mysql};
|
use crate::{auth_mysql, Identity, Password, UserInfoRef, UserProvider};
|
||||||
|
|
||||||
pub struct DatabaseAuthInfo<'a> {
|
pub struct DatabaseAuthInfo<'a> {
|
||||||
pub catalog: &'a str,
|
pub catalog: &'a str,
|
||||||
|
|||||||
@@ -23,86 +23,17 @@ pub trait UserInfo: Debug + Sync + Send {
|
|||||||
fn username(&self) -> &str;
|
fn username(&self) -> &str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The user permission mode
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
|
|
||||||
pub enum PermissionMode {
|
|
||||||
#[default]
|
|
||||||
ReadWrite,
|
|
||||||
ReadOnly,
|
|
||||||
WriteOnly,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PermissionMode {
|
|
||||||
/// Parse permission mode from string.
|
|
||||||
/// Supported values are:
|
|
||||||
/// - "rw", "readwrite", "read_write" => ReadWrite
|
|
||||||
/// - "ro", "readonly", "read_only" => ReadOnly
|
|
||||||
/// - "wo", "writeonly", "write_only" => WriteOnly
|
|
||||||
/// Returns None if the input string is not a valid permission mode.
|
|
||||||
pub fn from_str(s: &str) -> Self {
|
|
||||||
match s.to_lowercase().as_str() {
|
|
||||||
"readwrite" | "read_write" | "rw" => PermissionMode::ReadWrite,
|
|
||||||
"readonly" | "read_only" | "ro" => PermissionMode::ReadOnly,
|
|
||||||
"writeonly" | "write_only" | "wo" => PermissionMode::WriteOnly,
|
|
||||||
_ => PermissionMode::ReadWrite,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Convert permission mode to string.
|
|
||||||
/// - ReadWrite => "rw"
|
|
||||||
/// - ReadOnly => "ro"
|
|
||||||
/// - WriteOnly => "wo"
|
|
||||||
/// The returned string is a static string slice.
|
|
||||||
pub fn as_str(&self) -> &'static str {
|
|
||||||
match self {
|
|
||||||
PermissionMode::ReadWrite => "rw",
|
|
||||||
PermissionMode::ReadOnly => "ro",
|
|
||||||
PermissionMode::WriteOnly => "wo",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if the permission mode allows read operations.
|
|
||||||
pub fn can_read(&self) -> bool {
|
|
||||||
matches!(self, PermissionMode::ReadWrite | PermissionMode::ReadOnly)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true if the permission mode allows write operations.
|
|
||||||
pub fn can_write(&self) -> bool {
|
|
||||||
matches!(self, PermissionMode::ReadWrite | PermissionMode::WriteOnly)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::fmt::Display for PermissionMode {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
write!(f, "{}", self.as_str())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct DefaultUserInfo {
|
pub(crate) struct DefaultUserInfo {
|
||||||
username: String,
|
username: String,
|
||||||
permission_mode: PermissionMode,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DefaultUserInfo {
|
impl DefaultUserInfo {
|
||||||
pub(crate) fn with_name(username: impl Into<String>) -> UserInfoRef {
|
pub(crate) fn with_name(username: impl Into<String>) -> UserInfoRef {
|
||||||
Self::with_name_and_permission(username, PermissionMode::default())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a UserInfo with specified permission mode.
|
|
||||||
pub(crate) fn with_name_and_permission(
|
|
||||||
username: impl Into<String>,
|
|
||||||
permission_mode: PermissionMode,
|
|
||||||
) -> UserInfoRef {
|
|
||||||
Arc::new(Self {
|
Arc::new(Self {
|
||||||
username: username.into(),
|
username: username.into(),
|
||||||
permission_mode,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn permission_mode(&self) -> &PermissionMode {
|
|
||||||
&self.permission_mode
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl UserInfo for DefaultUserInfo {
|
impl UserInfo for DefaultUserInfo {
|
||||||
@@ -114,120 +45,3 @@ impl UserInfo for DefaultUserInfo {
|
|||||||
self.username.as_str()
|
self.username.as_str()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_permission_mode_from_str() {
|
|
||||||
// Test ReadWrite variants
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("readwrite"),
|
|
||||||
PermissionMode::ReadWrite
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("read_write"),
|
|
||||||
PermissionMode::ReadWrite
|
|
||||||
);
|
|
||||||
assert_eq!(PermissionMode::from_str("rw"), PermissionMode::ReadWrite);
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("ReadWrite"),
|
|
||||||
PermissionMode::ReadWrite
|
|
||||||
);
|
|
||||||
assert_eq!(PermissionMode::from_str("RW"), PermissionMode::ReadWrite);
|
|
||||||
|
|
||||||
// Test ReadOnly variants
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("readonly"),
|
|
||||||
PermissionMode::ReadOnly
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("read_only"),
|
|
||||||
PermissionMode::ReadOnly
|
|
||||||
);
|
|
||||||
assert_eq!(PermissionMode::from_str("ro"), PermissionMode::ReadOnly);
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("ReadOnly"),
|
|
||||||
PermissionMode::ReadOnly
|
|
||||||
);
|
|
||||||
assert_eq!(PermissionMode::from_str("RO"), PermissionMode::ReadOnly);
|
|
||||||
|
|
||||||
// Test WriteOnly variants
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("writeonly"),
|
|
||||||
PermissionMode::WriteOnly
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("write_only"),
|
|
||||||
PermissionMode::WriteOnly
|
|
||||||
);
|
|
||||||
assert_eq!(PermissionMode::from_str("wo"), PermissionMode::WriteOnly);
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("WriteOnly"),
|
|
||||||
PermissionMode::WriteOnly
|
|
||||||
);
|
|
||||||
assert_eq!(PermissionMode::from_str("WO"), PermissionMode::WriteOnly);
|
|
||||||
|
|
||||||
// Test invalid inputs default to ReadWrite
|
|
||||||
assert_eq!(
|
|
||||||
PermissionMode::from_str("invalid"),
|
|
||||||
PermissionMode::ReadWrite
|
|
||||||
);
|
|
||||||
assert_eq!(PermissionMode::from_str(""), PermissionMode::ReadWrite);
|
|
||||||
assert_eq!(PermissionMode::from_str("xyz"), PermissionMode::ReadWrite);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_permission_mode_as_str() {
|
|
||||||
assert_eq!(PermissionMode::ReadWrite.as_str(), "rw");
|
|
||||||
assert_eq!(PermissionMode::ReadOnly.as_str(), "ro");
|
|
||||||
assert_eq!(PermissionMode::WriteOnly.as_str(), "wo");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_permission_mode_default() {
|
|
||||||
assert_eq!(PermissionMode::default(), PermissionMode::ReadWrite);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_permission_mode_round_trip() {
|
|
||||||
let modes = [
|
|
||||||
PermissionMode::ReadWrite,
|
|
||||||
PermissionMode::ReadOnly,
|
|
||||||
PermissionMode::WriteOnly,
|
|
||||||
];
|
|
||||||
|
|
||||||
for mode in modes {
|
|
||||||
let str_repr = mode.as_str();
|
|
||||||
let parsed = PermissionMode::from_str(str_repr);
|
|
||||||
assert_eq!(mode, parsed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_default_user_info_with_name() {
|
|
||||||
let user_info = DefaultUserInfo::with_name("test_user");
|
|
||||||
assert_eq!(user_info.username(), "test_user");
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_default_user_info_with_name_and_permission() {
|
|
||||||
let user_info =
|
|
||||||
DefaultUserInfo::with_name_and_permission("test_user", PermissionMode::ReadOnly);
|
|
||||||
assert_eq!(user_info.username(), "test_user");
|
|
||||||
|
|
||||||
// Cast to DefaultUserInfo to access permission_mode
|
|
||||||
let default_user = user_info
|
|
||||||
.as_any()
|
|
||||||
.downcast_ref::<DefaultUserInfo>()
|
|
||||||
.unwrap();
|
|
||||||
assert_eq!(default_user.permission_mode, PermissionMode::ReadOnly);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_user_info_as_any() {
|
|
||||||
let user_info = DefaultUserInfo::with_name("test_user");
|
|
||||||
let any_ref = user_info.as_any();
|
|
||||||
assert!(any_ref.downcast_ref::<DefaultUserInfo>().is_some());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -22,15 +22,15 @@ use std::io::BufRead;
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use common_base::secrets::ExposeSecret;
|
use common_base::secrets::ExposeSecret;
|
||||||
use snafu::{OptionExt, ResultExt, ensure};
|
use snafu::{ensure, OptionExt, ResultExt};
|
||||||
|
|
||||||
use crate::common::{Identity, Password};
|
use crate::common::{Identity, Password};
|
||||||
use crate::error::{
|
use crate::error::{
|
||||||
IllegalParamSnafu, InvalidConfigSnafu, IoSnafu, Result, UnsupportedPasswordTypeSnafu,
|
IllegalParamSnafu, InvalidConfigSnafu, IoSnafu, Result, UnsupportedPasswordTypeSnafu,
|
||||||
UserNotFoundSnafu, UserPasswordMismatchSnafu,
|
UserNotFoundSnafu, UserPasswordMismatchSnafu,
|
||||||
};
|
};
|
||||||
use crate::user_info::{DefaultUserInfo, PermissionMode};
|
use crate::user_info::DefaultUserInfo;
|
||||||
use crate::{UserInfoRef, auth_mysql};
|
use crate::{auth_mysql, UserInfoRef};
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
pub trait UserProvider: Send + Sync {
|
pub trait UserProvider: Send + Sync {
|
||||||
@@ -64,19 +64,11 @@ pub trait UserProvider: Send + Sync {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type alias for user info map
|
fn load_credential_from_file(filepath: &str) -> Result<Option<HashMap<String, Vec<u8>>>> {
|
||||||
/// Key is username, value is (password, permission_mode)
|
|
||||||
pub type UserInfoMap = HashMap<String, (Vec<u8>, PermissionMode)>;
|
|
||||||
|
|
||||||
fn load_credential_from_file(filepath: &str) -> Result<UserInfoMap> {
|
|
||||||
// check valid path
|
// check valid path
|
||||||
let path = Path::new(filepath);
|
let path = Path::new(filepath);
|
||||||
if !path.exists() {
|
if !path.exists() {
|
||||||
return InvalidConfigSnafu {
|
return Ok(None);
|
||||||
value: filepath.to_string(),
|
|
||||||
msg: "UserProvider file must exist",
|
|
||||||
}
|
|
||||||
.fail();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure!(
|
ensure!(
|
||||||
@@ -91,19 +83,13 @@ fn load_credential_from_file(filepath: &str) -> Result<UserInfoMap> {
|
|||||||
.lines()
|
.lines()
|
||||||
.map_while(std::result::Result::ok)
|
.map_while(std::result::Result::ok)
|
||||||
.filter_map(|line| {
|
.filter_map(|line| {
|
||||||
// The line format is:
|
if let Some((k, v)) = line.split_once('=') {
|
||||||
// - `username=password` - Basic user with default permissions
|
Some((k.to_string(), v.as_bytes().to_vec()))
|
||||||
// - `username:permission_mode=password` - User with specific permission mode
|
} else {
|
||||||
// - Lines starting with '#' are treated as comments and ignored
|
None
|
||||||
// - Empty lines are ignored
|
|
||||||
let line = line.trim();
|
|
||||||
if line.is_empty() || line.starts_with('#') {
|
|
||||||
return None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parse_credential_line(line)
|
|
||||||
})
|
})
|
||||||
.collect::<HashMap<String, _>>();
|
.collect::<HashMap<String, Vec<u8>>>();
|
||||||
|
|
||||||
ensure!(
|
ensure!(
|
||||||
!credential.is_empty(),
|
!credential.is_empty(),
|
||||||
@@ -113,31 +99,11 @@ fn load_credential_from_file(filepath: &str) -> Result<UserInfoMap> {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
Ok(credential)
|
Ok(Some(credential))
|
||||||
}
|
|
||||||
|
|
||||||
/// Parse a line of credential in the format of `username=password` or `username:permission_mode=password`
|
|
||||||
pub(crate) fn parse_credential_line(line: &str) -> Option<(String, (Vec<u8>, PermissionMode))> {
|
|
||||||
let parts = line.split('=').collect::<Vec<&str>>();
|
|
||||||
if parts.len() != 2 {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
let (username_part, password) = (parts[0], parts[1]);
|
|
||||||
let (username, permission_mode) = if let Some((user, perm)) = username_part.split_once(':') {
|
|
||||||
(user, PermissionMode::from_str(perm))
|
|
||||||
} else {
|
|
||||||
(username_part, PermissionMode::default())
|
|
||||||
};
|
|
||||||
|
|
||||||
Some((
|
|
||||||
username.to_string(),
|
|
||||||
(password.as_bytes().to_vec(), permission_mode),
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn authenticate_with_credential(
|
fn authenticate_with_credential(
|
||||||
users: &UserInfoMap,
|
users: &HashMap<String, Vec<u8>>,
|
||||||
input_id: Identity<'_>,
|
input_id: Identity<'_>,
|
||||||
input_pwd: Password<'_>,
|
input_pwd: Password<'_>,
|
||||||
) -> Result<UserInfoRef> {
|
) -> Result<UserInfoRef> {
|
||||||
@@ -149,7 +115,7 @@ fn authenticate_with_credential(
|
|||||||
msg: "blank username"
|
msg: "blank username"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
let (save_pwd, permission_mode) = users.get(username).context(UserNotFoundSnafu {
|
let save_pwd = users.get(username).context(UserNotFoundSnafu {
|
||||||
username: username.to_string(),
|
username: username.to_string(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@@ -162,10 +128,7 @@ fn authenticate_with_credential(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
if save_pwd == pwd.expose_secret().as_bytes() {
|
if save_pwd == pwd.expose_secret().as_bytes() {
|
||||||
Ok(DefaultUserInfo::with_name_and_permission(
|
Ok(DefaultUserInfo::with_name(username))
|
||||||
username,
|
|
||||||
*permission_mode,
|
|
||||||
))
|
|
||||||
} else {
|
} else {
|
||||||
UserPasswordMismatchSnafu {
|
UserPasswordMismatchSnafu {
|
||||||
username: username.to_string(),
|
username: username.to_string(),
|
||||||
@@ -174,9 +137,8 @@ fn authenticate_with_credential(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Password::MysqlNativePassword(auth_data, salt) => {
|
Password::MysqlNativePassword(auth_data, salt) => {
|
||||||
auth_mysql(auth_data, salt, username, save_pwd).map(|_| {
|
auth_mysql(auth_data, salt, username, save_pwd)
|
||||||
DefaultUserInfo::with_name_and_permission(username, *permission_mode)
|
.map(|_| DefaultUserInfo::with_name(username))
|
||||||
})
|
|
||||||
}
|
}
|
||||||
Password::PgMD5(_, _) => UnsupportedPasswordTypeSnafu {
|
Password::PgMD5(_, _) => UnsupportedPasswordTypeSnafu {
|
||||||
password_type: "pg_md5",
|
password_type: "pg_md5",
|
||||||
@@ -186,108 +148,3 @@ fn authenticate_with_credential(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_parse_credential_line() {
|
|
||||||
// Basic username=password format
|
|
||||||
let result = parse_credential_line("admin=password123");
|
|
||||||
assert_eq!(
|
|
||||||
result,
|
|
||||||
Some((
|
|
||||||
"admin".to_string(),
|
|
||||||
("password123".as_bytes().to_vec(), PermissionMode::default())
|
|
||||||
))
|
|
||||||
);
|
|
||||||
|
|
||||||
// Username with permission mode
|
|
||||||
let result = parse_credential_line("user:ReadOnly=secret");
|
|
||||||
assert_eq!(
|
|
||||||
result,
|
|
||||||
Some((
|
|
||||||
"user".to_string(),
|
|
||||||
("secret".as_bytes().to_vec(), PermissionMode::ReadOnly)
|
|
||||||
))
|
|
||||||
);
|
|
||||||
let result = parse_credential_line("user:ro=secret");
|
|
||||||
assert_eq!(
|
|
||||||
result,
|
|
||||||
Some((
|
|
||||||
"user".to_string(),
|
|
||||||
("secret".as_bytes().to_vec(), PermissionMode::ReadOnly)
|
|
||||||
))
|
|
||||||
);
|
|
||||||
// Username with WriteOnly permission mode
|
|
||||||
let result = parse_credential_line("writer:WriteOnly=mypass");
|
|
||||||
assert_eq!(
|
|
||||||
result,
|
|
||||||
Some((
|
|
||||||
"writer".to_string(),
|
|
||||||
("mypass".as_bytes().to_vec(), PermissionMode::WriteOnly)
|
|
||||||
))
|
|
||||||
);
|
|
||||||
|
|
||||||
// Username with 'wo' as WriteOnly permission shorthand
|
|
||||||
let result = parse_credential_line("writer:wo=mypass");
|
|
||||||
assert_eq!(
|
|
||||||
result,
|
|
||||||
Some((
|
|
||||||
"writer".to_string(),
|
|
||||||
("mypass".as_bytes().to_vec(), PermissionMode::WriteOnly)
|
|
||||||
))
|
|
||||||
);
|
|
||||||
|
|
||||||
// Username with complex password containing special characters
|
|
||||||
let result = parse_credential_line("admin:rw=p@ssw0rd!123");
|
|
||||||
assert_eq!(
|
|
||||||
result,
|
|
||||||
Some((
|
|
||||||
"admin".to_string(),
|
|
||||||
(
|
|
||||||
"p@ssw0rd!123".as_bytes().to_vec(),
|
|
||||||
PermissionMode::ReadWrite
|
|
||||||
)
|
|
||||||
))
|
|
||||||
);
|
|
||||||
|
|
||||||
// Username with spaces should be preserved
|
|
||||||
let result = parse_credential_line("user name:WriteOnly=password");
|
|
||||||
assert_eq!(
|
|
||||||
result,
|
|
||||||
Some((
|
|
||||||
"user name".to_string(),
|
|
||||||
("password".as_bytes().to_vec(), PermissionMode::WriteOnly)
|
|
||||||
))
|
|
||||||
);
|
|
||||||
|
|
||||||
// Invalid format - no equals sign
|
|
||||||
let result = parse_credential_line("invalid_line");
|
|
||||||
assert_eq!(result, None);
|
|
||||||
|
|
||||||
// Invalid format - multiple equals signs
|
|
||||||
let result = parse_credential_line("user=pass=word");
|
|
||||||
assert_eq!(result, None);
|
|
||||||
|
|
||||||
// Empty password
|
|
||||||
let result = parse_credential_line("user=");
|
|
||||||
assert_eq!(
|
|
||||||
result,
|
|
||||||
Some((
|
|
||||||
"user".to_string(),
|
|
||||||
("".as_bytes().to_vec(), PermissionMode::default())
|
|
||||||
))
|
|
||||||
);
|
|
||||||
|
|
||||||
// Empty username
|
|
||||||
let result = parse_credential_line("=password");
|
|
||||||
assert_eq!(
|
|
||||||
result,
|
|
||||||
Some((
|
|
||||||
"".to_string(),
|
|
||||||
("password".as_bytes().to_vec(), PermissionMode::default())
|
|
||||||
))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -12,19 +12,19 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use snafu::{OptionExt, ResultExt};
|
use snafu::{OptionExt, ResultExt};
|
||||||
|
|
||||||
use crate::error::{FromUtf8Snafu, InvalidConfigSnafu, Result};
|
use crate::error::{FromUtf8Snafu, InvalidConfigSnafu, Result};
|
||||||
use crate::user_provider::{
|
use crate::user_provider::{authenticate_with_credential, load_credential_from_file};
|
||||||
UserInfoMap, authenticate_with_credential, load_credential_from_file, parse_credential_line,
|
|
||||||
};
|
|
||||||
use crate::{Identity, Password, UserInfoRef, UserProvider};
|
use crate::{Identity, Password, UserInfoRef, UserProvider};
|
||||||
|
|
||||||
pub(crate) const STATIC_USER_PROVIDER: &str = "static_user_provider";
|
pub(crate) const STATIC_USER_PROVIDER: &str = "static_user_provider";
|
||||||
|
|
||||||
pub struct StaticUserProvider {
|
pub struct StaticUserProvider {
|
||||||
users: UserInfoMap,
|
users: HashMap<String, Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StaticUserProvider {
|
impl StaticUserProvider {
|
||||||
@@ -35,18 +35,23 @@ impl StaticUserProvider {
|
|||||||
})?;
|
})?;
|
||||||
match mode {
|
match mode {
|
||||||
"file" => {
|
"file" => {
|
||||||
let users = load_credential_from_file(content)?;
|
let users = load_credential_from_file(content)?
|
||||||
|
.context(InvalidConfigSnafu {
|
||||||
|
value: content.to_string(),
|
||||||
|
msg: "StaticFileUserProvider must be a valid file path",
|
||||||
|
})?;
|
||||||
Ok(StaticUserProvider { users })
|
Ok(StaticUserProvider { users })
|
||||||
}
|
}
|
||||||
"cmd" => content
|
"cmd" => content
|
||||||
.split(',')
|
.split(',')
|
||||||
.map(|kv| {
|
.map(|kv| {
|
||||||
parse_credential_line(kv).context(InvalidConfigSnafu {
|
let (k, v) = kv.split_once('=').context(InvalidConfigSnafu {
|
||||||
value: kv.to_string(),
|
value: kv.to_string(),
|
||||||
msg: "StaticUserProviderOption cmd values must be in format `user=pwd[,user=pwd]`",
|
msg: "StaticUserProviderOption cmd values must be in format `user=pwd[,user=pwd]`",
|
||||||
})
|
})?;
|
||||||
|
Ok((k.to_string(), v.as_bytes().to_vec()))
|
||||||
})
|
})
|
||||||
.collect::<Result<UserInfoMap>>()
|
.collect::<Result<HashMap<String, Vec<u8>>>>()
|
||||||
.map(|users| StaticUserProvider { users }),
|
.map(|users| StaticUserProvider { users }),
|
||||||
_ => InvalidConfigSnafu {
|
_ => InvalidConfigSnafu {
|
||||||
value: mode.to_string(),
|
value: mode.to_string(),
|
||||||
@@ -64,7 +69,7 @@ impl StaticUserProvider {
|
|||||||
msg: "Expect at least one pair of username and password",
|
msg: "Expect at least one pair of username and password",
|
||||||
})?;
|
})?;
|
||||||
let username = kv.0;
|
let username = kv.0;
|
||||||
let pwd = String::from_utf8(kv.1.0.clone()).context(FromUtf8Snafu)?;
|
let pwd = String::from_utf8(kv.1.clone()).context(FromUtf8Snafu)?;
|
||||||
Ok((username.clone(), pwd))
|
Ok((username.clone(), pwd))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,10 +102,10 @@ pub mod test {
|
|||||||
|
|
||||||
use common_test_util::temp_dir::create_temp_dir;
|
use common_test_util::temp_dir::create_temp_dir;
|
||||||
|
|
||||||
use crate::UserProvider;
|
|
||||||
use crate::user_info::DefaultUserInfo;
|
use crate::user_info::DefaultUserInfo;
|
||||||
use crate::user_provider::static_user_provider::StaticUserProvider;
|
use crate::user_provider::static_user_provider::StaticUserProvider;
|
||||||
use crate::user_provider::{Identity, Password};
|
use crate::user_provider::{Identity, Password};
|
||||||
|
use crate::UserProvider;
|
||||||
|
|
||||||
async fn test_authenticate(provider: &dyn UserProvider, username: &str, password: &str) {
|
async fn test_authenticate(provider: &dyn UserProvider, username: &str, password: &str) {
|
||||||
let re = provider
|
let re = provider
|
||||||
@@ -138,13 +143,12 @@ pub mod test {
|
|||||||
let file = File::create(&file_path);
|
let file = File::create(&file_path);
|
||||||
let file = file.unwrap();
|
let file = file.unwrap();
|
||||||
let mut lw = LineWriter::new(file);
|
let mut lw = LineWriter::new(file);
|
||||||
assert!(
|
assert!(lw
|
||||||
lw.write_all(
|
.write_all(
|
||||||
b"root=123456
|
b"root=123456
|
||||||
admin=654321",
|
admin=654321",
|
||||||
)
|
)
|
||||||
.is_ok()
|
.is_ok());
|
||||||
);
|
|
||||||
lw.flush().unwrap();
|
lw.flush().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use std::collections::HashMap;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::sync::mpsc::channel;
|
use std::sync::mpsc::channel;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
@@ -19,20 +20,20 @@ use std::sync::{Arc, Mutex};
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use common_telemetry::{info, warn};
|
use common_telemetry::{info, warn};
|
||||||
use notify::{EventKind, RecursiveMode, Watcher};
|
use notify::{EventKind, RecursiveMode, Watcher};
|
||||||
use snafu::{ResultExt, ensure};
|
use snafu::{ensure, ResultExt};
|
||||||
|
|
||||||
use crate::error::{FileWatchSnafu, InvalidConfigSnafu, Result};
|
use crate::error::{FileWatchSnafu, InvalidConfigSnafu, Result};
|
||||||
use crate::user_provider::{UserInfoMap, authenticate_with_credential, load_credential_from_file};
|
use crate::user_info::DefaultUserInfo;
|
||||||
|
use crate::user_provider::{authenticate_with_credential, load_credential_from_file};
|
||||||
use crate::{Identity, Password, UserInfoRef, UserProvider};
|
use crate::{Identity, Password, UserInfoRef, UserProvider};
|
||||||
|
|
||||||
pub(crate) const WATCH_FILE_USER_PROVIDER: &str = "watch_file_user_provider";
|
pub(crate) const WATCH_FILE_USER_PROVIDER: &str = "watch_file_user_provider";
|
||||||
|
|
||||||
type WatchedCredentialRef = Arc<Mutex<UserInfoMap>>;
|
type WatchedCredentialRef = Arc<Mutex<Option<HashMap<String, Vec<u8>>>>>;
|
||||||
|
|
||||||
/// A user provider that reads user credential from a file and watches the file for changes.
|
/// A user provider that reads user credential from a file and watches the file for changes.
|
||||||
///
|
///
|
||||||
/// Both empty file and non-existent file are invalid and will cause initialization to fail.
|
/// Empty file is invalid; but file not exist means every user can be authenticated.
|
||||||
#[derive(Debug)]
|
|
||||||
pub(crate) struct WatchFileUserProvider {
|
pub(crate) struct WatchFileUserProvider {
|
||||||
users: WatchedCredentialRef,
|
users: WatchedCredentialRef,
|
||||||
}
|
}
|
||||||
@@ -107,7 +108,16 @@ impl UserProvider for WatchFileUserProvider {
|
|||||||
|
|
||||||
async fn authenticate(&self, id: Identity<'_>, password: Password<'_>) -> Result<UserInfoRef> {
|
async fn authenticate(&self, id: Identity<'_>, password: Password<'_>) -> Result<UserInfoRef> {
|
||||||
let users = self.users.lock().expect("users credential must be valid");
|
let users = self.users.lock().expect("users credential must be valid");
|
||||||
authenticate_with_credential(&users, id, password)
|
if let Some(users) = users.as_ref() {
|
||||||
|
authenticate_with_credential(users, id, password)
|
||||||
|
} else {
|
||||||
|
match id {
|
||||||
|
Identity::UserId(id, _) => {
|
||||||
|
warn!(id, "User provider file not exist, allow all users");
|
||||||
|
Ok(DefaultUserInfo::with_name(id))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn authorize(&self, _: &str, _: &str, _: &UserInfoRef) -> Result<()> {
|
async fn authorize(&self, _: &str, _: &str, _: &UserInfoRef) -> Result<()> {
|
||||||
@@ -123,9 +133,9 @@ pub mod test {
|
|||||||
use common_test_util::temp_dir::create_temp_dir;
|
use common_test_util::temp_dir::create_temp_dir;
|
||||||
use tokio::time::sleep;
|
use tokio::time::sleep;
|
||||||
|
|
||||||
use crate::UserProvider;
|
|
||||||
use crate::user_provider::watch_file_user_provider::WatchFileUserProvider;
|
use crate::user_provider::watch_file_user_provider::WatchFileUserProvider;
|
||||||
use crate::user_provider::{Identity, Password};
|
use crate::user_provider::{Identity, Password};
|
||||||
|
use crate::UserProvider;
|
||||||
|
|
||||||
async fn test_authenticate(
|
async fn test_authenticate(
|
||||||
provider: &dyn UserProvider,
|
provider: &dyn UserProvider,
|
||||||
@@ -168,21 +178,6 @@ pub mod test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
|
||||||
async fn test_file_provider_initialization_with_missing_file() {
|
|
||||||
common_telemetry::init_default_ut_logging();
|
|
||||||
|
|
||||||
let dir = create_temp_dir("test_missing_file");
|
|
||||||
let file_path = format!("{}/non_existent_file", dir.path().to_str().unwrap());
|
|
||||||
|
|
||||||
// Try to create provider with non-existent file should fail
|
|
||||||
let result = WatchFileUserProvider::new(file_path.as_str());
|
|
||||||
assert!(result.is_err());
|
|
||||||
|
|
||||||
let error = result.unwrap_err();
|
|
||||||
assert!(error.to_string().contains("UserProvider file must exist"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_file_provider() {
|
async fn test_file_provider() {
|
||||||
common_telemetry::init_default_ut_logging();
|
common_telemetry::init_default_ut_logging();
|
||||||
@@ -207,10 +202,9 @@ pub mod test {
|
|||||||
|
|
||||||
// remove the tmp file
|
// remove the tmp file
|
||||||
assert!(std::fs::remove_file(&file_path).is_ok());
|
assert!(std::fs::remove_file(&file_path).is_ok());
|
||||||
// When file is deleted during runtime, keep the last known good credentials
|
test_authenticate(&provider, "root", "123456", true, Some(timeout)).await;
|
||||||
test_authenticate(&provider, "root", "654321", true, Some(timeout)).await;
|
test_authenticate(&provider, "root", "654321", true, Some(timeout)).await;
|
||||||
test_authenticate(&provider, "root", "123456", false, Some(timeout)).await;
|
test_authenticate(&provider, "admin", "654321", true, Some(timeout)).await;
|
||||||
test_authenticate(&provider, "admin", "654321", false, Some(timeout)).await;
|
|
||||||
|
|
||||||
// recreate the tmp file
|
// recreate the tmp file
|
||||||
assert!(std::fs::write(&file_path, "root=123456\n").is_ok());
|
assert!(std::fs::write(&file_path, "root=123456\n").is_ok());
|
||||||
|
|||||||
6
src/cache/src/lib.rs
vendored
6
src/cache/src/lib.rs
vendored
@@ -19,9 +19,9 @@ use std::time::Duration;
|
|||||||
|
|
||||||
use catalog::kvbackend::new_table_cache;
|
use catalog::kvbackend::new_table_cache;
|
||||||
use common_meta::cache::{
|
use common_meta::cache::{
|
||||||
CacheRegistry, CacheRegistryBuilder, LayeredCacheRegistryBuilder, new_schema_cache,
|
new_schema_cache, new_table_flownode_set_cache, new_table_info_cache, new_table_name_cache,
|
||||||
new_table_flownode_set_cache, new_table_info_cache, new_table_name_cache,
|
new_table_route_cache, new_table_schema_cache, new_view_info_cache, CacheRegistry,
|
||||||
new_table_route_cache, new_table_schema_cache, new_view_info_cache,
|
CacheRegistryBuilder, LayeredCacheRegistryBuilder,
|
||||||
};
|
};
|
||||||
use common_meta::kv_backend::KvBackendRef;
|
use common_meta::kv_backend::KvBackendRef;
|
||||||
use moka::future::CacheBuilder;
|
use moka::future::CacheBuilder;
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ bytes.workspace = true
|
|||||||
common-base.workspace = true
|
common-base.workspace = true
|
||||||
common-catalog.workspace = true
|
common-catalog.workspace = true
|
||||||
common-error.workspace = true
|
common-error.workspace = true
|
||||||
common-event-recorder.workspace = true
|
|
||||||
common-frontend.workspace = true
|
common-frontend.workspace = true
|
||||||
common-macro.workspace = true
|
common-macro.workspace = true
|
||||||
common-meta.workspace = true
|
common-meta.workspace = true
|
||||||
@@ -31,10 +30,8 @@ common-runtime.workspace = true
|
|||||||
common-telemetry.workspace = true
|
common-telemetry.workspace = true
|
||||||
common-time.workspace = true
|
common-time.workspace = true
|
||||||
common-version.workspace = true
|
common-version.workspace = true
|
||||||
common-workload.workspace = true
|
|
||||||
dashmap.workspace = true
|
dashmap.workspace = true
|
||||||
datafusion.workspace = true
|
datafusion.workspace = true
|
||||||
datafusion-pg-catalog.workspace = true
|
|
||||||
datatypes.workspace = true
|
datatypes.workspace = true
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
futures-util.workspace = true
|
futures-util.workspace = true
|
||||||
@@ -46,9 +43,7 @@ moka = { workspace = true, features = ["future", "sync"] }
|
|||||||
partition.workspace = true
|
partition.workspace = true
|
||||||
paste.workspace = true
|
paste.workspace = true
|
||||||
prometheus.workspace = true
|
prometheus.workspace = true
|
||||||
promql-parser.workspace = true
|
rustc-hash.workspace = true
|
||||||
rand.workspace = true
|
|
||||||
serde.workspace = true
|
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
session.workspace = true
|
session.workspace = true
|
||||||
snafu.workspace = true
|
snafu.workspace = true
|
||||||
|
|||||||
@@ -297,20 +297,6 @@ pub enum Error {
|
|||||||
#[snafu(implicit)]
|
#[snafu(implicit)]
|
||||||
location: Location,
|
location: Location,
|
||||||
},
|
},
|
||||||
|
|
||||||
#[snafu(display("Failed to handle query"))]
|
|
||||||
HandleQuery {
|
|
||||||
source: common_meta::error::Error,
|
|
||||||
#[snafu(implicit)]
|
|
||||||
location: Location,
|
|
||||||
},
|
|
||||||
|
|
||||||
#[snafu(display("Failed to project schema"))]
|
|
||||||
ProjectSchema {
|
|
||||||
source: datatypes::error::Error,
|
|
||||||
#[snafu(implicit)]
|
|
||||||
location: Location,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Error {
|
impl Error {
|
||||||
@@ -383,8 +369,6 @@ impl ErrorExt for Error {
|
|||||||
Error::FrontendNotFound { .. } | Error::MetaClientMissing { .. } => {
|
Error::FrontendNotFound { .. } | Error::MetaClientMissing { .. } => {
|
||||||
StatusCode::Unexpected
|
StatusCode::Unexpected
|
||||||
}
|
}
|
||||||
Error::HandleQuery { source, .. } => source.status_code(),
|
|
||||||
Error::ProjectSchema { source, .. } => source.status_code(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,34 +14,25 @@
|
|||||||
|
|
||||||
use api::v1::meta::ProcedureStatus;
|
use api::v1::meta::ProcedureStatus;
|
||||||
use common_error::ext::BoxedError;
|
use common_error::ext::BoxedError;
|
||||||
use common_meta::cluster::{ClusterInfo, NodeInfo, Role};
|
use common_meta::cluster::{ClusterInfo, NodeInfo};
|
||||||
use common_meta::datanode::RegionStat;
|
use common_meta::datanode::RegionStat;
|
||||||
|
use common_meta::ddl::{ExecutorContext, ProcedureExecutor};
|
||||||
use common_meta::key::flow::flow_state::FlowStat;
|
use common_meta::key::flow::flow_state::FlowStat;
|
||||||
use common_meta::node_manager::DatanodeManagerRef;
|
|
||||||
use common_meta::procedure_executor::{ExecutorContext, ProcedureExecutor};
|
|
||||||
use common_meta::rpc::procedure;
|
use common_meta::rpc::procedure;
|
||||||
use common_procedure::{ProcedureInfo, ProcedureState};
|
use common_procedure::{ProcedureInfo, ProcedureState};
|
||||||
use common_query::request::QueryRequest;
|
|
||||||
use common_recordbatch::SendableRecordBatchStream;
|
|
||||||
use common_recordbatch::util::ChainedRecordBatchStream;
|
|
||||||
use meta_client::MetaClientRef;
|
use meta_client::MetaClientRef;
|
||||||
use snafu::ResultExt;
|
use snafu::ResultExt;
|
||||||
use store_api::storage::RegionId;
|
|
||||||
|
|
||||||
use crate::error;
|
use crate::error;
|
||||||
use crate::information_schema::{DatanodeInspectRequest, InformationExtension};
|
use crate::information_schema::InformationExtension;
|
||||||
|
|
||||||
pub struct DistributedInformationExtension {
|
pub struct DistributedInformationExtension {
|
||||||
meta_client: MetaClientRef,
|
meta_client: MetaClientRef,
|
||||||
datanode_manager: DatanodeManagerRef,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DistributedInformationExtension {
|
impl DistributedInformationExtension {
|
||||||
pub fn new(meta_client: MetaClientRef, datanode_manager: DatanodeManagerRef) -> Self {
|
pub fn new(meta_client: MetaClientRef) -> Self {
|
||||||
Self {
|
Self { meta_client }
|
||||||
meta_client,
|
|
||||||
datanode_manager,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,39 +98,4 @@ impl InformationExtension for DistributedInformationExtension {
|
|||||||
.map_err(BoxedError::new)
|
.map_err(BoxedError::new)
|
||||||
.context(crate::error::ListFlowStatsSnafu)
|
.context(crate::error::ListFlowStatsSnafu)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn inspect_datanode(
|
|
||||||
&self,
|
|
||||||
request: DatanodeInspectRequest,
|
|
||||||
) -> std::result::Result<SendableRecordBatchStream, Self::Error> {
|
|
||||||
// Aggregate results from all datanodes
|
|
||||||
let nodes = self
|
|
||||||
.meta_client
|
|
||||||
.list_nodes(Some(Role::Datanode))
|
|
||||||
.await
|
|
||||||
.map_err(BoxedError::new)
|
|
||||||
.context(crate::error::ListNodesSnafu)?;
|
|
||||||
|
|
||||||
let plan = request
|
|
||||||
.build_plan()
|
|
||||||
.context(crate::error::DatafusionSnafu)?;
|
|
||||||
|
|
||||||
let mut streams = Vec::with_capacity(nodes.len());
|
|
||||||
for node in nodes {
|
|
||||||
let client = self.datanode_manager.datanode(&node.peer).await;
|
|
||||||
let stream = client
|
|
||||||
.handle_query(QueryRequest {
|
|
||||||
plan: plan.clone(),
|
|
||||||
region_id: RegionId::default(),
|
|
||||||
header: None,
|
|
||||||
})
|
|
||||||
.await
|
|
||||||
.context(crate::error::HandleQuerySnafu)?;
|
|
||||||
streams.push(stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
let chained =
|
|
||||||
ChainedRecordBatchStream::new(streams).context(crate::error::CreateRecordBatchSnafu)?;
|
|
||||||
Ok(Box::pin(chained))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,11 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
mod builder;
|
pub use client::{CachedKvBackend, CachedKvBackendBuilder, MetaKvBackend};
|
||||||
|
|
||||||
mod client;
|
mod client;
|
||||||
mod manager;
|
mod manager;
|
||||||
mod table_cache;
|
mod table_cache;
|
||||||
|
|
||||||
pub use builder::{
|
|
||||||
CatalogManagerConfigurator, CatalogManagerConfiguratorRef, KvBackendCatalogManagerBuilder,
|
|
||||||
};
|
|
||||||
pub use client::{CachedKvBackend, CachedKvBackendBuilder, MetaKvBackend};
|
|
||||||
pub use manager::KvBackendCatalogManager;
|
pub use manager::KvBackendCatalogManager;
|
||||||
pub use table_cache::{TableCache, TableCacheRef, new_table_cache};
|
pub use table_cache::{new_table_cache, TableCache, TableCacheRef};
|
||||||
|
|||||||
@@ -1,140 +0,0 @@
|
|||||||
// Copyright 2023 Greptime Team
|
|
||||||
//
|
|
||||||
// Licensed 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.
|
|
||||||
|
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use common_catalog::consts::DEFAULT_CATALOG_NAME;
|
|
||||||
use common_error::ext::BoxedError;
|
|
||||||
use common_meta::cache::LayeredCacheRegistryRef;
|
|
||||||
use common_meta::key::TableMetadataManager;
|
|
||||||
use common_meta::key::flow::FlowMetadataManager;
|
|
||||||
use common_meta::kv_backend::KvBackendRef;
|
|
||||||
use common_procedure::ProcedureManagerRef;
|
|
||||||
use moka::sync::Cache;
|
|
||||||
use partition::manager::PartitionRuleManager;
|
|
||||||
|
|
||||||
use crate::information_schema::{
|
|
||||||
InformationExtensionRef, InformationSchemaProvider, InformationSchemaTableFactoryRef,
|
|
||||||
};
|
|
||||||
use crate::kvbackend::KvBackendCatalogManager;
|
|
||||||
use crate::kvbackend::manager::{CATALOG_CACHE_MAX_CAPACITY, SystemCatalog};
|
|
||||||
use crate::process_manager::ProcessManagerRef;
|
|
||||||
use crate::system_schema::numbers_table_provider::NumbersTableProvider;
|
|
||||||
use crate::system_schema::pg_catalog::PGCatalogProvider;
|
|
||||||
|
|
||||||
/// The configurator that customizes or enhances the [`KvBackendCatalogManagerBuilder`].
|
|
||||||
#[async_trait::async_trait]
|
|
||||||
pub trait CatalogManagerConfigurator<C>: Send + Sync {
|
|
||||||
async fn configure(
|
|
||||||
&self,
|
|
||||||
builder: KvBackendCatalogManagerBuilder,
|
|
||||||
ctx: C,
|
|
||||||
) -> std::result::Result<KvBackendCatalogManagerBuilder, BoxedError>;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub type CatalogManagerConfiguratorRef<C> = Arc<dyn CatalogManagerConfigurator<C>>;
|
|
||||||
|
|
||||||
pub struct KvBackendCatalogManagerBuilder {
|
|
||||||
information_extension: InformationExtensionRef,
|
|
||||||
backend: KvBackendRef,
|
|
||||||
cache_registry: LayeredCacheRegistryRef,
|
|
||||||
procedure_manager: Option<ProcedureManagerRef>,
|
|
||||||
process_manager: Option<ProcessManagerRef>,
|
|
||||||
extra_information_table_factories: HashMap<String, InformationSchemaTableFactoryRef>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl KvBackendCatalogManagerBuilder {
|
|
||||||
pub fn new(
|
|
||||||
information_extension: InformationExtensionRef,
|
|
||||||
backend: KvBackendRef,
|
|
||||||
cache_registry: LayeredCacheRegistryRef,
|
|
||||||
) -> Self {
|
|
||||||
Self {
|
|
||||||
information_extension,
|
|
||||||
backend,
|
|
||||||
cache_registry,
|
|
||||||
procedure_manager: None,
|
|
||||||
process_manager: None,
|
|
||||||
extra_information_table_factories: HashMap::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_procedure_manager(mut self, procedure_manager: ProcedureManagerRef) -> Self {
|
|
||||||
self.procedure_manager = Some(procedure_manager);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn with_process_manager(mut self, process_manager: ProcessManagerRef) -> Self {
|
|
||||||
self.process_manager = Some(process_manager);
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Sets the extra information tables.
|
|
||||||
pub fn with_extra_information_table_factories(
|
|
||||||
mut self,
|
|
||||||
factories: HashMap<String, InformationSchemaTableFactoryRef>,
|
|
||||||
) -> Self {
|
|
||||||
self.extra_information_table_factories = factories;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn build(self) -> Arc<KvBackendCatalogManager> {
|
|
||||||
let Self {
|
|
||||||
information_extension,
|
|
||||||
backend,
|
|
||||||
cache_registry,
|
|
||||||
procedure_manager,
|
|
||||||
process_manager,
|
|
||||||
extra_information_table_factories,
|
|
||||||
} = self;
|
|
||||||
Arc::new_cyclic(|me| KvBackendCatalogManager {
|
|
||||||
information_extension,
|
|
||||||
partition_manager: Arc::new(PartitionRuleManager::new(
|
|
||||||
backend.clone(),
|
|
||||||
cache_registry
|
|
||||||
.get()
|
|
||||||
.expect("Failed to get table_route_cache"),
|
|
||||||
)),
|
|
||||||
table_metadata_manager: Arc::new(TableMetadataManager::new(backend.clone())),
|
|
||||||
system_catalog: SystemCatalog {
|
|
||||||
catalog_manager: me.clone(),
|
|
||||||
catalog_cache: Cache::new(CATALOG_CACHE_MAX_CAPACITY),
|
|
||||||
pg_catalog_cache: Cache::new(CATALOG_CACHE_MAX_CAPACITY),
|
|
||||||
information_schema_provider: {
|
|
||||||
let provider = InformationSchemaProvider::new(
|
|
||||||
DEFAULT_CATALOG_NAME.to_string(),
|
|
||||||
me.clone(),
|
|
||||||
Arc::new(FlowMetadataManager::new(backend.clone())),
|
|
||||||
process_manager.clone(),
|
|
||||||
backend.clone(),
|
|
||||||
);
|
|
||||||
let provider = provider
|
|
||||||
.with_extra_table_factories(extra_information_table_factories.clone());
|
|
||||||
Arc::new(provider)
|
|
||||||
},
|
|
||||||
pg_catalog_provider: Arc::new(PGCatalogProvider::new(
|
|
||||||
DEFAULT_CATALOG_NAME.to_string(),
|
|
||||||
me.clone(),
|
|
||||||
)),
|
|
||||||
numbers_table_provider: NumbersTableProvider,
|
|
||||||
backend,
|
|
||||||
process_manager,
|
|
||||||
extra_information_table_factories,
|
|
||||||
},
|
|
||||||
cache_registry,
|
|
||||||
procedure_manager,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,12 +24,12 @@ use common_meta::error::Error::CacheNotGet;
|
|||||||
use common_meta::error::{CacheNotGetSnafu, Error, ExternalSnafu, GetKvCacheSnafu, Result};
|
use common_meta::error::{CacheNotGetSnafu, Error, ExternalSnafu, GetKvCacheSnafu, Result};
|
||||||
use common_meta::kv_backend::txn::{Txn, TxnResponse};
|
use common_meta::kv_backend::txn::{Txn, TxnResponse};
|
||||||
use common_meta::kv_backend::{KvBackend, KvBackendRef, TxnService};
|
use common_meta::kv_backend::{KvBackend, KvBackendRef, TxnService};
|
||||||
use common_meta::rpc::KeyValue;
|
|
||||||
use common_meta::rpc::store::{
|
use common_meta::rpc::store::{
|
||||||
BatchDeleteRequest, BatchDeleteResponse, BatchGetRequest, BatchGetResponse, BatchPutRequest,
|
BatchDeleteRequest, BatchDeleteResponse, BatchGetRequest, BatchGetResponse, BatchPutRequest,
|
||||||
BatchPutResponse, CompareAndPutRequest, CompareAndPutResponse, DeleteRangeRequest,
|
BatchPutResponse, CompareAndPutRequest, CompareAndPutResponse, DeleteRangeRequest,
|
||||||
DeleteRangeResponse, PutRequest, PutResponse, RangeRequest, RangeResponse,
|
DeleteRangeResponse, PutRequest, PutResponse, RangeRequest, RangeResponse,
|
||||||
};
|
};
|
||||||
|
use common_meta::rpc::KeyValue;
|
||||||
use common_telemetry::debug;
|
use common_telemetry::debug;
|
||||||
use meta_client::client::MetaClient;
|
use meta_client::client::MetaClient;
|
||||||
use moka::future::{Cache, CacheBuilder};
|
use moka::future::{Cache, CacheBuilder};
|
||||||
@@ -461,17 +461,17 @@ impl KvBackend for MetaKvBackend {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::any::Any;
|
use std::any::Any;
|
||||||
use std::sync::Arc;
|
|
||||||
use std::sync::atomic::{AtomicU32, Ordering};
|
use std::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use common_meta::kv_backend::{KvBackend, TxnService};
|
use common_meta::kv_backend::{KvBackend, TxnService};
|
||||||
use common_meta::rpc::KeyValue;
|
|
||||||
use common_meta::rpc::store::{
|
use common_meta::rpc::store::{
|
||||||
BatchDeleteRequest, BatchDeleteResponse, BatchGetRequest, BatchGetResponse,
|
BatchDeleteRequest, BatchDeleteResponse, BatchGetRequest, BatchGetResponse,
|
||||||
BatchPutRequest, BatchPutResponse, DeleteRangeRequest, DeleteRangeResponse, PutRequest,
|
BatchPutRequest, BatchPutResponse, DeleteRangeRequest, DeleteRangeResponse, PutRequest,
|
||||||
PutResponse, RangeRequest, RangeResponse,
|
PutResponse, RangeRequest, RangeResponse,
|
||||||
};
|
};
|
||||||
|
use common_meta::rpc::KeyValue;
|
||||||
use dashmap::DashMap;
|
use dashmap::DashMap;
|
||||||
|
|
||||||
use super::CachedKvBackend;
|
use super::CachedKvBackend;
|
||||||
|
|||||||
@@ -18,49 +18,45 @@ use std::sync::{Arc, Weak};
|
|||||||
|
|
||||||
use async_stream::try_stream;
|
use async_stream::try_stream;
|
||||||
use common_catalog::consts::{
|
use common_catalog::consts::{
|
||||||
DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME, INFORMATION_SCHEMA_NAME, PG_CATALOG_NAME,
|
DEFAULT_CATALOG_NAME, DEFAULT_SCHEMA_NAME, INFORMATION_SCHEMA_NAME, NUMBERS_TABLE_ID,
|
||||||
|
PG_CATALOG_NAME,
|
||||||
};
|
};
|
||||||
use common_error::ext::BoxedError;
|
use common_error::ext::BoxedError;
|
||||||
use common_meta::cache::{
|
use common_meta::cache::{
|
||||||
LayeredCacheRegistryRef, TableInfoCacheRef, TableNameCacheRef, TableRoute, TableRouteCacheRef,
|
LayeredCacheRegistryRef, TableRoute, TableRouteCacheRef, ViewInfoCacheRef,
|
||||||
ViewInfoCacheRef,
|
|
||||||
};
|
};
|
||||||
use common_meta::key::TableMetadataManagerRef;
|
|
||||||
use common_meta::key::catalog_name::CatalogNameKey;
|
use common_meta::key::catalog_name::CatalogNameKey;
|
||||||
use common_meta::key::flow::FlowMetadataManager;
|
use common_meta::key::flow::FlowMetadataManager;
|
||||||
use common_meta::key::schema_name::SchemaNameKey;
|
use common_meta::key::schema_name::SchemaNameKey;
|
||||||
use common_meta::key::table_info::{TableInfoManager, TableInfoValue};
|
use common_meta::key::table_info::TableInfoValue;
|
||||||
use common_meta::key::table_name::TableNameKey;
|
use common_meta::key::table_name::TableNameKey;
|
||||||
|
use common_meta::key::{TableMetadataManager, TableMetadataManagerRef};
|
||||||
use common_meta::kv_backend::KvBackendRef;
|
use common_meta::kv_backend::KvBackendRef;
|
||||||
use common_procedure::ProcedureManagerRef;
|
use common_procedure::ProcedureManagerRef;
|
||||||
use futures_util::stream::BoxStream;
|
use futures_util::stream::BoxStream;
|
||||||
use futures_util::{StreamExt, TryStreamExt};
|
use futures_util::{StreamExt, TryStreamExt};
|
||||||
use moka::sync::Cache;
|
use moka::sync::Cache;
|
||||||
use partition::manager::PartitionRuleManagerRef;
|
use partition::manager::{PartitionRuleManager, PartitionRuleManagerRef};
|
||||||
use session::context::{Channel, QueryContext};
|
use session::context::{Channel, QueryContext};
|
||||||
use snafu::prelude::*;
|
use snafu::prelude::*;
|
||||||
use store_api::metric_engine_consts::METRIC_ENGINE_NAME;
|
|
||||||
use table::TableRef;
|
|
||||||
use table::dist_table::DistTable;
|
use table::dist_table::DistTable;
|
||||||
use table::metadata::{TableId, TableInfoRef};
|
use table::metadata::TableId;
|
||||||
use table::table::PartitionRules;
|
use table::table::numbers::{NumbersTable, NUMBERS_TABLE_NAME};
|
||||||
use table::table_name::TableName;
|
use table::table_name::TableName;
|
||||||
|
use table::TableRef;
|
||||||
use tokio::sync::Semaphore;
|
use tokio::sync::Semaphore;
|
||||||
use tokio_stream::wrappers::ReceiverStream;
|
use tokio_stream::wrappers::ReceiverStream;
|
||||||
|
|
||||||
use crate::CatalogManager;
|
|
||||||
use crate::error::{
|
use crate::error::{
|
||||||
CacheNotFoundSnafu, GetTableCacheSnafu, InvalidTableInfoInCatalogSnafu, ListCatalogsSnafu,
|
CacheNotFoundSnafu, GetTableCacheSnafu, InvalidTableInfoInCatalogSnafu, ListCatalogsSnafu,
|
||||||
ListSchemasSnafu, ListTablesSnafu, Result, TableMetadataManagerSnafu,
|
ListSchemasSnafu, ListTablesSnafu, Result, TableMetadataManagerSnafu,
|
||||||
};
|
};
|
||||||
use crate::information_schema::{
|
use crate::information_schema::{InformationExtensionRef, InformationSchemaProvider};
|
||||||
InformationExtensionRef, InformationSchemaProvider, InformationSchemaTableFactoryRef,
|
|
||||||
};
|
|
||||||
use crate::kvbackend::TableCacheRef;
|
use crate::kvbackend::TableCacheRef;
|
||||||
use crate::process_manager::ProcessManagerRef;
|
use crate::process_manager::ProcessManagerRef;
|
||||||
use crate::system_schema::SystemSchemaProvider;
|
|
||||||
use crate::system_schema::numbers_table_provider::NumbersTableProvider;
|
|
||||||
use crate::system_schema::pg_catalog::PGCatalogProvider;
|
use crate::system_schema::pg_catalog::PGCatalogProvider;
|
||||||
|
use crate::system_schema::SystemSchemaProvider;
|
||||||
|
use crate::CatalogManager;
|
||||||
|
|
||||||
/// Access all existing catalog, schema and tables.
|
/// Access all existing catalog, schema and tables.
|
||||||
///
|
///
|
||||||
@@ -70,22 +66,60 @@ use crate::system_schema::pg_catalog::PGCatalogProvider;
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct KvBackendCatalogManager {
|
pub struct KvBackendCatalogManager {
|
||||||
/// Provides the extension methods for the `information_schema` tables
|
/// Provides the extension methods for the `information_schema` tables
|
||||||
pub(super) information_extension: InformationExtensionRef,
|
information_extension: InformationExtensionRef,
|
||||||
/// Manages partition rules.
|
/// Manages partition rules.
|
||||||
pub(super) partition_manager: PartitionRuleManagerRef,
|
partition_manager: PartitionRuleManagerRef,
|
||||||
/// Manages table metadata.
|
/// Manages table metadata.
|
||||||
pub(super) table_metadata_manager: TableMetadataManagerRef,
|
table_metadata_manager: TableMetadataManagerRef,
|
||||||
/// A sub-CatalogManager that handles system tables
|
/// A sub-CatalogManager that handles system tables
|
||||||
pub(super) system_catalog: SystemCatalog,
|
system_catalog: SystemCatalog,
|
||||||
/// Cache registry for all caches.
|
/// Cache registry for all caches.
|
||||||
pub(super) cache_registry: LayeredCacheRegistryRef,
|
cache_registry: LayeredCacheRegistryRef,
|
||||||
/// Only available in `Standalone` mode.
|
/// Only available in `Standalone` mode.
|
||||||
pub(super) procedure_manager: Option<ProcedureManagerRef>,
|
procedure_manager: Option<ProcedureManagerRef>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) const CATALOG_CACHE_MAX_CAPACITY: u64 = 128;
|
const CATALOG_CACHE_MAX_CAPACITY: u64 = 128;
|
||||||
|
|
||||||
impl KvBackendCatalogManager {
|
impl KvBackendCatalogManager {
|
||||||
|
pub fn new(
|
||||||
|
information_extension: InformationExtensionRef,
|
||||||
|
backend: KvBackendRef,
|
||||||
|
cache_registry: LayeredCacheRegistryRef,
|
||||||
|
procedure_manager: Option<ProcedureManagerRef>,
|
||||||
|
process_manager: Option<ProcessManagerRef>,
|
||||||
|
) -> Arc<Self> {
|
||||||
|
Arc::new_cyclic(|me| Self {
|
||||||
|
information_extension,
|
||||||
|
partition_manager: Arc::new(PartitionRuleManager::new(
|
||||||
|
backend.clone(),
|
||||||
|
cache_registry
|
||||||
|
.get()
|
||||||
|
.expect("Failed to get table_route_cache"),
|
||||||
|
)),
|
||||||
|
table_metadata_manager: Arc::new(TableMetadataManager::new(backend.clone())),
|
||||||
|
system_catalog: SystemCatalog {
|
||||||
|
catalog_manager: me.clone(),
|
||||||
|
catalog_cache: Cache::new(CATALOG_CACHE_MAX_CAPACITY),
|
||||||
|
pg_catalog_cache: Cache::new(CATALOG_CACHE_MAX_CAPACITY),
|
||||||
|
information_schema_provider: Arc::new(InformationSchemaProvider::new(
|
||||||
|
DEFAULT_CATALOG_NAME.to_string(),
|
||||||
|
me.clone(),
|
||||||
|
Arc::new(FlowMetadataManager::new(backend.clone())),
|
||||||
|
process_manager.clone(),
|
||||||
|
)),
|
||||||
|
pg_catalog_provider: Arc::new(PGCatalogProvider::new(
|
||||||
|
DEFAULT_CATALOG_NAME.to_string(),
|
||||||
|
me.clone(),
|
||||||
|
)),
|
||||||
|
backend,
|
||||||
|
process_manager,
|
||||||
|
},
|
||||||
|
cache_registry,
|
||||||
|
procedure_manager,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn view_info_cache(&self) -> Result<ViewInfoCacheRef> {
|
pub fn view_info_cache(&self) -> Result<ViewInfoCacheRef> {
|
||||||
self.cache_registry.get().context(CacheNotFoundSnafu {
|
self.cache_registry.get().context(CacheNotFoundSnafu {
|
||||||
name: "view_info_cache",
|
name: "view_info_cache",
|
||||||
@@ -108,78 +142,6 @@ impl KvBackendCatalogManager {
|
|||||||
pub fn procedure_manager(&self) -> Option<ProcedureManagerRef> {
|
pub fn procedure_manager(&self) -> Option<ProcedureManagerRef> {
|
||||||
self.procedure_manager.clone()
|
self.procedure_manager.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override logical table's partition key indices with physical table's.
|
|
||||||
async fn override_logical_table_partition_key_indices(
|
|
||||||
table_route_cache: &TableRouteCacheRef,
|
|
||||||
table_info_manager: &TableInfoManager,
|
|
||||||
table: TableRef,
|
|
||||||
) -> Result<TableRef> {
|
|
||||||
// If the table is not a metric table, return the table directly.
|
|
||||||
if table.table_info().meta.engine != METRIC_ENGINE_NAME {
|
|
||||||
return Ok(table);
|
|
||||||
}
|
|
||||||
|
|
||||||
if let Some(table_route_value) = table_route_cache
|
|
||||||
.get(table.table_info().table_id())
|
|
||||||
.await
|
|
||||||
.context(TableMetadataManagerSnafu)?
|
|
||||||
&& let TableRoute::Logical(logical_route) = &*table_route_value
|
|
||||||
&& let Some(physical_table_info_value) = table_info_manager
|
|
||||||
.get(logical_route.physical_table_id())
|
|
||||||
.await
|
|
||||||
.context(TableMetadataManagerSnafu)?
|
|
||||||
{
|
|
||||||
let mut new_table_info = (*table.table_info()).clone();
|
|
||||||
|
|
||||||
let mut phy_part_cols_not_in_logical_table = vec![];
|
|
||||||
|
|
||||||
// Remap partition key indices from physical table to logical table
|
|
||||||
new_table_info.meta.partition_key_indices = physical_table_info_value
|
|
||||||
.table_info
|
|
||||||
.meta
|
|
||||||
.partition_key_indices
|
|
||||||
.iter()
|
|
||||||
.filter_map(|&physical_index| {
|
|
||||||
// Get the column name from the physical table using the physical index
|
|
||||||
physical_table_info_value
|
|
||||||
.table_info
|
|
||||||
.meta
|
|
||||||
.schema
|
|
||||||
.column_schemas
|
|
||||||
.get(physical_index)
|
|
||||||
.and_then(|physical_column| {
|
|
||||||
// Find the corresponding index in the logical table schema
|
|
||||||
let idx = new_table_info
|
|
||||||
.meta
|
|
||||||
.schema
|
|
||||||
.column_index_by_name(physical_column.name.as_str());
|
|
||||||
if idx.is_none() {
|
|
||||||
// not all part columns in physical table that are also in logical table
|
|
||||||
phy_part_cols_not_in_logical_table
|
|
||||||
.push(physical_column.name.clone());
|
|
||||||
}
|
|
||||||
|
|
||||||
idx
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let partition_rules = if !phy_part_cols_not_in_logical_table.is_empty() {
|
|
||||||
Some(PartitionRules {
|
|
||||||
extra_phy_cols_not_in_logical_table: phy_part_cols_not_in_logical_table,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let new_table = DistTable::table_partitioned(Arc::new(new_table_info), partition_rules);
|
|
||||||
|
|
||||||
return Ok(new_table);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(table)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
@@ -306,7 +268,10 @@ impl CatalogManager for KvBackendCatalogManager {
|
|||||||
let table_cache: TableCacheRef = self.cache_registry.get().context(CacheNotFoundSnafu {
|
let table_cache: TableCacheRef = self.cache_registry.get().context(CacheNotFoundSnafu {
|
||||||
name: "table_cache",
|
name: "table_cache",
|
||||||
})?;
|
})?;
|
||||||
|
let table_route_cache: TableRouteCacheRef =
|
||||||
|
self.cache_registry.get().context(CacheNotFoundSnafu {
|
||||||
|
name: "table_route_cache",
|
||||||
|
})?;
|
||||||
let table = table_cache
|
let table = table_cache
|
||||||
.get_by_ref(&TableName {
|
.get_by_ref(&TableName {
|
||||||
catalog_name: catalog_name.to_string(),
|
catalog_name: catalog_name.to_string(),
|
||||||
@@ -316,18 +281,55 @@ impl CatalogManager for KvBackendCatalogManager {
|
|||||||
.await
|
.await
|
||||||
.context(GetTableCacheSnafu)?;
|
.context(GetTableCacheSnafu)?;
|
||||||
|
|
||||||
if let Some(table) = table {
|
// Override logical table's partition key indices with physical table's.
|
||||||
let table_route_cache: TableRouteCacheRef =
|
if let Some(table) = &table
|
||||||
self.cache_registry.get().context(CacheNotFoundSnafu {
|
&& let Some(table_route_value) = table_route_cache
|
||||||
name: "table_route_cache",
|
.get(table.table_info().table_id())
|
||||||
})?;
|
.await
|
||||||
return Self::override_logical_table_partition_key_indices(
|
.context(TableMetadataManagerSnafu)?
|
||||||
&table_route_cache,
|
&& let TableRoute::Logical(logical_route) = &*table_route_value
|
||||||
self.table_metadata_manager.table_info_manager(),
|
&& let Some(physical_table_info_value) = self
|
||||||
table,
|
.table_metadata_manager
|
||||||
)
|
.table_info_manager()
|
||||||
.await
|
.get(logical_route.physical_table_id())
|
||||||
.map(Some);
|
.await
|
||||||
|
.context(TableMetadataManagerSnafu)?
|
||||||
|
{
|
||||||
|
let mut new_table_info = (*table.table_info()).clone();
|
||||||
|
// Gather all column names from the logical table
|
||||||
|
let logical_column_names: std::collections::HashSet<_> = new_table_info
|
||||||
|
.meta
|
||||||
|
.schema
|
||||||
|
.column_schemas()
|
||||||
|
.iter()
|
||||||
|
.map(|col| &col.name)
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
// Only preserve partition key indices where the corresponding columns exist in logical table
|
||||||
|
new_table_info.meta.partition_key_indices = physical_table_info_value
|
||||||
|
.table_info
|
||||||
|
.meta
|
||||||
|
.partition_key_indices
|
||||||
|
.iter()
|
||||||
|
.filter(|&&index| {
|
||||||
|
if let Some(physical_column) = physical_table_info_value
|
||||||
|
.table_info
|
||||||
|
.meta
|
||||||
|
.schema
|
||||||
|
.column_schemas
|
||||||
|
.get(index)
|
||||||
|
{
|
||||||
|
logical_column_names.contains(&physical_column.name)
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.cloned()
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
let new_table = DistTable::table(Arc::new(new_table_info));
|
||||||
|
|
||||||
|
return Ok(Some(new_table));
|
||||||
}
|
}
|
||||||
|
|
||||||
if channel == Channel::Postgres {
|
if channel == Channel::Postgres {
|
||||||
@@ -340,64 +342,7 @@ impl CatalogManager for KvBackendCatalogManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(None)
|
Ok(table)
|
||||||
}
|
|
||||||
|
|
||||||
async fn table_id(
|
|
||||||
&self,
|
|
||||||
catalog_name: &str,
|
|
||||||
schema_name: &str,
|
|
||||||
table_name: &str,
|
|
||||||
query_ctx: Option<&QueryContext>,
|
|
||||||
) -> Result<Option<TableId>> {
|
|
||||||
let channel = query_ctx.map_or(Channel::Unknown, |ctx| ctx.channel());
|
|
||||||
if let Some(table) =
|
|
||||||
self.system_catalog
|
|
||||||
.table(catalog_name, schema_name, table_name, query_ctx)
|
|
||||||
{
|
|
||||||
return Ok(Some(table.table_info().table_id()));
|
|
||||||
}
|
|
||||||
|
|
||||||
let table_cache: TableNameCacheRef =
|
|
||||||
self.cache_registry.get().context(CacheNotFoundSnafu {
|
|
||||||
name: "table_name_cache",
|
|
||||||
})?;
|
|
||||||
|
|
||||||
let table = table_cache
|
|
||||||
.get_by_ref(&TableName {
|
|
||||||
catalog_name: catalog_name.to_string(),
|
|
||||||
schema_name: schema_name.to_string(),
|
|
||||||
table_name: table_name.to_string(),
|
|
||||||
})
|
|
||||||
.await
|
|
||||||
.context(GetTableCacheSnafu)?;
|
|
||||||
|
|
||||||
if let Some(table) = table {
|
|
||||||
return Ok(Some(table));
|
|
||||||
}
|
|
||||||
|
|
||||||
if channel == Channel::Postgres {
|
|
||||||
// falldown to pg_catalog
|
|
||||||
if let Some(table) =
|
|
||||||
self.system_catalog
|
|
||||||
.table(catalog_name, PG_CATALOG_NAME, table_name, query_ctx)
|
|
||||||
{
|
|
||||||
return Ok(Some(table.table_info().table_id()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn table_info_by_id(&self, table_id: TableId) -> Result<Option<TableInfoRef>> {
|
|
||||||
let table_info_cache: TableInfoCacheRef =
|
|
||||||
self.cache_registry.get().context(CacheNotFoundSnafu {
|
|
||||||
name: "table_info_cache",
|
|
||||||
})?;
|
|
||||||
table_info_cache
|
|
||||||
.get_by_ref(&table_id)
|
|
||||||
.await
|
|
||||||
.context(GetTableCacheSnafu)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn tables_by_ids(
|
async fn tables_by_ids(
|
||||||
@@ -449,20 +394,8 @@ impl CatalogManager for KvBackendCatalogManager {
|
|||||||
let catalog = catalog.to_string();
|
let catalog = catalog.to_string();
|
||||||
let schema = schema.to_string();
|
let schema = schema.to_string();
|
||||||
let semaphore = Arc::new(Semaphore::new(CONCURRENCY));
|
let semaphore = Arc::new(Semaphore::new(CONCURRENCY));
|
||||||
let table_route_cache: Result<TableRouteCacheRef> =
|
|
||||||
self.cache_registry.get().context(CacheNotFoundSnafu {
|
|
||||||
name: "table_route_cache",
|
|
||||||
});
|
|
||||||
|
|
||||||
common_runtime::spawn_global(async move {
|
common_runtime::spawn_global(async move {
|
||||||
let table_route_cache = match table_route_cache {
|
|
||||||
Ok(table_route_cache) => table_route_cache,
|
|
||||||
Err(e) => {
|
|
||||||
let _ = tx.send(Err(e)).await;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let table_id_stream = metadata_manager
|
let table_id_stream = metadata_manager
|
||||||
.table_name_manager()
|
.table_name_manager()
|
||||||
.tables(&catalog, &schema)
|
.tables(&catalog, &schema)
|
||||||
@@ -489,7 +422,6 @@ impl CatalogManager for KvBackendCatalogManager {
|
|||||||
let metadata_manager = metadata_manager.clone();
|
let metadata_manager = metadata_manager.clone();
|
||||||
let tx = tx.clone();
|
let tx = tx.clone();
|
||||||
let semaphore = semaphore.clone();
|
let semaphore = semaphore.clone();
|
||||||
let table_route_cache = table_route_cache.clone();
|
|
||||||
common_runtime::spawn_global(async move {
|
common_runtime::spawn_global(async move {
|
||||||
// we don't explicitly close the semaphore so just ignore the potential error.
|
// we don't explicitly close the semaphore so just ignore the potential error.
|
||||||
let _ = semaphore.acquire().await;
|
let _ = semaphore.acquire().await;
|
||||||
@@ -507,16 +439,6 @@ impl CatalogManager for KvBackendCatalogManager {
|
|||||||
};
|
};
|
||||||
|
|
||||||
for table in table_info_values.into_values().map(build_table) {
|
for table in table_info_values.into_values().map(build_table) {
|
||||||
let table = if let Ok(table) = table {
|
|
||||||
Self::override_logical_table_partition_key_indices(
|
|
||||||
&table_route_cache,
|
|
||||||
metadata_manager.table_info_manager(),
|
|
||||||
table,
|
|
||||||
)
|
|
||||||
.await
|
|
||||||
} else {
|
|
||||||
table
|
|
||||||
};
|
|
||||||
if tx.send(table).await.is_err() {
|
if tx.send(table).await.is_err() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -546,19 +468,16 @@ fn build_table(table_info_value: TableInfoValue) -> Result<TableRef> {
|
|||||||
/// - information_schema.{tables}
|
/// - information_schema.{tables}
|
||||||
/// - pg_catalog.{tables}
|
/// - pg_catalog.{tables}
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub(super) struct SystemCatalog {
|
struct SystemCatalog {
|
||||||
pub(super) catalog_manager: Weak<KvBackendCatalogManager>,
|
catalog_manager: Weak<KvBackendCatalogManager>,
|
||||||
pub(super) catalog_cache: Cache<String, Arc<InformationSchemaProvider>>,
|
catalog_cache: Cache<String, Arc<InformationSchemaProvider>>,
|
||||||
pub(super) pg_catalog_cache: Cache<String, Arc<PGCatalogProvider>>,
|
pg_catalog_cache: Cache<String, Arc<PGCatalogProvider>>,
|
||||||
|
|
||||||
// system_schema_provider for default catalog
|
// system_schema_provider for default catalog
|
||||||
pub(super) information_schema_provider: Arc<InformationSchemaProvider>,
|
information_schema_provider: Arc<InformationSchemaProvider>,
|
||||||
pub(super) pg_catalog_provider: Arc<PGCatalogProvider>,
|
pg_catalog_provider: Arc<PGCatalogProvider>,
|
||||||
pub(super) numbers_table_provider: NumbersTableProvider,
|
backend: KvBackendRef,
|
||||||
pub(super) backend: KvBackendRef,
|
process_manager: Option<ProcessManagerRef>,
|
||||||
pub(super) process_manager: Option<ProcessManagerRef>,
|
|
||||||
pub(super) extra_information_table_factories:
|
|
||||||
std::collections::HashMap<String, InformationSchemaTableFactoryRef>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SystemCatalog {
|
impl SystemCatalog {
|
||||||
@@ -583,7 +502,9 @@ impl SystemCatalog {
|
|||||||
PG_CATALOG_NAME if channel == Channel::Postgres => {
|
PG_CATALOG_NAME if channel == Channel::Postgres => {
|
||||||
self.pg_catalog_provider.table_names()
|
self.pg_catalog_provider.table_names()
|
||||||
}
|
}
|
||||||
DEFAULT_SCHEMA_NAME => self.numbers_table_provider.table_names(),
|
DEFAULT_SCHEMA_NAME => {
|
||||||
|
vec![NUMBERS_TABLE_NAME.to_string()]
|
||||||
|
}
|
||||||
_ => vec![],
|
_ => vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -601,7 +522,7 @@ impl SystemCatalog {
|
|||||||
if schema == INFORMATION_SCHEMA_NAME {
|
if schema == INFORMATION_SCHEMA_NAME {
|
||||||
self.information_schema_provider.table(table).is_some()
|
self.information_schema_provider.table(table).is_some()
|
||||||
} else if schema == DEFAULT_SCHEMA_NAME {
|
} else if schema == DEFAULT_SCHEMA_NAME {
|
||||||
self.numbers_table_provider.table_exists(table)
|
table == NUMBERS_TABLE_NAME
|
||||||
} else if schema == PG_CATALOG_NAME && channel == Channel::Postgres {
|
} else if schema == PG_CATALOG_NAME && channel == Channel::Postgres {
|
||||||
self.pg_catalog_provider.table(table).is_some()
|
self.pg_catalog_provider.table(table).is_some()
|
||||||
} else {
|
} else {
|
||||||
@@ -620,16 +541,12 @@ impl SystemCatalog {
|
|||||||
if schema == INFORMATION_SCHEMA_NAME {
|
if schema == INFORMATION_SCHEMA_NAME {
|
||||||
let information_schema_provider =
|
let information_schema_provider =
|
||||||
self.catalog_cache.get_with_by_ref(catalog, move || {
|
self.catalog_cache.get_with_by_ref(catalog, move || {
|
||||||
let provider = InformationSchemaProvider::new(
|
Arc::new(InformationSchemaProvider::new(
|
||||||
catalog.to_string(),
|
catalog.to_string(),
|
||||||
self.catalog_manager.clone(),
|
self.catalog_manager.clone(),
|
||||||
Arc::new(FlowMetadataManager::new(self.backend.clone())),
|
Arc::new(FlowMetadataManager::new(self.backend.clone())),
|
||||||
self.process_manager.clone(),
|
self.process_manager.clone(),
|
||||||
self.backend.clone(),
|
))
|
||||||
);
|
|
||||||
let provider = provider
|
|
||||||
.with_extra_table_factories(self.extra_information_table_factories.clone());
|
|
||||||
Arc::new(provider)
|
|
||||||
});
|
});
|
||||||
information_schema_provider.table(table_name)
|
information_schema_provider.table(table_name)
|
||||||
} else if schema == PG_CATALOG_NAME && channel == Channel::Postgres {
|
} else if schema == PG_CATALOG_NAME && channel == Channel::Postgres {
|
||||||
@@ -645,8 +562,8 @@ impl SystemCatalog {
|
|||||||
});
|
});
|
||||||
pg_catalog_provider.table(table_name)
|
pg_catalog_provider.table(table_name)
|
||||||
}
|
}
|
||||||
} else if schema == DEFAULT_SCHEMA_NAME {
|
} else if schema == DEFAULT_SCHEMA_NAME && table_name == NUMBERS_TABLE_NAME {
|
||||||
self.numbers_table_provider.table(table_name)
|
Some(NumbersTable::table(NUMBERS_TABLE_ID))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user