Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions Dockerfile_doris_jdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

FROM ubuntu:22.04

ARG TARGETARCH


RUN sed -i -e 's/^APT/# APT/' -e 's/^DPkg/# DPkg/' /etc/apt/apt.conf.d/docker-clean && \
apt-get update -y && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends wget && mkdir -p /usr/lib/jvm/;

RUN if echo $TARGETARCH | grep 'arm64' >>/dev/null ; then \
wget -c http://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/bisheng-jdk-17.0.11-linux-aarch64.tar.gz -O - | tar -xz -C /usr/lib/jvm/ && mv /usr/lib/jvm/bisheng-jdk-17.0.11/ /usr/lib/jvm/jdk-17 && \
wget -c http://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/bisheng-jdk-8u352-linux-aarch64.tar.gz -O - | tar -xz -C /usr/lib/jvm/ && mv /usr/lib/jvm/bisheng-jdk1.8.0_352/ /usr/lib/jvm/jdk-8; \
else \
wget -c http://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/openjdk-17.0.2_linux-x64_bin.tar.gz -O - | tar -xz -C /usr/lib/jvm/ && mv /usr/lib/jvm/jdk-17.0.2/ /usr/lib/jvm/jdk-17 && \
wget -c http://selectdb-doris-1308700295.cos.ap-beijing.myqcloud.com/release/jdbc_driver/openjdk-8u352-b08-linux-x64.tar.gz -O - | tar -xz -C /usr/lib/jvm/ && mv /usr/lib/jvm/openjdk-8u352-b08-linux-x64/ /usr/lib/jvm/jdk-8; \
fi;

WORKDIR /workspace
2 changes: 1 addition & 1 deletion api/doris/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (

var (
AnnotationDebugKey = "selectdb.com.doris/runmode"
AnnotationDebugDorisKey = "apache.org.doris/runmode"
AnnotationDebugValue = "debug"
AnnotationDebugDorisKey = "apache.com.doris/runmode"
)

// DorisClusterSpec defines the desired state of DorisCluster
Expand Down
72 changes: 42 additions & 30 deletions cmd/doris-debug/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ package main
import (
"flag"
"fmt"
v1 "github.com/apache/doris-operator/api/doris/v1"
"github.com/apache/doris-operator/pkg/common/utils/resource"
"github.com/spf13/viper"
"net/http"
"os"
"strconv"

v1 "github.com/apache/doris-operator/api/doris/v1"
"github.com/apache/doris-operator/pkg/common/utils/resource"
"github.com/spf13/viper"
)

var (
Expand All @@ -40,7 +41,7 @@ func main() {
return
}

fmt.Println("start component " + componentType + "for debugging.....")
fmt.Println("start component " + componentType + " for debugging.....")
listenPort := readConfigListenPort()
//registerMockApiHealth()
if err := http.ListenAndServe(":"+listenPort, nil); err != nil {
Expand All @@ -62,7 +63,28 @@ func flagParse() {
}

func readConfigListenPort() string {
configFileName := dorisRootPath + "/" + componentType + "/conf/" + componentType + ".conf"

var listenPortName string
var configFileName string
var listenPort string

switch componentType {
case "fe":
configFileName = dorisRootPath + "/fe/conf/fe.conf"
listenPortName = resource.QUERY_PORT
case "be":
configFileName = dorisRootPath + "/be/conf/be.conf"
listenPortName = resource.HEARTBEAT_SERVICE_PORT
case "ms":
configFileName = dorisRootPath + "/ms/conf/doris_cloud.conf"
listenPortName = resource.BRPC_LISTEN_PORT
default:
{
fmt.Println("the componentType is not supported:" + componentType)
os.Exit(1)
}
}

_, err := os.Stat(configFileName)
if err != nil {
fmt.Println("the config file is not exist, stat error", err.Error())
Expand All @@ -72,34 +94,15 @@ func readConfigListenPort() string {
file, _ := os.Open(configFileName)
viper.SetConfigType("properties")
viper.ReadConfig(file)

var listenPort string
if componentType == "fe" {
configQueryPort := viper.GetString(resource.QUERY_PORT)
if configQueryPort == "" {
listenPort = strconv.Itoa(int(resource.GetDefaultPort(resource.QUERY_PORT)))
}
} else if componentType == "be" {
configHeartbeatPort := viper.GetString(resource.HEARTBEAT_SERVICE_PORT)
fmt.Println("component be" + configHeartbeatPort)
if configHeartbeatPort == "" {
listenPort = strconv.Itoa(int(resource.GetDefaultPort(resource.HEARTBEAT_SERVICE_PORT)))
}
listenPort = viper.GetString(listenPortName)
if listenPort == "" {
listenPort = strconv.Itoa(int(resource.GetDefaultPort(listenPortName)))
}
fmt.Println("component listen port " + listenPort)

fmt.Println("component listen port " + listenPort)
return listenPort
}

func registerMockApiHealth() {
if componentType == "fe" {
http.HandleFunc("/api/health", mockFEHealth)
return
}

http.HandleFunc("/api/health", mockBEHealth)
}

func kickOffDebug() bool {
annotationFileName := resource.POD_INFO_PATH + "/annotations"
if _, err := os.Stat(annotationFileName); os.IsNotExist(err) {
Expand All @@ -123,14 +126,23 @@ func kickOffDebug() bool {

valueDoris := viper.GetString(v1.AnnotationDebugDorisKey)

if valueDoris == "\""+v1.AnnotationDebugDorisKey+"\"" {
if valueDoris == "\""+v1.AnnotationDebugValue+"\"" {
return true
}

fmt.Println("the value not equal!", value, v1.AnnotationDebugValue, v1.AnnotationDebugDorisKey)
fmt.Printf("No debug flag matched, flags: [%s:%s],[%s:%s] !", v1.AnnotationDebugDorisKey, valueDoris, v1.AnnotationDebugKey, value)
return false
}

func registerMockApiHealth() {
if componentType == "fe" {
http.HandleFunc("/api/health", mockFEHealth)
return
}

http.HandleFunc("/api/health", mockBEHealth)
}

func mockFEHealth(w http.ResponseWriter, r *http.Request) {
//{"msg":"success","code":0,"data":{"online_backend_num":3,"total_backend_num":3},"count":0}
w.WriteHeader(http.StatusOK)
Expand Down