Skip to content

Commit

Permalink
MariaRocks port: temporarily? disable Per-table Extra Stats
Browse files Browse the repository at this point in the history
(why are table reads/writes/updates collected in ha_statistics?
this structure was intended for table statistics that the engine
reports.. and now it is also used for engine-agnostic statistics
like rows_read, rows_requested, etc?)
  • Loading branch information
spetrunia committed Oct 15, 2016
1 parent 746f35d commit 01a5216
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 6 deletions.
34 changes: 30 additions & 4 deletions storage/rocksdb/ha_rocksdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ namespace myrocks {
static st_global_stats global_stats;
static st_export_stats export_stats;

#ifdef MARIAROCKS_NOT_YET
/**
Updates row counters based on the table type and operation type.
*/
Expand All @@ -108,6 +109,7 @@ void ha_rocksdb::update_row_stats(operation_type type) {
else
global_stats.rows[type].inc();
}
#endif

void dbug_dump_database(rocksdb::DB *db);
static handler *rocksdb_create_handler(my_core::handlerton *hton,
Expand Down Expand Up @@ -6111,9 +6113,9 @@ int ha_rocksdb::secondary_index_read(const int keyno, uchar *buf)
{
DBUG_ASSERT(buf != nullptr);
DBUG_ASSERT(table != nullptr);

#ifdef MARIAROCKS_NOT_YET
stats.rows_requested++;

#endif
/* Use STATUS_NOT_FOUND when record not found or some error occurred */
table->status= STATUS_NOT_FOUND;

Expand Down Expand Up @@ -6150,9 +6152,11 @@ int ha_rocksdb::secondary_index_read(const int keyno, uchar *buf)
if (!rc)
{
table->status= 0;
#ifdef MARIAROCKS_NOT_YET
stats.rows_read++;
stats.rows_index_next++;
update_row_stats(ROWS_READ);
#endif
}
return rc;
}
Expand Down Expand Up @@ -6256,8 +6260,9 @@ int ha_rocksdb::index_read_map_impl(uchar *buf, const uchar *key,

/* By default, we don't need the retrieved records to match the prefix */
m_sk_match_prefix= nullptr;
#ifdef MARIAROCKS_NOT_YET
stats.rows_requested++;

#endif
if (active_index == table->s->primary_key &&
find_flag == HA_READ_KEY_EXACT && using_full_key)
{
Expand All @@ -6270,9 +6275,11 @@ int ha_rocksdb::index_read_map_impl(uchar *buf, const uchar *key,
rc= get_row_by_rowid(buf, m_pk_packed_tuple, size);
if (!rc)
{
#ifdef MARIAROCKS_NOT_YET
stats.rows_read++;
stats.rows_index_first++;
update_row_stats(ROWS_READ);
#endif
}
DBUG_RETURN(rc);
}
Expand Down Expand Up @@ -6397,9 +6404,11 @@ int ha_rocksdb::index_read_map_impl(uchar *buf, const uchar *key,
else
{
table->status= 0;
#ifdef MARIAROCKS_NOT_YET
stats.rows_read++;
stats.rows_index_first++;
update_row_stats(ROWS_READ);
#endif
}
DBUG_RETURN(rc);
}
Expand Down Expand Up @@ -6962,8 +6971,10 @@ int ha_rocksdb::index_first_intern(uchar *buf)
index_next is always incremented on success, so decrement if it is
index_first instead
*/
#ifdef MARIAROCKS_NOT_YET
stats.rows_index_first++;
stats.rows_index_next--;
#endif
}
DBUG_RETURN(rc);
}
Expand Down Expand Up @@ -7094,8 +7105,10 @@ int ha_rocksdb::index_last_intern(uchar *buf)
index_next is always incremented on success, so decrement if it is
index_first instead
*/
#ifdef MARIAROCKS_NOT_YET
stats.rows_index_first++;
stats.rows_index_next--;
#endif
}
DBUG_RETURN(rc);
}
Expand Down Expand Up @@ -7266,8 +7279,10 @@ int ha_rocksdb::write_row(uchar *buf)

if (rv == 0)
{
#ifdef MARIAROCKS_NOT_YET
stats.rows_inserted++;
update_row_stats(ROWS_INSERTED);
#endif
}
DBUG_RETURN(rv);
}
Expand Down Expand Up @@ -8047,8 +8062,9 @@ int ha_rocksdb::rnd_next_with_direction(uchar *buf, bool move_forward)
DBUG_ENTER("ha_rocksdb::rnd_next");

table->status= STATUS_NOT_FOUND;
#ifdef MARIAROCKS_NOT_YET
stats.rows_requested++;

#endif
if (!m_scan_it || !m_scan_it->Valid())
{
/*
Expand Down Expand Up @@ -8123,9 +8139,11 @@ int ha_rocksdb::rnd_next_with_direction(uchar *buf, bool move_forward)
rc= HA_ERR_END_OF_FILE;

if (!rc) {
#ifdef MARIAROCKS_NOT_YET
stats.rows_read++;
stats.rows_index_next++;
update_row_stats(ROWS_READ);
#endif
}

DBUG_RETURN(rc);
Expand Down Expand Up @@ -8239,8 +8257,10 @@ int ha_rocksdb::delete_row(const uchar *buf)
{
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
}
#ifdef MARIAROCKS_NOT_YET
stats.rows_deleted++;
update_row_stats(ROWS_DELETED);
#endif

DBUG_RETURN(0);
}
Expand Down Expand Up @@ -8429,7 +8449,9 @@ int ha_rocksdb::rnd_pos(uchar *buf, uchar *pos)
size_t len;
DBUG_ENTER("ha_rocksdb::rnd_pos");

#ifdef MARIAROCKS_NOT_YET
stats.rows_requested++;
#endif
len= m_pk_descr->key_length(table, rocksdb::Slice((const char*)pos,
ref_length));
if (len == size_t(-1))
Expand All @@ -8441,8 +8463,10 @@ int ha_rocksdb::rnd_pos(uchar *buf, uchar *pos)

if (!rc)
{
#ifdef MARIAROCKS_NOT_YET
stats.rows_read++;
update_row_stats(ROWS_READ);
#endif
}

DBUG_RETURN(rc);
Expand Down Expand Up @@ -8504,8 +8528,10 @@ int ha_rocksdb::update_row(const uchar *old_data, uchar *new_data)

if (rv == 0)
{
#ifdef MARIAROCKS_NOT_YET
stats.rows_updated++;
update_row_stats(ROWS_UPDATED);
#endif
}
DBUG_RETURN(rv);
}
Expand Down
4 changes: 2 additions & 2 deletions storage/rocksdb/ha_rocksdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ class ha_rocksdb: public my_core::handler
__attribute__((__nonnull__, __warn_unused_result__));
bool has_hidden_pk(const TABLE* table)
__attribute__((__nonnull__, __warn_unused_result__));

#ifdef MARIAROCKS_NOT_YET
void update_row_stats(operation_type type);

#endif
void set_last_rowkey(const uchar *old_data);

/*
Expand Down
3 changes: 3 additions & 0 deletions storage/rocksdb/rdb_mariadb_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#ifndef RDB_MARIADB_PORT_H
#define RDB_MARIADB_PORT_H

#include "my_global.h" /* ulonglong */
#include "atomic_stat.h"

/* Struct used for IO performance counters, shared among multiple threads */
Expand All @@ -29,5 +30,7 @@ typedef struct my_io_perf_atomic_struct my_io_perf_atomic_t;
*/
#define abort_with_stack_traces() { abort(); }

////////////////////////////////////////////////////////////////////////////
typedef struct my_io_perf_struct my_io_perf_t;

#endif
5 changes: 5 additions & 0 deletions storage/rocksdb/rdb_perf_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include <my_config.h>

#include "rdb_mariadb_port.h"
/* This C++ file's header file */
#include "./rdb_perf_context.h"

Expand Down Expand Up @@ -222,9 +223,12 @@ void Rdb_io_perf::end_and_record(uint32_t perf_context_level)
rocksdb::perf_context.block_read_time;

my_io_perf_sum_atomic_helper(m_shared_io_perf_read, &io_perf_read);
#ifdef MARIAROCKS_NOT_YET
my_io_perf_sum(&m_stats->table_io_perf_read, &io_perf_read);
#endif
}

#ifdef MARIAROCKS_NOT_YET
if (m_stats) {
if (rocksdb::perf_context.internal_key_skipped_count != 0)
{
Expand All @@ -237,6 +241,7 @@ void Rdb_io_perf::end_and_record(uint32_t perf_context_level)
rocksdb::perf_context.internal_delete_skipped_count;
}
}
#endif
}

} // namespace myrocks

0 comments on commit 01a5216

Please sign in to comment.