This commit is contained in:
Avi Kivity
2015-07-30 13:39:55 +03:00
5 changed files with 42 additions and 29 deletions

View File

@@ -1069,19 +1069,14 @@ future<> save_system_keyspace_schema() {
m.set_clustered_cell(ckey, "memtable_flush_period_in_ms", table->memtable_flush_period(), timestamp);
m.set_clustered_cell(ckey, "read_repair_chance", table->read_repair_chance(), timestamp);
m.set_clustered_cell(ckey, "speculative_retry", table->speculative_retry().to_sstring(), timestamp);
#if 0
for (Map.Entry<ColumnIdentifier, Long> entry : table.getDroppedColumns().entrySet())
adder.addMapEntry("dropped_columns", entry.getKey().toString(), entry.getValue());
#endif
m.set_clustered_cell(ckey, "is_dense", table->is_dense(), timestamp);
auto dc = *(s->get_column_definition("dropped_columns"));
std::vector<std::pair<bytes, atomic_cell>> cells;
for (auto& p: table->dropped_columns()) {
cells.push_back({utf8_type->decompose(p.first), atomic_cell::make_live(timestamp, long_type->decompose(p.second))});
}
map_type_impl::mutation dc_mut{{}, std::move(cells) };
auto col = static_pointer_cast<const collection_type_impl>(dc.type);
m.set_clustered_cell(ckey, dc, col->serialize_mutation_form(dc_mut));
if (with_columns_and_triggers) {
for (auto&& column : table->all_columns_in_select_order()) {
add_column_to_schema_mutation(table, column, timestamp, pkey, mutations);
@@ -1362,10 +1357,10 @@ future<> save_system_keyspace_schema() {
builder.set_bloom_filter_fp_chance(builder.get_bloom_filter_fp_chance());
}
if (table_row.has("dropped_columns")) {
builder.set_dropped_columns(table_row.get_nonnull<std::map<sstring, int64_t>>("dropped_columns"));
}
#if 0
if (result.has("dropped_columns"))
cfm.droppedColumns(convertDroppedColumns(result.getMap("dropped_columns", UTF8Type.instance, LongType.instance)));
#endif
for (auto&& cdef : column_defs) {
builder.with_column(cdef);
}

9
log.cc
View File

@@ -85,7 +85,14 @@ logger::really_do_log(log_level level, const char* fmt, stringer** s, size_t n)
out << "\n";
auto msg = out.str();
if (_stdout.load(std::memory_order_relaxed)) {
std::cout << msg;
static array_map<sstring, 20> level_map = {
{ int(log_level::debug), "DEBUG" },
{ int(log_level::info), "INFO" },
{ int(log_level::trace), "TRACE" },
{ int(log_level::warn), "WARN" },
{ int(log_level::error), "ERROR" },
};
std::cout << level_map[int(level)] << " " << msg;
}
if (_syslog.load(std::memory_order_relaxed)) {
static array_map<int, 20> level_map = {

View File

@@ -255,7 +255,6 @@ private:
// we will use by default - when we have the choice.
sstables::compaction_strategy_type _compaction_strategy = sstables::compaction_strategy_type::size_tiered;
std::map<sstring, sstring> _compaction_strategy_options;
std::map<sstring, int64_t> _dropped_columns = {};
};
raw_schema _raw;
thrift_schema _thrift;
@@ -383,10 +382,6 @@ public:
return _raw._compaction_strategy_options;
}
const std::map<sstring, int64_t>& dropped_columns() const {
return _raw._dropped_columns;
}
const ::speculative_retry& speculative_retry() const {
return _raw._speculative_retry;
}

View File

@@ -124,14 +124,6 @@ public:
return _raw._speculative_retry;
}
void set_dropped_columns(std::map<sstring, int64_t> c) {
_raw._dropped_columns = std::move(c);
}
const std::map<sstring, int64_t>& get_dropped_columns() {
return _raw._dropped_columns;
}
void set_bloom_filter_fp_chance(double fp) {
_raw._bloom_filter_fp_chance = fp;
}

View File

@@ -97,7 +97,31 @@ class scylla_column_families(gdb.Command):
name = str(schema['_raw']['_ks_name']) + '/' + str(schema['_raw']['_cf_name'])
gdb.write('{:5} {} {:45} (column_family*){}\n'.format(shard, key, name, value.address))
class scylla_memory(gdb.Command):
def __init__(self):
gdb.Command.__init__(self, 'scylla memory', gdb.COMMAND_USER, gdb.COMPLETE_COMMAND)
def invoke(self, arg, from_tty):
cpu_mem = gdb.parse_and_eval('memory::cpu_mem')
small_pools = cpu_mem['small_pools']
nr = small_pools['nr_small_pools']
page_size = int(gdb.parse_and_eval('memory::page_size'))
gdb.write('{objsize:>5} {span_size:>6} {use_count:>10} {memory:>12} {wasted_percent:>5}\n'
.format(objsize='objsz', span_size='spansz', use_count='usedobj', memory='memory', wasted_percent='wst%'))
for i in range(int(nr)):
sp = small_pools['_u']['a'][i]
object_size = int(sp['_object_size'])
span_size = int(sp['_span_size']) * page_size
free_count = int(sp['_free_count'])
spans_in_use = int(sp['_spans_in_use'])
memory = spans_in_use * span_size
use_count = spans_in_use * int(span_size / object_size) - free_count
wasted = free_count * object_size
wasted_percent = wasted * 100.0 / memory if memory else 0
gdb.write('{objsize:5} {span_size:6} {use_count:10} {memory:12} {wasted_percent:5.1f}\n'
.format(objsize=object_size, span_size=span_size, use_count=use_count, memory=memory, wasted_percent=wasted_percent))
scylla()
scylla_databases()
scylla_keyspaces()
scylla_column_families()
scylla_memory()