smiklosovic commented on code in PR #2047:
URL: https://github.com/apache/cassandra/pull/2047#discussion_r1067945795
##########
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
* @param truncateIfExists truncate the existing table if it exists before
migration; if it is disabled
* and the new table is not empty, no migration is
performed
Review Comment:
btw @jacek-lewandowski this line in this method may produce null:
````
UntypedResultSet rows = QueryProcessor.executeInternal(query);
````
I suggest to either assert it is not null or if it is we log on warn level
and return from this method.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]