ankane/dexter

Unexpected Error

maob85 opened this issue · 11 comments

Hi, I've just installed dexter on my Centos7/PostgreSQL 9.6 server and tried to parse one log file, it pass first process but then it stops with the following error:

/opt/dexter/vendor/bundle/ruby/2.3.0/gems/pg_query-0.13.2/lib/pg_query/parse.rb:207:in block in load_tables_and_aliases!': undefined method map' for nil:NilClass (NoMethodError)

Can anybody help me fix this issue?

Regards!

Hey @maob85, can you paste the full stack trace?

Started
Processing 1053 new query fingerprints
No new indexes found
Processing 1954 new query fingerprints
/opt/dexter/vendor/bundle/ruby/2.3.0/gems/pg_query-0.13.2/lib/pg_queryrse.rb:207:in block in load_tables_and_aliases!': undefined method m for nil:NilClass (NoMethodError)
Did you mean? tap
from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pg_query-0.13.2b/pg_query/parse.rb:186:in loop' from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pg_query-0.13.2b/pg_query/parse.rb:186:in load_tables_and_aliases!'
from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pg_query-0.13.2b/pg_query/parse.rb:59:in tables_with_types' from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pg_query-0.13.2b/pg_query/parse.rb:33:in tables'
from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/query.rb:16:in tables' from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/indexer.rb:449:in each'
from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/indexer.rb:449:in flat_map' from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/indexer.rb:449:in possible_tables'
from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/indexer.rb:30:in process_queries' from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/processor.rb:66:in process_queries_without_lock'
from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/processor.rb:50:in block in process_queries' from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/processor.rb:49:in synchronize'
from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/processor.rb:49:in process_queries' from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/processor.rb:28:in block (2 levels) in perform'
from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/processor.rb:26:in loop' from /opt/dexter/vendor/bundle/ruby/2.3.0/gems/pgdexter-0.2.1//dexter/processor.rb:26:in block in perform'

Hey @maob85, I've added some debugging on master. Can you try it with:

gem install specific_install
gem specific_install ankane/pgdexter

I've installed Dexter according to https://github.com/ankane/dexter/blob/master/guides/Linux.md as follows (after installing Hypo):

CentOS / RHEL 7

sudo wget -O /etc/yum.repos.d/dexter.repo
https://dl.packager.io/srv/pghero/dexter/master/installer/el/7.repo
sudo yum install dexter

I don't have gem installed (i'm no a ruby user) but I'll check how to install it if needed.

I've updated the package. It'll probably be 10-15 minutes before the build completes. https://packager.io/gh/pghero/dexter

Ok, i've reinstalled your package and rerun it... After first process it shows this (notice Error extracting tables.):

No new indexes found
Processing 1954 new query fingerprints
Error extracting tables. Please report to https://github.com/ankane/dexter/issues/new
SELECT c.oid, a.attnum, a.attname, c.relname, n.nspname, a.attnotnull OR (t.typtype = 'd' AND t.typnotnull), pg_catalog.pg_get_expr(d.adbin, d.adrelid) LIKE '%nextval(%' FROM pg_catalog.pg_class c JOIN pg_catalog.pg_namespace n ON (c.relnamespace = n.oid) JOIN pg_catalog.pg_attribute a ON (c.oid = a.attrelid) JOIN pg_catalog.pg_type t ON (a.atttypid = t.oid) LEFT JOIN pg_catalog.pg_attrdef d ON (d.adrelid = a.attrelid AND d.adnum = a.attnum) JOIN (SELECT 17650 AS oid , 1 AS attnum UNION ALL SELECT 17663, 10 UNION ALL SELECT 17663, 11 UNION ALL SELECT 17650, 11 UNION ALL SELECT 17650, 14 UNION ALL SELECT 17650, 15 UNION ALL SELECT 17650, 18 UNION ALL SELECT 17650, 19 UNION ALL SELECT 17650, 16 UNION ALL SELECT 17650, 17 UNION ALL SELECT 17650, 20) vals ON (c.oid = vals.oid AND a.attnum = vals.attnum)
Running analyze: ANALYZE "table_name..."
....
Then shows many lines with this:
"Processing 0 new query fingerprints"

And it's hanged there... Don't know if it's normal...

Waiting for your comments... Thanks!

Thanks, the error looks like an issue w/ PgQuery. It looks like things are running normally. If you don't want Dexter to continuously watch the file, you can use:

dexter <conn-options> <log-file>

instead of tail. Also, if you didn't get any suggestions, you can use the --log-level debug2 option to debug why.

Oh! I see... Thank you very much... I'll make some test with my db then....

Regards!

Sorry to bother you again.. Running it with log-level as you suggested I can see this message "No new indexes found

Query 0177e78f9dfe6302b2138e7b4e1d65cca56e5b46f8
Could not run explain
"

Hey @maob85, that's expected for some queries. If it's happening for all queries, there's likely another issue at play.