Unverified Commit 399cf85a authored by ZackYoung's avatar ZackYoung Committed by GitHub

[Feature]Add paimon cache (#2513)

* add_paimon_cache * add_paimon_cache * add_paimon_cache * add_paimon_cache * add_paimon_cache * add_paimon_cache * add_paimon_cache
parent 9e599960
...@@ -310,7 +310,7 @@ ...@@ -310,7 +310,7 @@
<dependency> <dependency>
<groupId>org.apache.paimon</groupId> <groupId>org.apache.paimon</groupId>
<artifactId>paimon-bundle</artifactId> <artifactId>paimon-bundle</artifactId>
<version>0.4.0-incubating</version> <version>0.5.0-incubating</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.configure.cache;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class CacheConfiguration {
@Bean
public CacheManager cacheManager() {
return new PaimonCacheManager();
}
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.configure.cache;
import org.dinky.data.constant.PaimonTableConstant;
import org.dinky.data.paimon.CacheData;
import org.dinky.utils.PaimonUtil;
import org.apache.paimon.data.BinaryString;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import org.springframework.cache.support.AbstractValueAdaptingCache;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONReader;
import com.alibaba.fastjson2.JSONWriter;
import cn.hutool.cache.impl.TimedCache;
import cn.hutool.core.convert.Convert;
public class PaimonCache extends AbstractValueAdaptingCache {
private static final Class<CacheData> clazz = CacheData.class;
private final String cacheName;
private static final String TABLE_NAME = PaimonTableConstant.DINKY_CACHE;
/**
* TIMEOUT CACHE
*/
private final cn.hutool.cache.Cache<Object, Object> cache = new TimedCache<>(1000 * 60 * 30);
public PaimonCache(String cacheName) {
super(true);
this.cacheName = cacheName;
}
@Override
public String getName() {
return cacheName;
}
@Override
public Object getNativeCache() {
return this;
}
@Override
public <T> T get(Object key, Class<T> type) {
return (T) get(key).get();
}
@Override
protected Object lookup(Object key) {
String strKey = Convert.toStr(key);
Object o = cache.get(strKey);
if (o == null) {
PaimonUtil.createOrGetTable(TABLE_NAME, clazz);
List<CacheData> cacheData = PaimonUtil.batchReadTable(
TABLE_NAME,
clazz,
x -> Arrays.asList(
x.equal(x.indexOf("cache_name"), BinaryString.fromString(cacheName)),
x.equal(x.indexOf("key"), BinaryString.fromString(strKey))));
if (cacheData.isEmpty()) {
return null;
}
return deserialize(cacheData.get(0).getData());
}
return o;
}
@Override
public <T> T get(Object key, Callable<T> valueLoader) {
return (T) get(key).get();
}
@Override
public void put(Object key, Object value) {
String strKey = Convert.toStr(key);
cache.put(strKey, value);
PaimonUtil.createOrGetTable(TABLE_NAME, clazz);
CacheData cacheData = CacheData.builder()
.cacheName(cacheName)
.key(strKey)
.data(serialize(value))
.build();
PaimonUtil.write(TABLE_NAME, Collections.singletonList(cacheData), clazz);
}
@Override
public void evict(Object key) {
String strKey = Convert.toStr(key);
cache.remove(strKey);
CacheData cacheData =
CacheData.builder().cacheName(cacheName).key(strKey).data("").build();
PaimonUtil.write(TABLE_NAME, Collections.singletonList(cacheData), clazz);
}
@Override
public void clear() {
cache.clear();
PaimonUtil.dropTable(TABLE_NAME);
}
public String serialize(Object object) {
return JSON.toJSONString(object, JSONWriter.Feature.WriteClassName);
}
public Object deserialize(String json) {
return JSON.parseObject(json, Object.class, JSONReader.Feature.SupportAutoType);
}
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.configure.cache;
import java.util.Collection;
import java.util.LinkedHashSet;
import org.springframework.cache.Cache;
import org.springframework.cache.support.AbstractCacheManager;
public class PaimonCacheManager extends AbstractCacheManager {
@Override
protected Collection<? extends Cache> loadCaches() {
Collection<Cache> caches = new LinkedHashSet<>();
for (String cacheName : this.getCacheNames()) {
Cache cache = this.getCache(cacheName);
caches.add(cache);
}
return caches;
}
@Override
protected Cache getMissingCache(String name) {
return new PaimonCache(name);
}
}
...@@ -19,16 +19,21 @@ ...@@ -19,16 +19,21 @@
package org.dinky.context; package org.dinky.context;
import org.dinky.data.constant.PaimonTableConstant;
import org.dinky.data.enums.SseTopic; import org.dinky.data.enums.SseTopic;
import org.dinky.data.vo.MetricsVO; import org.dinky.data.vo.MetricsVO;
import org.dinky.utils.PaimonUtil; import org.dinky.utils.PaimonUtil;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import cn.hutool.core.text.StrFormatter; import cn.hutool.core.text.StrFormatter;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
...@@ -58,7 +63,7 @@ public class MetricsContextHolder { ...@@ -58,7 +63,7 @@ public class MetricsContextHolder {
long duration = System.currentTimeMillis() - lastDumpTime; long duration = System.currentTimeMillis() - lastDumpTime;
synchronized (metricsVOS) { synchronized (metricsVOS) {
if (metricsVOS.size() > 1000 || duration > 1000 * 5) { if (metricsVOS.size() > 1000 || duration > 1000 * 5) {
PaimonUtil.writeMetrics(metricsVOS); writeMetrics(metricsVOS);
metricsVOS.clear(); metricsVOS.clear();
} }
} }
...@@ -66,4 +71,13 @@ public class MetricsContextHolder { ...@@ -66,4 +71,13 @@ public class MetricsContextHolder {
SseSessionContextHolder.sendTopic(topic, o); SseSessionContextHolder.sendTopic(topic, o);
}); });
} }
private static synchronized void writeMetrics(List<MetricsVO> metricsList) {
ObjectUtil.clone(metricsList).forEach(metrics -> {
LocalDateTime now = metrics.getHeartTime();
metrics.setDate(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
metrics.setContent(JSONUtil.toJsonStr(metrics.getContent()));
});
PaimonUtil.write(PaimonTableConstant.DINKY_METRICS, metricsList, MetricsVO.class);
}
} }
...@@ -89,6 +89,7 @@ public class TokenController { ...@@ -89,6 +89,7 @@ public class TokenController {
value = {PermissionConstants.AUTH_TOKEN_ADD, PermissionConstants.AUTH_TOKEN_EDIT}, value = {PermissionConstants.AUTH_TOKEN_ADD, PermissionConstants.AUTH_TOKEN_EDIT},
mode = SaMode.OR) mode = SaMode.OR)
public Result<Void> saveOrUpdateToken(@RequestBody SysToken sysToken) { public Result<Void> saveOrUpdateToken(@RequestBody SysToken sysToken) {
sysToken.setSource(SysToken.Source.CUSTOM);
return tokenService.saveOrUpdate(sysToken) return tokenService.saveOrUpdate(sysToken)
? Result.succeed(Status.SAVE_SUCCESS) ? Result.succeed(Status.SAVE_SUCCESS)
: Result.failed(Status.SAVE_FAILED); : Result.failed(Status.SAVE_FAILED);
......
...@@ -19,6 +19,12 @@ ...@@ -19,6 +19,12 @@
package org.dinky.data.vo; package org.dinky.data.vo;
import org.dinky.data.annotations.paimon.Option;
import org.dinky.data.annotations.paimon.Options;
import org.dinky.data.annotations.paimon.PartitionKey;
import org.dinky.data.annotations.paimon.PrimaryKey;
import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
...@@ -37,20 +43,34 @@ import lombok.NoArgsConstructor; ...@@ -37,20 +43,34 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel(value = "MetricsVO", description = "Metrics Value Object") @ApiModel(value = "MetricsVO", description = "Metrics Value Object")
public class MetricsVO { @Options({
@ApiModelProperty(value = "Content of metrics", dataType = "Object", notes = "Content of the metrics data.") @Option(key = "file.format", value = "parquet"),
private Object content; @Option(key = "snapshot.time-retained", value = "10 s"),
@Option(key = "partition.expiration-time", value = "7d"),
@ApiModelProperty(value = "Model name", dataType = "String", notes = "Name of the model.") @Option(key = "partition.expiration-check-interval", value = "1d"),
private String model; @Option(key = "partition.timestamp-formatter", value = "yyyy-MM-dd"),
@Option(key = "partition.timestamp-pattern", value = "$date"),
})
public class MetricsVO implements Serializable {
@JsonDeserialize(using = LocalDateTimeDeserializer.class) @JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class) @JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@PrimaryKey
@ApiModelProperty( @ApiModelProperty(
value = "Timestamp of heartbeart", value = "Timestamp of heartbeart",
dataType = "LocalDateTime", dataType = "LocalDateTime",
notes = "Timestamp of the heartbeat data.", notes = "Timestamp of the heartbeat data.",
example = "2023-09-15 14:30:00") example = "2023-09-15 14:30:00")
private LocalDateTime heartTime; private LocalDateTime heartTime;
@ApiModelProperty(value = "Model name", dataType = "String", notes = "Name of the model.")
@PartitionKey
private String model;
@ApiModelProperty(value = "Content of metrics", dataType = "Object", notes = "Content of the metrics data.")
private Object content;
@PartitionKey
private String date;
} }
...@@ -49,7 +49,6 @@ public class JobMetricsHandler { ...@@ -49,7 +49,6 @@ public class JobMetricsHandler {
* Use concurrent programming to get the data of each indicator through asynchronous requests. </br> * Use concurrent programming to get the data of each indicator through asynchronous requests. </br>
* Send to MetricsContextHolder asynchronously at the end of the method. </br> * Send to MetricsContextHolder asynchronously at the end of the method. </br>
* Thus, the operation of writing the Flink indicator is completed. </br> * Thus, the operation of writing the Flink indicator is completed. </br>
*
*/ */
public static void writeFlinkMetrics(JobInfoDetail jobInfoDetail) { public static void writeFlinkMetrics(JobInfoDetail jobInfoDetail) {
Map<String, Map<String, String>> customMetricsList = jobInfoDetail.getCustomMetricsMap(); Map<String, Map<String, String>> customMetricsList = jobInfoDetail.getCustomMetricsMap();
...@@ -64,8 +63,10 @@ public class JobMetricsHandler { ...@@ -64,8 +63,10 @@ public class JobMetricsHandler {
.toArray(CompletableFuture[]::new); .toArray(CompletableFuture[]::new);
// Wait for all Completable Future executions to finish // Wait for all Completable Future executions to finish
AsyncUtil.waitAll(array); AsyncUtil.waitAll(array);
MetricsVO metricsVO = new MetricsVO();
MetricsVO metricsVO = new MetricsVO(customMetricsList, jobId, LocalDateTime.now()); metricsVO.setContent(customMetricsList);
metricsVO.setHeartTime(LocalDateTime.now());
metricsVO.setModel(jobId);
MetricsContextHolder.getInstances().sendAsync(metricsVO.getModel(), metricsVO); MetricsContextHolder.getInstances().sendAsync(metricsVO.getModel(), metricsVO);
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
package org.dinky.service.impl; package org.dinky.service.impl;
import org.dinky.data.constant.PaimonTableConstant;
import org.dinky.data.dto.MetricsLayoutDTO; import org.dinky.data.dto.MetricsLayoutDTO;
import org.dinky.data.exception.DinkyException; import org.dinky.data.exception.DinkyException;
import org.dinky.data.metrics.Jvm; import org.dinky.data.metrics.Jvm;
...@@ -81,7 +82,7 @@ public class MonitorServiceImpl extends ServiceImpl<MetricsMapper, Metrics> impl ...@@ -81,7 +82,7 @@ public class MonitorServiceImpl extends ServiceImpl<MetricsMapper, Metrics> impl
return CollUtil.newArrayList(local, greaterOrEqual, lessOrEqual); return CollUtil.newArrayList(local, greaterOrEqual, lessOrEqual);
}; };
List<MetricsVO> metricsVOList = List<MetricsVO> metricsVOList =
PaimonUtil.batchReadTable(PaimonUtil.METRICS_IDENTIFIER, MetricsVO.class, filter); PaimonUtil.batchReadTable(PaimonTableConstant.DINKY_METRICS, MetricsVO.class, filter);
return metricsVOList.stream() return metricsVOList.stream()
.filter(x -> x.getHeartTime().isAfter(startTS.toLocalDateTime())) .filter(x -> x.getHeartTime().isAfter(startTS.toLocalDateTime()))
.filter(x -> x.getHeartTime().isBefore(endTS.toLocalDateTime())) .filter(x -> x.getHeartTime().isBefore(endTS.toLocalDateTime()))
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.utils;
import org.apache.paimon.types.DataType;
import org.apache.paimon.types.DataTypes;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Map;
import cn.hutool.core.map.MapUtil;
public class PaimonTypeUtil {
private static final Map<Class<?>, DataType> TYPE_MAP = MapUtil.<Class<?>, DataType>builder(
String.class, DataTypes.STRING())
.put(Integer.class, DataTypes.INT())
.put(Long.class, DataTypes.BIGINT())
.put(Double.class, DataTypes.DOUBLE())
.put(Float.class, DataTypes.FLOAT())
.put(Boolean.class, DataTypes.BOOLEAN())
.put(Byte.class, DataTypes.TINYINT())
.put(Short.class, DataTypes.SMALLINT())
.put(BigDecimal.class, DataTypes.DECIMAL(30, 4))
.put(Date.class, DataTypes.TIMESTAMP(3))
.put(LocalDateTime.class, DataTypes.TIMESTAMP(3))
.build();
public static DataType classToDataType(Class<?> clazz) {
return TYPE_MAP.getOrDefault(clazz, DataTypes.STRING());
}
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.data.annotations.paimon;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.ANNOTATION_TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Option {
String key();
String value();
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.data.annotations.paimon;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface Options {
Option[] value();
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.data.annotations.paimon;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@PrimaryKey
public @interface PartitionKey {}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.data.annotations.paimon;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
public @interface PrimaryKey {}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.data.constant;
public final class PaimonTableConstant {
public static final String DINKY_DB = "dinky_db";
public static final String DINKY_CACHE = "dinky_cache";
public static final String DINKY_METRICS = "dinky_metrics";
}
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.data.paimon;
import org.dinky.data.annotations.paimon.Option;
import org.dinky.data.annotations.paimon.Options;
import org.dinky.data.annotations.paimon.PartitionKey;
import org.dinky.data.annotations.paimon.PrimaryKey;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Options({
@Option(key = "file.format", value = "parquet"),
@Option(key = "snapshot.time-retained", value = "10 s"),
})
public class CacheData implements Serializable {
@PartitionKey
private String cacheName;
@PrimaryKey
private String key;
/**
* Serialized json data
*/
private String data;
}
...@@ -88,10 +88,10 @@ const DataSource = (props: any) => { ...@@ -88,10 +88,10 @@ const DataSource = (props: any) => {
onRefreshTreeData(value); onRefreshTreeData(value);
}; };
BtnRoute['menu.datastudio.metadata'][0].onClick = () => { BtnRoute['menu.datastudio.datasource'][0].onClick = () => {
setShowCreate(true); setShowCreate(true);
}; };
BtnRoute['menu.datastudio.metadata'][1].onClick = () => { BtnRoute['menu.datastudio.datasource'][1].onClick = () => {
if (!selectDatabaseId) return; if (!selectDatabaseId) return;
setIsLoadingDatabase(true); setIsLoadingDatabase(true);
clearDataSourceTable(selectDatabaseId).then(() => { clearDataSourceTable(selectDatabaseId).then(() => {
......
...@@ -228,7 +228,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = { ...@@ -228,7 +228,7 @@ export const LeftBottomMoreTabs: { [c: string]: TabProp[] } = {
// btn route // btn route
export const BtnRoute: { [c: string]: CircleDataStudioButtonProps[] } = { export const BtnRoute: { [c: string]: CircleDataStudioButtonProps[] } = {
'menu.datastudio.metadata': [ 'menu.datastudio.datasource': [
{ {
icon: <PlusOutlined />, icon: <PlusOutlined />,
title: l('button.create'), title: l('button.create'),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment