From b115d748a80d2512ce17491ae78505ddbd7418a2 Mon Sep 17 00:00:00 2001 From: Ibrar Ahmed Date: Tue, 16 Feb 2021 12:46:53 +0000 Subject: [PATCH] PG-179. Skip lines for checking, and badge to README. Patch By: Mikhail Samoylov --- .github/workflows/cppcheck.yml | 5 +++-- .github/workflows/pg11test.yml | 2 +- README.md | 4 ++++ pg_stat_monitor.c | 4 +++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 687ca3e..ebb848c 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -11,5 +11,6 @@ jobs: - name: install cppcheck run: sudo apt-get install cppcheck - - name: Prepare for install postgresql - run: sudo cppcheck --enable=all --error-exitcode=1 . + - name: Execute linter check with cppcheck + run: sudo cppcheck --enable=all --inline-suppr --template='{file}:{line},{severity},{id},{message}' --error-exitcode=1 --suppress=missingIncludeSystem --suppress=missingInclude --check-config . + diff --git a/.github/workflows/pg11test.yml b/.github/workflows/pg11test.yml index b1ed02c..ab8b019 100644 --- a/.github/workflows/pg11test.yml +++ b/.github/workflows/pg11test.yml @@ -3,7 +3,7 @@ on: [push] jobs: build: - name: pg1-test + name: pg11-test runs-on: ubuntu-latest steps: - name: Clone postgres repository diff --git a/README.md b/README.md index bc47fcc..2792818 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +![pg11-test](https://github.com/percona/pg_stat_monitor/workflows/pg11-test/badge.svg) +![pg12-test](https://github.com/percona/pg_stat_monitor/workflows/pg12-test/badge.svg) +![pg13-test](https://github.com/percona/pg_stat_monitor/workflows/pg13-test/badge.svg) + ## What is pg_stat_monitor? The **pg_stat_monitor** is a **PostgreSQL Query Performance Monitoring** tool, based on PostgreSQL's contrib module ``pg_stat_statements``. PostgreSQL’s pg_stat_statements provides the basic statistics, which is sometimes not enough. The major shortcoming in pg_stat_statements is that it accumulates all the queries and their statistics and does not provide aggregated statistics nor histogram information. In this case, a user needs to calculate the aggregate which is quite expensive. diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index d5c870a..9831e30 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -183,6 +183,7 @@ static uint64 get_query_id(pgssJumbleState *jstate, Query *query); /* * Module load callback */ +// cppcheck-suppress unusedFunction void _PG_init(void) { @@ -251,6 +252,7 @@ _PG_init(void) /* * Module unload callback */ +// cppcheck-suppress unusedFunction void _PG_fini(void) { @@ -1140,7 +1142,6 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo, Datum values[PG_STAT_STATEMENTS_COLS]; bool nulls[PG_STAT_STATEMENTS_COLS]; int i = 0; - int len = 0; int kind; Counters tmp; double stddev; @@ -1167,6 +1168,7 @@ pg_stat_monitor_internal(FunctionCallInfo fcinfo, } else { + int len = 0; unsigned char *buf = pgss_qbuf[entry->key.bucket_id]; if(read_query(buf, queryid, query_txt) == 0) {