Skip to content

Commit 6b1a0c4

Browse files
committed
[fix-34834][HBase] fix HBase dirty data not print with batchSize.
1 parent d13b07a commit 6b1a0c4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

hbase/hbase-sink/src/main/java/com/dtstack/flink/sql/sink/hbase/HbaseOutputFormat.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,19 @@ protected synchronized void dealBatchOperation(List<Row> records) {
224224
}
225225
table.batch(puts, results);
226226

227+
// 打印结果
228+
if (outRecords.getCount() % ROW_PRINT_FREQUENCY == 0) {
229+
// 只打印最后一条数据
230+
LOG.info(records.get(records.size() - 1).toString());
231+
}
232+
} catch (IOException | InterruptedException ignored) {
233+
} finally {
227234
// 判断数据是否插入成功
228235
for (int i = 0; i < results.length; i++) {
229-
if (results[i] == null) {
230-
if (outDirtyRecords.getCount() % DIRTY_PRINT_FREQUENCY == 0 || LOG.isDebugEnabled()) {
231-
LOG.error("record insert failed ..{}", records.get(i).toString());
236+
if (results[i] != null) {
237+
if (outDirtyRecords.getCount() % DIRTY_PRINT_FREQUENCY == 0) {
238+
LOG.error("Get dirty data: {}", records.get(i).toString());
239+
LOG.error("Error cause: " + results[i]);
232240
}
233241
// 脏数据记录
234242
outDirtyRecords.inc();
@@ -237,14 +245,6 @@ protected synchronized void dealBatchOperation(List<Row> records) {
237245
outRecords.inc();
238246
}
239247
}
240-
// 打印结果
241-
if (outRecords.getCount() % ROW_PRINT_FREQUENCY == 0) {
242-
// 只打印最后一条数据
243-
LOG.info(records.get(records.size() - 1).toString());
244-
}
245-
} catch (IOException | InterruptedException e) {
246-
LOG.error("", e);
247-
} finally {
248248
// 添加完数据之后数据清空records
249249
records.clear();
250250
}

0 commit comments

Comments
 (0)