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


##########
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:
   +1 on declaring an immutable map with defaults, I can change the code
   
   I think there may be two case :
   1. when upgrate from lower version that do not contains the 
compaction_properties column , then all the default value can just return.
   
   2.If some new properties was added in the compaction_properties column, such 
as for 4.2 we have compaction_type , but we may add new property for example 
compaction_time or resouce cost at 5.0 , then compaction_type is already exits 
but "compaction_time or resouce cost" may use a default value. 
   



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