Skip to content

Commit

Permalink
0006447: Stack overflow when inserting last gap
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed May 23, 2024
1 parent eaa515f commit c6e5cfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2969,22 +2969,22 @@ public void insertDataGap(DataGap gap) {
public void insertDataGap(ISqlTransaction transaction, DataGap gap) {
log.debug("Inserting data gap: {}", gap);
transaction.prepareAndExecute(getSql("insertDataGapSql"),
new Object[] { engine.getClusterService().getServerId(), gap.getStartId(), gap.getEndId(),
new Object[] { engine.getClusterService().getServerId(), gap.getStartId(), gap.getEndId(), 0,
gap.getCreateTime() }, new int[] {
Types.VARCHAR, Types.NUMERIC, Types.NUMERIC, Types.TIMESTAMP });
Types.VARCHAR, Types.NUMERIC, Types.NUMERIC, Types.NUMERIC, Types.TIMESTAMP });
}

@Override
public void insertDataGaps(ISqlTransaction transaction, Collection<DataGap> gaps) {
if (gaps.size() > 0) {
int[] types = new int[] { Types.VARCHAR, Types.NUMERIC, Types.NUMERIC, Types.TIMESTAMP };
int[] types = new int[] { Types.VARCHAR, Types.NUMERIC, Types.NUMERIC, Types.NUMERIC, Types.TIMESTAMP };
int maxRowsToFlush = engine.getParameterService().getInt(ParameterConstants.ROUTING_FLUSH_JDBC_BATCH_SIZE);
long ts = System.currentTimeMillis();
int flushCount = 0, totalCount = 0;
transaction.setInBatchMode(true);
transaction.prepare(getSql("insertDataGapSql"));
for (DataGap gap : gaps) {
transaction.addRow(gap, new Object[] { engine.getClusterService().getServerId(), gap.getStartId(), gap.getEndId(),
transaction.addRow(gap, new Object[] { engine.getClusterService().getServerId(), gap.getStartId(), gap.getEndId(), 0,
gap.getCreateTime() }, types);
totalCount++;
if (++flushCount >= maxRowsToFlush) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public DataServiceSqlMap(IDatabasePlatform platform, Map<String, String> replace
putSql("findDataGapsSql",
"select start_id, end_id, create_time from $(data_gap) where is_expired = ? order by start_id asc");
putSql("insertDataGapSql",
"insert into $(data_gap) (last_update_hostname, start_id, end_id, create_time) values(?, ?, ?, ?)");
"insert into $(data_gap) (last_update_hostname, start_id, end_id, is_expired, create_time) values(?, ?, ?, ?, ?)");
putSql("deleteDataGapSql",
"delete from $(data_gap) where start_id=? and end_id=? ");
putSql("deleteAllDataGapsSql", "delete from $(data_gap) where is_expired = 0");
Expand Down

0 comments on commit c6e5cfa

Please sign in to comment.