You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "kezhenxu94 (via GitHub)" <gi...@apache.org> on 2023/03/28 02:24:35 UTC

[GitHub] [skywalking] kezhenxu94 commented on a diff in pull request #10600: Fix T+1 table is delete when deleting history tables, in jdbc storage

kezhenxu94 commented on code in PR #10600:
URL: https://github.com/apache/skywalking/pull/10600#discussion_r1149957559


##########
oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/TableHelper.java:
##########
@@ -124,22 +133,19 @@ public List<String> getTablesForRead(String modelName, long timeBucketStart, lon
      */
     public List<String> getTablesInTimeBucketRange(String modelName, long timeBucketStart, long timeBucketEnd) {
         final var model = TableMetaInfo.get(modelName);
-        final var tableName = getTableName(model);
+        final var rawTableName = getTableName(model);
 
         if (!model.isTimeSeries()) {
-            return Collections.singletonList(tableName);
+            return Collections.singletonList(rawTableName);
         }
 
         timeBucketStart = TimeBucket.getTimeBucket(TimeBucket.getTimestamp(timeBucketStart), DownSampling.Day);
         timeBucketEnd = TimeBucket.getTimeBucket(TimeBucket.getTimestamp(timeBucketEnd), DownSampling.Day);
 
-        final var ttlTimeBucketRange = getTTLTimeBucketRange(model);
-
         return LongStream
             .rangeClosed(timeBucketStart, timeBucketEnd)
             .distinct()
-            .filter(ttlTimeBucketRange::contains)
-            .mapToObj(it -> tableName + "_" + it)
+            .mapToObj(timeBucket -> getTable(rawTableName, timeBucket))
             .collect(toList());

Review Comment:
   `HistoryDeleteDAO` uses this method to filter tables that should not be deleted, it turns out this method still filter out the `T + 1` table because of `.filter(ttlTimeBucketRange::contains)`, 



-- 
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: notifications-unsubscribe@skywalking.apache.org

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