yujun777 commented on code in PR #43107:
URL: https://github.com/apache/doris/pull/43107#discussion_r1836689021


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -3741,76 +3744,51 @@ public void truncateTable(TruncateTableStmt 
truncateTableStmt) throws DdlExcepti
     }
 
     private List<Partition> truncateTableInternal(OlapTable olapTable, 
List<Partition> newPartitions,
-            boolean isEntireTable) {
+            boolean isEntireTable, Map<Long, RecyclePartitionParam> 
recyclePartitionParamMap, boolean isforceDrop) {
         // use new partitions to replace the old ones.
         List<Partition> oldPartitions = Lists.newArrayList();
-        Set<Long> oldTabletIds = Sets.newHashSet();
         for (Partition newPartition : newPartitions) {
-            Partition oldPartition = olapTable.replacePartition(newPartition);
+            RecyclePartitionParam recyclePartitionParam = new 
RecyclePartitionParam();
+            Partition oldPartition = olapTable.replacePartition(newPartition, 
recyclePartitionParam);
             oldPartitions.add(oldPartition);
-            // save old tablets to be removed
-            for (MaterializedIndex index : 
oldPartition.getMaterializedIndices(IndexExtState.ALL)) {
-                index.getTablets().forEach(t -> {
-                    oldTabletIds.add(t.getId());
-                });
-            }
+            recyclePartitionParamMap.put(oldPartition.getId(), 
recyclePartitionParam);
         }
 
         if (isEntireTable) {
             Set<Long> oldPartitionsIds = 
oldPartitions.stream().map(Partition::getId).collect(Collectors.toSet());
             for (Partition partition : olapTable.getAllTempPartitions()) {
                 if (!oldPartitionsIds.contains(partition.getId())) {
+                    RecyclePartitionParam recyclePartitionParam = new 
RecyclePartitionParam();

Review Comment:
   for temp partition,  maybe delete them immedidately,  no more put into 
recycle bin ?
   
   This is to keep the same behaviour with drop a table:  in function 
InternalCatalog.unprotectDropTable,  it will drop all temp partitions firstly, 
then put the left normal partitions into recycle bin. 
   
   Yet  I don't know why doing this.  but it's safe to do the same things.



-- 
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-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to