blambov commented on code in PR #2786:
URL: https://github.com/apache/cassandra/pull/2786#discussion_r1365536404


##########
src/java/org/apache/cassandra/config/DatabaseDescriptor.java:
##########
@@ -1441,14 +1446,62 @@ private static void 
validateSSTableFormatFactories(Iterable<SSTableFormat.Factor
 
     private static ImmutableMap<String, Supplier<SSTableFormat<?, ?>>> 
validateAndMatchSSTableFormatOptions(Iterable<SSTableFormat.Factory> factories, 
Map<String, Map<String, String>> options)
     {
+        ImmutableMap.Builder<String, Supplier<SSTableFormat<?, ?>>> 
providersBuilderLeft = ImmutableMap.builder();
+        ImmutableMap.Builder<String, Supplier<SSTableFormat<?, ?>>> 
providersBuilderRight = ImmutableMap.builder();
         ImmutableMap.Builder<String, Supplier<SSTableFormat<?, ?>>> 
providersBuilder = ImmutableMap.builder();
         if (options == null)
             options = ImmutableMap.of();
+
+        // add default sstable format options for bti and big
         for (SSTableFormat.Factory factory : factories)
         {
-            Map<String, String> formatOptions = 
options.getOrDefault(factory.name(), ImmutableMap.of());
-            providersBuilder.put(factory.name(), () -> 
factory.getInstance(ImmutableMap.copyOf(formatOptions)));
+            providersBuilderLeft.put(factory.name(), () -> 
factory.getInstance(SSTableFormatParams.DEFAULT_FORMAT_MAP.apply(factory.name())));
         }
+
+        for (String key : options.keySet())
+        {
+            Map<String, String> formatOptions = Maps.newLinkedHashMap();
+            Map<String, String> map = options.get(key);
+            Iterator<String> iterator = map.keySet().iterator();
+            // as the map's value parsed by yaml may be numeric type, but 
sstable format factory need string
+            // but what about change the type of sstable format factory to a 
map that value is Object?
+            while (iterator.hasNext()){
+                String k = iterator.next();
+                String v = String.valueOf(map.get(k));
+                formatOptions.put(k, v);
+            }
+            // TODO add validation for yaml configuration number that must 
meet all the sstable param options ?

Review Comment:
   Currently the two formats do not implement format-specific parameters. This 
is mainly because BTI does not (at the moment) need new ones, and all the 
existing settings that apply to BIG exist in non-format-specific form. 
CASSANDRA-18533 was meant to move these settings into the format configuration. 
   
   It makes better sense to implement that ticket first, and have started to 
make comments which ask for the inclusion of 18533 in the implementation of 
this, for which I must apologise.
   
   Taking a step back, how about pausing the development of per-table config 
for a while, and doing per-format config (CASSANDRA-18533) first? While there 
are no options for any of the formats, much of the machinery we are 
implementing here is useless and that makes it hard to understand and code.



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