Fixed metric name.

Add metric description.
Add test.
This commit is contained in:
millb 2019-09-26 15:06:52 +03:00
parent 4e893eb949
commit 259be751ee
4 changed files with 17 additions and 3 deletions

View File

@ -114,7 +114,7 @@
M(SelectedRanges, "Number of (non-adjacent) ranges in all data parts selected to read from a MergeTree table.") \
M(SelectedMarks, "Number of marks (index granules) selected to read from a MergeTree table.") \
\
M(CountOfMerges, "") \
M(Merge, "Number of launches background merges.") \
M(MergedRows, "Rows read for background merges. This is the number of rows before merge.") \
M(MergedUncompressedBytes, "Uncompressed bytes (for columns as they stored in memory) that was read for background merges. This is the number before merge.") \
M(MergesTimeMilliseconds, "Total time spent for background merges.")\

View File

@ -39,7 +39,7 @@ namespace ProfileEvents
extern const Event MergedRows;
extern const Event MergedUncompressedBytes;
extern const Event MergesTimeMilliseconds;
extern const Event CountOfMerges;
extern const Event Merge;
}
namespace CurrentMetrics
@ -511,7 +511,7 @@ public:
if (stage.is_first)
{
ProfileEvents::increment(ProfileEvents::MergedRows, value.read_rows);
ProfileEvents::increment(ProfileEvents::CountOfMerges);
ProfileEvents::increment(ProfileEvents::Merge);
}
updateWatch();

View File

@ -0,0 +1,13 @@
DROP TABLE IF EXISTs new_table_test;
DROP TABLE IF EXISTS check_table_test;
CREATE TABLE IF NOT EXISTS new_table_test(name String) ENGINE = MergeTree Order By name;
CREATE TABLE IF NOT EXISTS check_table_test(value1 UInt64, value2 UInt64) ENGINE = MergeTree Order By tuple();
INSERT INTO check_table_test (value1) SELECT value from system.events WHERE event = 'Merge';
OPTIMIZE TABLE new_table_test FINAL;
INSERT INTO check_table_test (value2) SELECT value from system.events WHERE event = 'Merge';
SELECT count() FROM check_table_test WHERE value2 > value1;
DROP TABLE new_table_test;
DROP TABLE check_table_test;