dengzhhu653 commented on code in PR #5688:
URL: https://github.com/apache/hive/pull/5688#discussion_r1995063806
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java:
##########
@@ -11546,66 +11546,64 @@ private void cleanOlderEvents(int olderThan, Class
table, String tableName) {
} while (batchCount > 0);
}
- final long finish = System.nanoTime();
+ final long finish = System.currentTimeMillis();
LOG.info("Deleted {} {} events older than epoch:{} in {}ms", deleteCount,
tableName, tooOld,
- TimeUnit.NANOSECONDS.toMillis(finish - start));
+ finish - start);
}
private <T> int doCleanNotificationEvents(final int ageSec, final
Optional<Integer> batchSize, Class<T> tableClass, String tableName) {
+ String key;
+ if (MNotificationLog.class.equals(tableClass)) {
+ key = "eventId";
+ } else if (MTxnWriteNotificationLog.class.equals(tableClass)) {
+ key = "txnId";
+ } else {
+ throw new RuntimeException("Cleaning of older " + tableName + " events
failed. " +
+ "Reason: Unknown table encountered " + tableClass.getName());
+ }
final Transaction tx = pm.currentTransaction();
int eventsCount = 0;
try {
- String key = null;
tx.begin();
- try (Query query = pm.newQuery(tableClass, "eventTime <= tooOld")) {
+ try (Query query = pm.newQuery(String.format(
+ "select %s, eventTime from %s where eventTime <= tooOld order by %s",
Review Comment:
yeah, it might not as complex as you think, the directSql has already
supported the delete here, without the new `DATANUCLEUS_QUERY_JDOQL_ALLOWALL`
solely for this change,
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]