Skip to content

Commit 1ce3292

Browse files
RocMarshal1996fanrui
authored andcommitted
[hotfix][autoscaler] Fix that the 'deletedTotalCount' is not updated when cleaning historical event handler records in JDBC event handler
1 parent aa1022f commit 1ce3292

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

flink-autoscaler-plugin-jdbc/src/main/java/org/apache/flink/autoscaler/jdbc/event/JdbcAutoScalerEventHandler.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,13 @@ void cleanExpiredEvents() {
163163
break;
164164
}
165165

166-
for (long startId = minId;
167-
jdbcEventInteractor.deleteExpiredEventsByIdRangeAndDate(
168-
startId, startId + batchSize, date)
169-
== batchSize;
170-
startId += batchSize) {
166+
boolean cleanable = true;
167+
for (long startId = minId; cleanable; startId += batchSize) {
168+
int deleted =
169+
jdbcEventInteractor.deleteExpiredEventsByIdRangeAndDate(
170+
startId, startId + batchSize, date);
171+
cleanable = deleted == batchSize;
172+
deletedTotalCount += deleted;
171173
Thread.sleep(sleepMs);
172174
}
173175
}

0 commit comments

Comments
 (0)