Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
Retry 3 times if bulk insert failed
Browse files Browse the repository at this point in the history
  • Loading branch information
RickyHuo committed Mar 28, 2018
1 parent c7b1223 commit fea4ad7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/com/sina/bip/hangout/outputs/Clickhouse.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ private void eventInsert(Map event) throws Exception {
private void eventInsert(Map event, int eventSize) throws Exception {

this.events.add(event);

// 重试3次
if (this.events.size() >= eventSize + 3) {
this.events.clear();
log.error("Retry 3 times failed, drop this bulk, number: " + this.bulkNum);
this.bulkNum += 1;
}
if (this.events.size() >= eventSize) {

log.info("Insert bulk start, number: " + this.bulkNum);
this.formatParse.bulkInsert(events);
log.info("Insert bulk end, number: " + this.bulkNum);
Expand Down

0 comments on commit fea4ad7

Please sign in to comment.