perf scripts python: export-to-postgresql/sqlite.py: Fix DROP VIEW power_events_view
Adrian Hunter
reviewercover perf scripts python: export-to-postgresql/sqlite.py: Fix DROP VIEW power_events_view
Hi
Here is a small fix to the export-to-postgresql.py script. The export-to-sqlite.py script had the same issue but SQLite did not seem to mind. However I made the fix anyway for good measure.
Adrian Hunter (2):
perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view
tools/perf/scripts/python/export-to-postgresql.py | 2 +- tools/perf/scripts/python/export-to-sqlite.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Regards
Adrian
Adrian Hunter
reviewerPATCH 2/2 perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view
Drop power_events_view before its dependent tables.
SQLite does not seem to mind but the fix was needed for PostgreSQL (export-to-postgresql.py script), so do the same fix for the SQLite. It is more logical and keeps the 2 scripts following the same approach.
--- tools/perf/scripts/python/export-to-sqlite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/scripts/python/export-to-sqlite.py +1 -1
@@ -608,11 +608,11 @@ def trace_end(): if is_table_empty("ptwrite"): drop("ptwrite") if is_table_empty("mwait") and is_table_empty("pwre") and is_table_empty("exstop") and is_table_empty("pwrx"): + do_query(query, 'DROP VIEW power_events_view'); drop("mwait") drop("pwre") drop("exstop") drop("pwrx") - do_query(query, 'DROP VIEW power_events_view'); if is_table_empty("cbr"): drop("cbr")
Signature · 1 line
2.17.1
Adrian Hunter
reviewerPATCH 1/2 perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view
In reply to Adrian HunterPostgreSQL can error if power_events_view is not dropped before its dependent tables e.g.
Exception: Query failed: ERROR: cannot drop table mwait because other objects depend on it
DETAIL: view power_events_view depends on table mwait
--- tools/perf/scripts/python/export-to-postgresql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/scripts/python/export-to-postgresql.py +1 -1
@@ -898,11 +898,11 @@ def trace_end(): if is_table_empty("ptwrite"): drop("ptwrite") if is_table_empty("mwait") and is_table_empty("pwre") and is_table_empty("exstop") and is_table_empty("pwrx"): + do_query(query, 'DROP VIEW power_events_view'); drop("mwait") drop("pwre") drop("exstop") drop("pwrx") - do_query(query, 'DROP VIEW power_events_view'); if is_table_empty("cbr"): drop("cbr")
Signature · 1 line
2.17.1
Arnaldo Carvalho de Melo
AppliedEm Mon, Jul 08, 2019 at 08:52:30AM +0300, Adrian Hunter escreveu:
Quoted 7 lines
Hi
Here is a small fix to the
export-to-postgresql.pyscript. Theexport-to-sqlite.pyscript had the same issue but SQLite did not seem to mind. However I made the fix anyway for good measure.
Quoted 7 lines
Adrian Hunter (2):
perf scripts python:export-to-postgresql.py: Fix DROP VIEWpower_events_viewperf scripts python:export-to-sqlite.py: Fix DROP VIEWpower_events_viewtools/perf/scripts/python/export-to-postgresql.py | 2 +- tools/perf/scripts/python/export-to-sqlite.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Thanks, applied.
- Arnaldo
tip-bot for Adrian Hunter
merge bot[tip:perf/urgent] perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view
In reply to Adrian Hunterperf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view
Commit-ID: d8d051df9f906232715282cc0570c94273b197bc Gitweb: https://git.kernel.org/tip/d8d051df9f906232715282cc0570c94273b197bc Author: Adrian Hunter <[email protected]> AuthorDate: Mon, 8 Jul 2019 08:52:31 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 9 Jul 2019 10:13:27 -0300
perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view
PostgreSQL can error if power_events_view is not dropped before its dependent tables e.g.
Exception: Query failed: ERROR: cannot drop table mwait because other objects depend on it
DETAIL: view power_events_view depends on table mwait
--- tools/perf/scripts/python/export-to-postgresql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/scripts/python/export-to-postgresql.py +1 -1
@@ -898,11 +898,11 @@ def trace_end(): if is_table_empty("ptwrite"): drop("ptwrite") if is_table_empty("mwait") and is_table_empty("pwre") and is_table_empty("exstop") and is_table_empty("pwrx"): + do_query(query, 'DROP VIEW power_events_view'); drop("mwait") drop("pwre") drop("exstop") drop("pwrx") - do_query(query, 'DROP VIEW power_events_view'); if is_table_empty("cbr"): drop("cbr")
tip-bot for Adrian Hunter
merge bot[tip:perf/urgent] perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view
In reply to Adrian Hunterperf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view
Commit-ID: 1334bb94cd8a21217cb0c186925f9bc9d47adafc Gitweb: https://git.kernel.org/tip/1334bb94cd8a21217cb0c186925f9bc9d47adafc Author: Adrian Hunter <[email protected]> AuthorDate: Mon, 8 Jul 2019 08:52:32 +0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 9 Jul 2019 10:13:28 -0300
perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view
Drop power_events_view before its dependent tables.
SQLite does not seem to mind but the fix was needed for PostgreSQL (export-to-postgresql.py script), so do the same fix for the SQLite. It is more logical and keeps the 2 scripts following the same approach.
--- tools/perf/scripts/python/export-to-sqlite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/scripts/python/export-to-sqlite.py +1 -1
@@ -608,11 +608,11 @@ def trace_end(): if is_table_empty("ptwrite"): drop("ptwrite") if is_table_empty("mwait") and is_table_empty("pwre") and is_table_empty("exstop") and is_table_empty("pwrx"): + do_query(query, 'DROP VIEW power_events_view'); drop("mwait") drop("pwre") drop("exstop") drop("pwrx") - do_query(query, 'DROP VIEW power_events_view'); if is_table_empty("cbr"): drop("cbr")