You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/11/24 11:52:54 UTC
[GitHub] [doris] nextdreamblue commented on a diff in pull request #14551: [fix](recycle) refactor the logic of erase meta with same name
nextdreamblue commented on code in PR #14551:
URL: https://github.com/apache/doris/pull/14551#discussion_r1031421300
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -400,12 +409,27 @@ private synchronized void erasePartition(long currentTimeMs) {
// erase partition
iterator.remove();
idToRecycleTime.remove(partitionId);
-
// log
Env.getCurrentEnv().getEditLog().logErasePartition(partitionId);
- LOG.info("erase partition[{}]", partitionId);
+ LOG.info("erase partition[{}]. reason: expired", partitionId);
}
} // end for partitions
+
+ // 2. erase exceed number
Review Comment:
add if (keepNum > 0)
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -224,6 +212,12 @@ private synchronized void eraseDatabase(long currentTimeMs) {
LOG.info("erase db[{}]", db.getId());
}
}
+ // 2. erase exceed number
Review Comment:
only if keepNum > 0, can erase trash, otherwise may out of range
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -224,6 +212,12 @@ private synchronized void eraseDatabase(long currentTimeMs) {
LOG.info("erase db[{}]", db.getId());
}
}
+ // 2. erase exceed number
Review Comment:
add if (keepNum > 0)
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -246,30 +240,28 @@ private synchronized List<Long> getSameNameDbIdListToErase(String dbName, int ma
return dbIdToErase;
}
// order by recycle time desc
- dbRecycleTimeLists.sort((x, y) -> {
- return (x.get(1).longValue() < y.get(1).longValue()) ? 1 : ((x.get(1).equals(y.get(1))) ? 0 : -1);
- });
+ dbRecycleTimeLists.sort((x, y) ->
+ (x.get(1).longValue() < y.get(1).longValue()) ? 1 : ((x.get(1).equals(y.get(1))) ? 0 : -1));
for (int i = maxSameNameTrashNum - 1; i < dbRecycleTimeLists.size(); i++) {
dbIdToErase.add(dbRecycleTimeLists.get(i).get(0));
Review Comment:
if keepNum <= 0, here will out of range
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/CatalogRecycleBin.java:
##########
@@ -323,6 +316,22 @@ private synchronized void eraseTable(long currentTimeMs) {
LOG.info("erase table[{}]", tableId);
}
} // end for tables
+
+ // 2. erase exceed num
Review Comment:
add if (keepNum > 0)
--
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: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org