linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] perf scripts python: export-to-postgresql/sqlite.py: Fix DROP VIEW power_events_view
@ 2019-07-08  5:52 Adrian Hunter
  2019-07-08  5:52 ` [PATCH 1/2] perf scripts python: export-to-postgresql.py: " Adrian Hunter
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Adrian Hunter @ 2019-07-08  5:52 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view
  2019-07-08  5:52 [PATCH 0/2] perf scripts python: export-to-postgresql/sqlite.py: Fix DROP VIEW power_events_view Adrian Hunter
@ 2019-07-08  5:52 ` Adrian Hunter
  2019-07-13 11:06   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
  2019-07-08  5:52 ` [PATCH 2/2] perf scripts python: export-to-sqlite.py: " Adrian Hunter
  2019-07-08 22:00 ` [PATCH 0/2] perf scripts python: export-to-postgresql/sqlite.py: " Arnaldo Carvalho de Melo
  2 siblings, 1 reply; 6+ messages in thread
From: Adrian Hunter @ 2019-07-08  5:52 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel

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

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
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(-)

diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py
index 4447f0d7c754..92713d93e956 100644
--- a/tools/perf/scripts/python/export-to-postgresql.py
+++ b/tools/perf/scripts/python/export-to-postgresql.py
@@ -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")
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view
  2019-07-08  5:52 [PATCH 0/2] perf scripts python: export-to-postgresql/sqlite.py: Fix DROP VIEW power_events_view Adrian Hunter
  2019-07-08  5:52 ` [PATCH 1/2] perf scripts python: export-to-postgresql.py: " Adrian Hunter
@ 2019-07-08  5:52 ` Adrian Hunter
  2019-07-13 11:07   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
  2019-07-08 22:00 ` [PATCH 0/2] perf scripts python: export-to-postgresql/sqlite.py: " Arnaldo Carvalho de Melo
  2 siblings, 1 reply; 6+ messages in thread
From: Adrian Hunter @ 2019-07-08  5:52 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel

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.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
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(-)

diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py
index 3222a83f4184..021326c46285 100644
--- a/tools/perf/scripts/python/export-to-sqlite.py
+++ b/tools/perf/scripts/python/export-to-sqlite.py
@@ -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")
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] perf scripts python: export-to-postgresql/sqlite.py: Fix DROP VIEW power_events_view
  2019-07-08  5:52 [PATCH 0/2] perf scripts python: export-to-postgresql/sqlite.py: Fix DROP VIEW power_events_view Adrian Hunter
  2019-07-08  5:52 ` [PATCH 1/2] perf scripts python: export-to-postgresql.py: " Adrian Hunter
  2019-07-08  5:52 ` [PATCH 2/2] perf scripts python: export-to-sqlite.py: " Adrian Hunter
@ 2019-07-08 22:00 ` Arnaldo Carvalho de Melo
  2 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-07-08 22:00 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: Jiri Olsa, linux-kernel

Em Mon, Jul 08, 2019 at 08:52:30AM +0300, Adrian Hunter escreveu:
> 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(-)

Thanks, applied.

- Arnaldo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [tip:perf/urgent] perf scripts python: export-to-postgresql.py: Fix DROP VIEW power_events_view
  2019-07-08  5:52 ` [PATCH 1/2] perf scripts python: export-to-postgresql.py: " Adrian Hunter
@ 2019-07-13 11:06   ` tip-bot for Adrian Hunter
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Adrian Hunter @ 2019-07-13 11:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: adrian.hunter, jolsa, linux-kernel, hpa, tglx, acme, mingo

Commit-ID:  d8d051df9f906232715282cc0570c94273b197bc
Gitweb:     https://git.kernel.org/tip/d8d051df9f906232715282cc0570c94273b197bc
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Mon, 8 Jul 2019 08:52:31 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Fixes: aba44287a224 ("perf scripts python: export-to-postgresql.py: Export Intel PT power and ptwrite events")
Link: http://lkml.kernel.org/r/20190708055232.5032-2-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/export-to-postgresql.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/scripts/python/export-to-postgresql.py b/tools/perf/scripts/python/export-to-postgresql.py
index 4447f0d7c754..92713d93e956 100644
--- a/tools/perf/scripts/python/export-to-postgresql.py
+++ b/tools/perf/scripts/python/export-to-postgresql.py
@@ -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")
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [tip:perf/urgent] perf scripts python: export-to-sqlite.py: Fix DROP VIEW power_events_view
  2019-07-08  5:52 ` [PATCH 2/2] perf scripts python: export-to-sqlite.py: " Adrian Hunter
@ 2019-07-13 11:07   ` tip-bot for Adrian Hunter
  0 siblings, 0 replies; 6+ messages in thread
From: tip-bot for Adrian Hunter @ 2019-07-13 11:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, hpa, mingo, linux-kernel, adrian.hunter, tglx, jolsa

Commit-ID:  1334bb94cd8a21217cb0c186925f9bc9d47adafc
Gitweb:     https://git.kernel.org/tip/1334bb94cd8a21217cb0c186925f9bc9d47adafc
Author:     Adrian Hunter <adrian.hunter@intel.com>
AuthorDate: Mon, 8 Jul 2019 08:52:32 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Fixes: 5130c6e55531 ("perf scripts python: export-to-sqlite.py: Export Intel PT power and ptwrite events")
Link: http://lkml.kernel.org/r/20190708055232.5032-3-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/scripts/python/export-to-sqlite.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/scripts/python/export-to-sqlite.py b/tools/perf/scripts/python/export-to-sqlite.py
index 3222a83f4184..021326c46285 100644
--- a/tools/perf/scripts/python/export-to-sqlite.py
+++ b/tools/perf/scripts/python/export-to-sqlite.py
@@ -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")
 

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-07-13 11:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-08  5:52 [PATCH 0/2] perf scripts python: export-to-postgresql/sqlite.py: Fix DROP VIEW power_events_view Adrian Hunter
2019-07-08  5:52 ` [PATCH 1/2] perf scripts python: export-to-postgresql.py: " Adrian Hunter
2019-07-13 11:06   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-08  5:52 ` [PATCH 2/2] perf scripts python: export-to-sqlite.py: " Adrian Hunter
2019-07-13 11:07   ` [tip:perf/urgent] " tip-bot for Adrian Hunter
2019-07-08 22:00 ` [PATCH 0/2] perf scripts python: export-to-postgresql/sqlite.py: " Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).