Maxwell-Guo commented on code in PR #2786:
URL: https://github.com/apache/cassandra/pull/2786#discussion_r1361588714
##########
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:
modify the code so we can get sstableFormats which is a map , where key is
custom-type name , and value is the specific type instance(bti or big), as for
the type instance , it is composed of type name and type options.
I changed the type name for each type instance from the fixed value (big or
bti) to the custom-type name, and the option is the sstable options.
--
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]