Skip to contentSkip to conversation

perf scripts python: export-to-postgresql/sqlite.py: Fix DROP VIEW power_events_view

PATCH Applied Adrian Hunter 3 participants 6 messages Jul 8, 2019 – Jul 13, 2019 perf events

lore
Share & tools
lore

Adrian Hunter

author reviewer
#0 lore raw

cover 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

author reviewer
#1 lore raw

PATCH 1/2 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

Fixes aba44287a224 ("perf scripts python: export-to-postgresql.py: Export Intel PT power and ptwrite events")
---
 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
index 4447f0d7c754..92713d93e956 100644
@@ -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
#2 lore raw

[tip:perf/urgent] perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view

perf 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

Cc Jiri Olsa <[email protected]>
Fixes aba44287a224 ("perf scripts python: export-to-postgresql.py: Export Intel PT power and ptwrite events")
---
 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
index 4447f0d7c754..92713d93e956 100644
@@ -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")
 
author reviewer
#3 lore raw

PATCH 2/2 perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view

In reply to Adrian Hunter

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.

Fixes 5130c6e55531 ("perf scripts python: export-to-sqlite.py: Export Intel PT power and ptwrite events")
---
 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
index 3222a83f4184..021326c46285 100644
@@ -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
#4 lore raw

[tip:perf/urgent] perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view

perf 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.

Cc Jiri Olsa <[email protected]>
Fixes 5130c6e55531 ("perf scripts python: export-to-sqlite.py: Export Intel PT power and ptwrite events")
---
 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
index 3222a83f4184..021326c46285 100644
@@ -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")
 
#5 lore raw
In reply to Adrian Hunter

Em 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.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.

Quoted 7 lines

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(-)

Thanks, applied.

- Arnaldo