You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2023/01/12 10:20:22 UTC

[GitHub] [cassandra] smiklosovic commented on a diff in pull request #2047: Add compaction type output result for nodetool compactionhistory for CASSANDRA-18061

smiklosovic commented on code in PR #2047:
URL: https://github.com/apache/cassandra/pull/2047#discussion_r1067943179


##########
src/java/org/apache/cassandra/db/SystemKeyspaceMigrator41.java:
##########
@@ -159,10 +162,36 @@ static void migrateSSTableActivity()
                      })
         );
     }
+    
+    @VisibleForTesting
+    static void migrateCompactionHistory()
+    {
+        migrateTable(false,
+                     SystemKeyspace.COMPACTION_HISTORY,
+                     SystemKeyspace.COMPACTION_HISTORY,
+                     new String[]{ "id",
+                                   "bytes_in",
+                                   "bytes_out",
+                                   "columnfamily_name",
+                                   "compacted_at",
+                                   "keyspace_name",
+                                   "rows_merged",
+                                   "compaction_properties" },
+                     row -> Collections.singletonList(new Object[]{ row.getTimeUUID("id") ,
+                                                                    row.has("bytes_in") ? row.getLong("bytes_in") : null,
+                                                                    row.has("bytes_out") ? row.getLong("bytes_out") : null,
+                                                                    row.has("columnfamily_name") ? row.getString("columnfamily_name") : null,
+                                                                    row.has("compacted_at") ? row.getTimestamp("compacted_at") : null,
+                                                                    row.has("keyspace_name") ? row.getString("keyspace_name") : null,
+                                                                    row.has("rows_merged") ? row.getMap("rows_merged", Int32Type.instance, LongType.instance) : null,
+                                                                    CompactionHistoryProperty.getCompactionHistroyProperties(row.getMap("compaction_properties", UTF8Type.instance, UTF8Type.instance))
+                     })
+        );
+    }
 
     /**
      * Perform table migration by reading data from the old table, converting it, and adding to the new table.
-     *
+     * if oldName and newName are same, means refresh data in table 

Review Comment:
   `If oldName and newName are same, it means refresh data in table.`



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org