Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

[15721] Peloton Self-Driving Infrastructure #1346

Open
wants to merge 132 commits into
base: master
Choose a base branch
from

Conversation

ChTimTsubasa
Copy link
Member

@ChTimTsubasa ChTimTsubasa commented May 5, 2018

This PR is working toward an infrastructure for self-driving components on Peloton.

In this checkpoint, we presented:

  1. A brand new framework for stats collections.
    2, Based on the new framework we collected
    1. query metrics measuring latency for queries.
    2. table metrics measuring operations count on a specific table, memory usage and memory allocation for both inline data and varlen data
    3. index metrics measuring operations count on a specific index, estimated memory usage and memory allocation stats.

To do:
Update metrics on catalog

Tianyi Chen and others added 30 commits April 9, 2018 21:01
implement memory metric header 2

memory metric hook up
AbstractMetric just exists for GetInfo()/Reset().

PointMetric is an abstraction for counter-like metrics
which get incremented/decremented at a specific point of execution.

IntervalMetric is an abstraction for timer-based metrics
whose measurements occur over some duration of execution.
AbstractMetric just exists for GetInfo()/Reset().

PointMetric is an abstraction for counter-like metrics
which get incremented/decremented at a specific point of execution.

IntervalMetric is an abstraction for timer-based metrics
whose measurements occur over some duration of execution.
…nto 721-Proj3

Conflicts:
	src/include/statistics/point_metric.h
@ChTimTsubasa
Copy link
Member Author

This is not going to add much overhead to the engine as the collector would not be blocked. Actually, the blocking thing is the background aggregating thread as it is CAS on the safe_ flag.

We would like the test the overhead with some TPCC testbench but it seems that the master branch is running slow. We would definitely run TPCC if we get fast enough later, and we claim it's not going to be hard (just change the stats_mode would switch the collection from on/off).

@ChTimTsubasa
Copy link
Member Author

Test cases for the framework are added in stats_framework_test.cpp

@@ -33,6 +32,7 @@
#include "function/timestamp_functions.h"
#include "index/index_factory.h"
#include "settings/settings_manager.h"
#include "storage/database.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line 198 of this file, the flag should be brain_data_collection. Probably the reason why query_logger_test is failing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it. Still failing the test. The log is

174: 2018-05-13 10:48:16 [test/sql/testing_sql_util.cpp:60:ExecuteSQLQuery] INFO - Query: SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;
174: 2018-05-13 10:48:16 [src/codegen/operator/table_scan_translator.cpp:40:TableScanTranslator] DEBUG - Constructing TableScanTranslator ...
174: 2018-05-13 10:48:16 [test/sql/testing_sql_util.cpp:95:ExecuteSQLQuery] INFO - Statement executed. Result: SUCCESS
174: 2018-05-13 10:48:21 [test/sql/testing_sql_util.cpp:60:ExecuteSQLQuery] INFO - Query: SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;
174: 2018-05-13 10:48:21 [test/sql/testing_sql_util.cpp:95:ExecuteSQLQuery] INFO - Statement executed. Result: SUCCESS
174: 2018-05-13 10:48:26 [test/sql/testing_sql_util.cpp:60:ExecuteSQLQuery] INFO - Query: SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;
174: 2018-05-13 10:48:26 [test/sql/testing_sql_util.cpp:95:ExecuteSQLQuery] INFO - Statement executed. Result: SUCCESS
174: 2018-05-13 10:48:31 [test/sql/testing_sql_util.cpp:60:ExecuteSQLQuery] INFO - Query: SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;
174: 2018-05-13 10:48:31 [test/sql/testing_sql_util.cpp:95:ExecuteSQLQuery] INFO - Statement executed. Result: SUCCESS
174: 2018-05-13 10:48:36 [test/sql/testing_sql_util.cpp:60:ExecuteSQLQuery] INFO - Query: SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;
174: 2018-05-13 10:48:36 [test/sql/testing_sql_util.cpp:95:ExecuteSQLQuery] INFO - Statement executed. Result: SUCCESS
174: 2018-05-13 10:48:41 [test/sql/testing_sql_util.cpp:60:ExecuteSQLQuery] INFO - Query: SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;
174: 2018-05-13 10:48:41 [test/sql/testing_sql_util.cpp:95:ExecuteSQLQuery] INFO - Statement executed. Result: SUCCESS
174: /home/tianyi/Documents/project/peloton/test/sql/testing_sql_util.cpp:274: Failure
174: Value of: actual_result.size()
174: Actual: 10
174: Expected: ref_result.size()
174: Which is: 11
174: /home/tianyi/Documents/project/peloton/test/sql/testing_sql_util.cpp:282: Failure
174: Value of: actual_result
174: Actual: { "CREATE TABLE test(a INT);|015a5c39f1d456672ab662e8bf9d13598d5d87f697", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (1);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (2);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "BEGIN;|011e0b3628080f24ada46945aaaa12f4ae69ed0a3b", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (1);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "COMMIT;|01cf0fba0f1cfd731e80292bd9c5e92abbec9056d1" }
174: Expected: ref_result
174: Which is: { "CREATE TABLE test(a INT);|015a5c39f1d456672ab662e8bf9d13598d5d87f697", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (1);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (2);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "BEGIN;|011e0b3628080f24ada46945aaaa12f4ae69ed0a3b", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (1);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "COMMIT;|01cf0fba0f1cfd731e80292bd9c5e92abbec9056d1" }
174: 2018-05-13 10:48:46 [test/sql/testing_sql_util.cpp:60:ExecuteSQLQuery] INFO - Query: SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;
174: 2018-05-13 10:48:46 [test/sql/testing_sql_util.cpp:95:ExecuteSQLQuery] INFO - Statement executed. Result: SUCCESS
174: /home/tianyi/Documents/project/peloton/test/sql/testing_sql_util.cpp:274: Failure
174: Value of: actual_result.size()
174: Actual: 12
174: Expected: ref_result.size()
174: Which is: 13
174: /home/tianyi/Documents/project/peloton/test/sql/testing_sql_util.cpp:282: Failure
174: Value of: actual_result
174: Actual: { "CREATE TABLE test(a INT);|015a5c39f1d456672ab662e8bf9d13598d5d87f697", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (1);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (2);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "BEGIN;|011e0b3628080f24ada46945aaaa12f4ae69ed0a3b", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (1);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "COMMIT;|01cf0fba0f1cfd731e80292bd9c5e92abbec9056d1", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914" }
174: Expected: ref_result
174: Which is: { "CREATE TABLE test(a INT);|015a5c39f1d456672ab662e8bf9d13598d5d87f697", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (1);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (2);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "BEGIN;|011e0b3628080f24ada46945aaaa12f4ae69ed0a3b", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "INSERT INTO test VALUES (1);|01494aa495a99247b2fe92808c6ae2df065e2ec101", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "COMMIT;|01cf0fba0f1cfd731e80292bd9c5e92abbec9056d1", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914", "SELECT query_string, fingerprint FROM peloton.pg_catalog.pg_query_history;|01851b97a4b7d3bc7fefc53d3b920878c08c4cc914" }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants