bin/explain in shiba-0.4.0 vs bin/explain in shiba-0.5.0
- old
+ new
@@ -23,12 +23,14 @@
end
file = options.delete("file")
file = File.open(file, "r") if file
-Shiba.configure(options) do |err_msg|
- $stderr.puts(err_msg)
+begin
+ Shiba.configure(options)
+rescue Shiba::ConfigError => e
+ $stderr.puts(e.message)
$stderr.puts(parser)
exit 2
end
schema_stats_fname = options["stats"]
@@ -48,10 +50,10 @@
end
table_stats = Shiba::TableStats.new(Shiba.index_config, Shiba.connection, {})
queries = Shiba::Analyzer.analyze(file, json, table_stats, options)
-problems = queries.select { |q| q[:cost] && q[:cost] > 100 }
+problems = queries.select { |q| q[:severity] && q[:severity] != 'none' }
if problems.any?
query_word = problems.size == 1 ? 'query' : 'queries'
$stderr.puts "#{problems.size} problematic #{query_word} detected"