Maxwell-Guo commented on code in PR #2047:
URL: https://github.com/apache/cassandra/pull/2047#discussion_r1068176613


##########
src/java/org/apache/cassandra/db/compaction/CompactionHistoryProperty.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cassandra.db.compaction;
+
+import com.google.common.collect.Maps;
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * properties that for system.compaction_history, and more properties can be 
add in the future
+ * */
+public class CompactionHistoryProperty
+{
+    // define the map key for the compaction_properties column in 
system.compaction_history
+    public static final String[] COMPACTION_PROPERTIES_KEYS = { 
"compaction_type" };
+    // define the map value for the compaction_properties column in 
system.compaction_history
+    public static final String[] DEFAULT_COMPACTION_PROPERTIES_VALUES = { 
OperationType.UNKNOWN.type };
+    
+    /**
+     * get the compaction history properties , if none value exists  a default 
value will return
+     * @param propertiesColumnValueInput input properties map
+     * @return the properties
+     * */
+    public static Map<String, String> 
getCompactionHistroyProperties(Map<String, String> propertiesColumnValueInput)

Review Comment:
   @smiklosovic 
   "Could you please change the type of compaction_properties to 
frozen<map<text, text>> ?
   
   We were suggesting in above comments to have empty map inserted with no 
defaults in case the original value was null.
   
   When that is done, when we migrate, we would insert empty map ({}) into 
compaction_properties and not map with one entry. It is very easy that way as 
we do not need any additional logic in CompactionHistoryProperty and I think 
that class can be completely removed."
   
   my question is : if deafult value is not needed ? if deafult value is need, 
then we can come to  the two points above .
   1.from 3.x to current version , the column value is null , so a complete 
default map is needed
   2.form current version to some upper version in the future like 5.x , and we 
need to add more properties(such as 3 properties) to the column which already  
have some properties (such as 2), so the 2 old properties should use their real 
value but the 3 new should use default.



-- 
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]

Reply via email to