You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "pengxiangyu (via GitHub)" <gi...@apache.org> on 2023/02/13 03:30:13 UTC
[GitHub] [doris] pengxiangyu commented on a diff in pull request #16588: [feature](cooldown) Auto delete unused remote files
pengxiangyu commented on code in PR #16588:
URL: https://github.com/apache/doris/pull/16588#discussion_r1103960637
##########
fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java:
##########
@@ -174,6 +179,60 @@ public FrontendServiceImpl(ExecuteEnv exeEnv) {
this.exeEnv = exeEnv;
}
+ @Override
+ public TStatus confirmUnusedRemoteFiles(TConfirmUnusedRemoteFilesRequest request) throws TException {
+ TStatus res = new TStatus(TStatusCode.OK);
+ if (!request.isSetCooldownMetaId()) {
+ res.setStatusCode(TStatusCode.INVALID_ARGUMENT);
+ res.addToErrorMsgs("cooldown_meta_id is null");
+ return res;
+ }
+ TabletMeta tabletMeta = Env.getCurrentEnv().getTabletInvertedIndex().getTabletMeta(request.tablet_id);
+ if (tabletMeta == null) {
+ res.setStatusCode(TStatusCode.NOT_FOUND);
+ res.addToErrorMsgs("tablet not found");
+ return res;
+ }
+ Tablet tablet;
+ try {
+ OlapTable table = (OlapTable) Env.getCurrentInternalCatalog().getDbNullable(tabletMeta.getDbId())
+ .getTable(tabletMeta.getTableId())
+ .get();
+ table.readLock();
+ try {
+ tablet = table.getPartition(tabletMeta.getPartitionId()).getIndex(tabletMeta.getIndexId())
+ .getTablet(request.tablet_id);
+ } finally {
+ table.readUnlock();
+ }
+ } catch (RuntimeException e) {
+ res.setStatusCode(TStatusCode.NOT_FOUND);
+ res.addToErrorMsgs("tablet not found");
+ return res;
+ }
+ // check cooldownReplicaId
+ long cooldownReplicaId = tablet.getCooldownConf().first;
+ if (cooldownReplicaId != request.cooldown_replica_id) {
+ res.setStatusCode(TStatusCode.ABORTED);
+ res.addToErrorMsgs(
+ "cooldown replica id not match(" + cooldownReplicaId + " vs " + request.cooldown_replica_id + ')');
+ return res;
+ }
+ // check cooldownMetaId of all replicas are the same
+ List<Replica> replicas = Env.getCurrentEnv().getTabletInvertedIndex().getReplicas(request.tablet_id);
+ for (Replica replica : replicas) {
Review Comment:
cooldown_replica_id need to be equal, so that if meta_id doesn't match, max rowset version checked is also useful.
##########
fe/fe-core/src/main/java/org/apache/doris/service/FrontendServiceImpl.java:
##########
@@ -174,6 +179,60 @@ public FrontendServiceImpl(ExecuteEnv exeEnv) {
this.exeEnv = exeEnv;
}
+ @Override
+ public TStatus confirmUnusedRemoteFiles(TConfirmUnusedRemoteFilesRequest request) throws TException {
Review Comment:
BE IP is not checked, it is unsafe.
--
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