10 Commits

Author SHA1 Message Date
v-zhangjc9
2c09d97cec feat(all): 增加项目说明 2024-12-19 19:04:22 +08:00
v-zhangjc9
37ac0cd311 feat(all): 增加项目说明 2024-12-12 15:29:30 +08:00
v-zhangjc9
9fa38a3065 feat(all): 增加项目说明 2024-12-06 17:44:53 +08:00
v-zhangjc9
d908f99fbd feat(all): 增加项目说明 2024-11-28 18:14:12 +08:00
v-zhangjc9
5b0b23336c feat(all): 增加项目说明 2024-11-21 19:22:13 +08:00
v-zhangjc9
263b91c42a feat(all): 增加项目说明 2024-11-15 14:16:58 +08:00
v-zhangjc9
a53c90a348 feat(all): 增加项目说明 2024-11-15 10:06:48 +08:00
v-zhangjc9
e3583dad0c feat(all): 增加项目说明 2024-11-07 18:20:26 +08:00
v-zhangjc9
514a65a5e6 feat(all): 增加项目说明 2024-10-31 17:52:01 +08:00
v-zhangjc9
57a57ace77 feat(sync): 增加日志输出 2024-10-22 17:08:49 +08:00
5 changed files with 37 additions and 10 deletions

View File

@@ -8,7 +8,7 @@
<artifactId>hudi-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<description>Hudi服务应用集合项目详细代码目录</description>
<description>Hudi服务模块应用集合</description>
<modules>
<module>service-common</module>
<module>service-dependencies</module>

View File

@@ -11,6 +11,7 @@ import com.lanyuanxiaoyao.service.common.utils.RecordHelper;
import com.lanyuanxiaoyao.service.common.utils.TableMetaHelper;
import com.lanyuanxiaoyao.service.sync.configuration.GlobalConfiguration;
import com.lanyuanxiaoyao.service.sync.functions.type.TypeConverter;
import com.lanyuanxiaoyao.service.sync.utils.ExceptionUtils;
import com.lanyuanxiaoyao.service.sync.utils.JacksonUtils;
import com.lanyuanxiaoyao.service.sync.utils.MetricsUtils;
import com.lanyuanxiaoyao.service.sync.utils.StatusUtils;
@@ -94,7 +95,7 @@ public class Record2RowDataFunction extends RichMapFunction<Record, List<RowData
Map<String, Object> current = RecordHelper.getCurrentStatement(record);
if (Objects.isNull(current)) {
logger.error("Record: {}", mapper.writeValueAsString(record));
throw new RuntimeException("Current cannot be null");
return ExceptionUtils.throwAndPrint(logger, "Current cannot be null");
}
// 如果 update 改变了过滤字段的值也需要先删除

View File

@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import com.lanyuanxiaoyao.service.common.Constants;
import com.lanyuanxiaoyao.service.common.entity.TableMeta;
import com.lanyuanxiaoyao.service.common.utils.LogHelper;
import com.lanyuanxiaoyao.service.sync.utils.ExceptionUtils;
import java.math.BigDecimal;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
@@ -115,7 +116,8 @@ public class TypeConverterV2 implements TypeConverter {
return NULLABLE_STRING_SCHEMA;
}
} catch (Throwable throwable) {
throw new RuntimeException(
return ExceptionUtils.throwAndPrint(
logger,
StrUtil.format("Convert type failure {} {} {} length: {} scala: {}", table, field, type, length, scala),
throwable
);
@@ -162,7 +164,8 @@ public class TypeConverterV2 implements TypeConverter {
return value;
}
} catch (Throwable throwable) {
throw new RuntimeException(
return ExceptionUtils.throwAndPrint(
logger,
StrUtil.format("Convert value failure {} {} {}", schema.toString(), name, value),
throwable
);

View File

@@ -0,0 +1,26 @@
package com.lanyuanxiaoyao.service.sync.utils;
import org.slf4j.Logger;
/**
* 处理异常抛出和打印
*
* @author lanyuanxiaoyao
* @date 2024-10-22
*/
public class ExceptionUtils {
public static <T> T throwAndPrint(Logger logger, String content) {
logger.error(content);
throw new RuntimeException(content);
}
public static <T> T throwAndPrint(Logger logger, Throwable throwable) {
logger.error(throwable.getMessage(), throwable);
throw new RuntimeException(throwable);
}
public static <T> T throwAndPrint(Logger logger, String content, Throwable throwable) {
logger.error(content, throwable);
throw new RuntimeException(content, throwable);
}
}

View File

@@ -75,11 +75,9 @@ public class ZkUtils {
.withMode(CreateMode.EPHEMERAL)
.forPath(lockPath, runMeta.getBytes());
} catch (KeeperException.NodeExistsException e) {
logger.error("Lock exists for " + lockPath, e);
throw new RuntimeException(e);
ExceptionUtils.throwAndPrint(logger, "Lock exists for " + lockPath, e);
} catch (Exception e) {
logger.error("Unknown error", e);
throw new RuntimeException(e);
ExceptionUtils.throwAndPrint(logger, "Unknown error", e);
}
}
@@ -91,8 +89,7 @@ public class ZkUtils {
}
}
} catch (Exception e) {
logger.error("Unknown error", e);
throw new RuntimeException(e);
ExceptionUtils.throwAndPrint(logger, "Unknown error", e);
}
}
}