Skip to content

Commit

Permalink
modify incr channel wethear is null
Browse files Browse the repository at this point in the history
  • Loading branch information
baisui1981 committed Mar 27, 2024
1 parent 3db705c commit 04167e2
Show file tree
Hide file tree
Showing 25 changed files with 523 additions and 196 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
public class TestFlumeApplication extends TestCase {

public void testStartFlume() {
FlumeApplication.startFlume();
// FlumeApplication.startFlume();
}
}
53 changes: 53 additions & 0 deletions tis-console.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ spec:
type: LoadBalancer
---

apiVersion: v1
kind: Service
metadata:
name: tis-console-cluster-svc
spec:
ports:
- port: 8080
name: tis-console-8080
protocol: TCP
targetPort: tis-8080
- port: 56432
name: tis-console-grpc
protocol: TCP
targetPort: tis-grpc
selector:
app: tis-console
type: ClusterIP
---

#apiVersion: v1
#kind: PersistentVolume
#metadata:
Expand Down Expand Up @@ -83,6 +102,30 @@ spec:
selector:
matchLabels:
alicloud-pvname: disk-pv
---

apiVersion: v1
kind: ConfigMap
metadata:
name: tis-config
data:
config.properties: |-
project.name=TIS
runtime=daily
#tis.datasource.type=mysql
#tis.datasource.url=192.168.28.200
#tis.datasource.port=3306
#tis.datasource.username=root
#tis.datasource.password=123456
#tis.datasource.dbname=tis_console1
tis.datasource.type=derby
tis.datasource.dbname=tis_console_db
assemble.host=tis-console-cluster-svc.default
tis.host=tis-console-cluster-svc.default
---
# how to use aliyun pv: https://help.aliyun.com/zh/ack/ack-managed-and-ack-dedicated/user-guide/mount-a-statically-provisioned-oss-volume?spm=a2c4g.11186623.0.0.39145057wGt7rB
Expand All @@ -103,13 +146,23 @@ spec:
containers:
- name: tis-console
volumeMounts:
- name: tis-config-volume
mountPath: /opt/app/tis-uber/tjs/conf/tis-web-config/
- name: tis-config-volume
mountPath: /opt/app/tis-uber/tis-assemble/conf/tis-web-config/
- name: tis-console-pvc
mountPath: "/opt/data"
image: registry.cn-hangzhou.aliyuncs.com/tis/tis-console:4.0.0.2
# command: [ "/bin/sh", "-c", "sleep 1000000" ]
ports:
- name: tis-8080
containerPort: 8080
- name: tis-grpc
containerPort: 56432
volumes:
- name: tis-config-volume
configMap:
name: tis-config
- name: tis-console-pvc
persistentVolumeClaim:
claimName: disk-pvc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,41 +98,6 @@ public void doCreateNewTask(Context context) {
FullbuildPhase.parse(getInt(IParamContext.COMPONENT_START, FullbuildPhase.FullDump.getValue()))
, FullbuildPhase.parse(getInt(IParamContext.COMPONENT_END, FullbuildPhase.IndexBackFlow.getValue()))));
CreateNewTaskResult newTaskResult = this.createNewDataXTask(execContext, triggerType);

// if (StringUtils.isNotBlank(appname)) {
// app = this.getApplicationDAO().selectByName(appname);
// if (app == null) {
// throw new IllegalStateException("appname:" + appname + " relevant app pojo is not exist");
// }
// }
//
// WorkFlowBuildHistory task = new WorkFlowBuildHistory();
// task.setCreateTime(new Date());
// task.setStartTime(new Date());
// task.setWorkFlowId(workflowId);
// task.setTriggerType(triggerType.getValue());
// task.setState((byte) ExecResult.DOING.getValue());
// // Integer buildHistoryId = null;
// // 从什么阶段开始执行
// FullbuildPhase fromPhase = FullbuildPhase.parse(getInt(IParamContext.COMPONENT_START, FullbuildPhase.FullDump.getValue()));
// FullbuildPhase endPhase = FullbuildPhase.parse(getInt(IParamContext.COMPONENT_END, FullbuildPhase.IndexBackFlow.getValue()));
// if (app == null) {
// if (endPhase.bigThan(FullbuildPhase.JOIN)) {
// endPhase = FullbuildPhase.JOIN;
// }
// }
// if (fromPhase.getValue() > FullbuildPhase.FullDump.getValue()) {
// // 如果是从非第一步开始执行的话,需要客户端提供依赖的history记录id
// task.setHistoryId(this.getInt(IFullBuildContext.KEY_BUILD_HISTORY_TASK_ID));
// }
// // 说明只有workflow的流程和索引没有关系,所以不可能执行到索引build阶段去
// // task.setEndPhase((app == null) ? FullbuildPhase.JOIN.getValue() : FullbuildPhase.IndexBackFlow.getValue());
// task.setEndPhase(endPhase.getValue());
// task.setStartPhase(fromPhase.getValue());
// if (app != null) {
// task.setAppId(app.getAppId());
// task.setAppName(app.getProjectName());
// }
// 生成一个新的taskid
this.setBizResult(context, newTaskResult);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import com.qlangtech.tis.datax.impl.DataxReader;
import com.qlangtech.tis.datax.impl.DataxWriter;
import com.qlangtech.tis.datax.job.DefaultSSERunnable;
import com.qlangtech.tis.datax.job.FlinkClusterPojo;
import com.qlangtech.tis.datax.job.ILaunchingOrchestrate;
import com.qlangtech.tis.datax.job.ILaunchingOrchestrate.ExecuteStep;
import com.qlangtech.tis.datax.job.ILaunchingOrchestrate.ExecuteSteps;
Expand Down Expand Up @@ -387,9 +386,13 @@ public static IndexIncrStatus getIndexIncrStatus(BasicModule module, boolean get
IndexIncrStatus incrStatus = doGetDataXReaderWriterDesc(module.getCollectionName());
// 是否可以取缓存中的deployment信息,在刚删除pod重启之后需要取全新的deployment信息不能缓存
IPluginStore<IncrStreamFactory> store = getIncrStreamFactoryStore(module);
TISK8sDelegate k8s = TISK8sDelegate.getK8SDelegate(module.getCollectionName());

if ((store.getPlugin()) == null || !k8s.hasCreated()) {
if ((store.getPlugin()) == null) {
incrStatus.setK8sPluginInitialized(false);
return incrStatus;
}
TISK8sDelegate k8s = TISK8sDelegate.getK8SDelegate(module.getCollectionName());
if (!k8s.hasCreated()) {
incrStatus.setK8sPluginInitialized(false);
return incrStatus;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
import com.qlangtech.tis.solrdao.ISchema;
import com.qlangtech.tis.util.DescribableJSON;
import com.qlangtech.tis.util.DescriptorsJSON;
import com.qlangtech.tis.util.DescriptorsJSONResult;
import com.qlangtech.tis.util.HeteroEnum;
import com.qlangtech.tis.util.HeteroList;
import com.qlangtech.tis.util.IPluginContext;
Expand Down Expand Up @@ -268,7 +269,7 @@ public void doGetWriterPluginInfo(Context context) throws Exception {
// KeyedPluginStore<DataxWriter> writerStore = DataxWriter.getPluginStore(this, dataxName);
// DataxWriter writer = writerStore.getPlugin();
Map<String, Object> pluginInfo = Maps.newHashMap();
JSONObject writeDesc = null;
DescriptorsJSONResult writeDesc = null;
if (writer != null) {
pluginInfo.put("item", (new DescribableJSON(writer)).getItemJson());
writeDesc = DescriptorsJSON.desc(writer.getDescriptor());
Expand Down Expand Up @@ -1591,16 +1592,16 @@ public DataxPluginDescMeta(DescriptorExtensionList<DataxReader, Descriptor<Datax
}

@JSONField(serialize = false)
public com.alibaba.fastjson.JSONObject getPluginDesc() {
public DescriptorsJSONResult getPluginDesc() {
throw new UnsupportedOperationException();
}

public com.alibaba.fastjson.JSONObject getReaderDesc() {
public DescriptorsJSONResult getReaderDesc() {
return pluginDesc.getDescriptorsJSON();
}


public com.alibaba.fastjson.JSONObject getWriterDesc() {
public DescriptorsJSONResult getWriterDesc() {
return writerTypesDesc.getDescriptorsJSON();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.qlangtech.tis.extension.Describable;
import com.qlangtech.tis.extension.Descriptor;
import com.qlangtech.tis.util.DescriptorsJSON;
import com.qlangtech.tis.util.DescriptorsJSONResult;

import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -62,7 +63,7 @@ public Map<String, Integer> getTypedPluginCount() {
return this.plugins.entrySet().stream().collect(Collectors.toMap((e) -> e.getKey().token, (e) -> e.getValue().size()));
}

public com.alibaba.fastjson.JSONObject getPluginDesc() {
public DescriptorsJSONResult getPluginDesc() {
return pluginDesc.getDescriptorsJSON();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria;
import com.qlangtech.tis.manage.common.BasicDAO;
import org.apache.commons.lang3.StringUtils;

import java.sql.SQLException;
import java.util.List;

/**
Expand Down Expand Up @@ -100,7 +102,7 @@ public Application selectByPrimaryKey(Integer appId) {
}

public int updateByExampleSelective(Application record, ApplicationCriteria example) {
UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
return this.updateRecords("application.ibatorgenerated_updateByExampleSelective", parms);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/**
* 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
* <p>
* http:https://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 com.qlangtech.tis.manage.biz.dal.dao.impl;

import com.qlangtech.tis.BasicActionTestCase;
import com.qlangtech.tis.manage.biz.dal.dao.IApplicationDAO;
import com.qlangtech.tis.manage.biz.dal.pojo.Application;
import com.qlangtech.tis.manage.biz.dal.pojo.ApplicationCriteria;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;

/**
* @author: 百岁([email protected]
* @create: 2024-03-26 10:10
**/
public class TestApplicationDAOImpl extends BasicActionTestCase {

public void testUpdateSelect() throws Exception {
IApplicationDAO applicationDAO = runContext.getApplicationDAO();


try (Connection conn = ((SqlMapClientDaoSupport) applicationDAO).getDataSource().getConnection()) {

// conn.createStatement().execute("CREATE TABLE application3 (\n" +
// " app_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) ,\n" +
// " \n" +
// " full_build_cron_time varchar(120) DEFAULT 'full_build_cron_time' ,\n" +
// " PRIMARY KEY (app_id)\n" +
// ")");


DatabaseMetaData metaData = conn.getMetaData();
// try (ResultSet tables = metaData.getTables(null, null, "application", null)) {
// int count = 0;
// List<String> matchEntries = Lists.newArrayList();
// while (tables.next()) {
// matchEntries.add(tables.getString("TABLE_NAME")
// + "(" + tables.getString("TABLE_TYPE")
// + "," + tables.getString("TABLE_SCHEM") + ")");
// count++;
// }
// if (count < 1) {
// throw new TableNotFoundException(this, table.getFullName() + ",url:" + conn.getUrl());
// } else if (count > 1) {
// throw new IllegalStateException("duplicate table entities exist:" + String.join(",", matchEntries));
// }
// }

// ResultSet console_db = metaData.getTables(null, null, null, null);
// while (console_db.next()) {
// System.out.println(console_db.getString(3));
// }

ResultSet colsResult = metaData.getColumns(null, null, "APPLICATION", null);

while (colsResult.next()) {
System.out.println(colsResult.getString("COLUMN_NAME")
+ ",type:" //colsResult.getString("KEY_COLUMN_SIZE")
+ colsResult.getString(6) + ",size:" + colsResult.getString(7) + "\n");
}
}

Application record = new Application();
String crontime = "{\n" +
" \"workflow_id\":6,\n" +
" \"execRange\":[\n" +
" \"dump\",\n" +
" \"dump\"\n" +
" ]\n" +
"}";
System.out.println("length:" + crontime.length());
record.setFullBuildCronTime(crontime);
ApplicationCriteria example = new ApplicationCriteria();
example.createCriteria().andAppIdNotEqualTo(2);
// int updateCount = applicationDAO.updateByExampleSelective(record, example);
// Assert.assertEquals(1, updateCount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
import com.alibaba.fastjson.serializer.ObjectSerializer;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.writer.ObjectWriter;
import com.google.common.collect.Lists;
import com.qlangtech.tis.extension.impl.IOUtils;
import com.qlangtech.tis.util.DescriptorsJSONResult;
import com.qlangtech.tis.web.start.TisAppLaunch;
import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -106,7 +109,19 @@ public void write(JSONSerializer serializer, Object object, Object fieldName, Ty
}
};

ObjectWriter descSerializer = new ObjectWriter() {
@Override
public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) {
DescriptorsJSONResult value = (DescriptorsJSONResult) object;
Objects.requireNonNull(value, "callable of " + fieldName + " can not be null");
jsonWriter.writeRaw(value.toJSONString());
}

};

com.alibaba.fastjson2.JSON.register(DescriptorsJSONResult.class, descSerializer);
SerializeConfig.global.put(UnCacheString.class, serializer);
// SerializeConfig.global.put(DescriptorsJSONResult.class, descSerializer);
}

public static <T> T[] toArray(Class<T> elementClazz, JSONArray ms) {
Expand Down Expand Up @@ -203,8 +218,12 @@ public static String toString(Object json) {
return toString(json, TisAppLaunch.isTestMock());
}

public static void assertJSONEqual(Class<?> invokeClass, String assertFileName, DescriptorsJSONResult actual, IAssert azzert) {
assertJSONEqual(invokeClass, assertFileName, actual.toJSONString(), azzert);
}

public static void assertJSONEqual(Class<?> invokeClass, String assertFileName, String actual, IAssert azzert) {

// String expectJson = com.alibaba.fastjson.JSON.toJSONString(
// JSON.parseObject(IOUtils.loadResourceFromClasspath(invokeClass, assertFileName))
// , SerializerFeature.DisableCircularReferenceDetect, SerializerFeature.PrettyFormat, SerializerFeature.MapSortField);
Expand Down
Loading

0 comments on commit 04167e2

Please sign in to comment.