powa-team / powa-web

PoWA user interface
http://powa.readthedocs.io/
73 stars 31 forks source link

errors in the option "Index suggestions" #144

Closed U17205367 closed 2 years ago

U17205367 commented 2 years ago

When I click on the option "Optimize this database" sometimes it doesn't show anything and in the logs I have the following errors

[E 210807 00:22:22 web:1670] Uncaught exception POST /server/1/database/ALFONSOUGARTE/suggest/ (HIDDEN) HTTPServerRequest(protocol='http', host='HIDDEN:8888', method='POST', uri='/server/1/database/ALFONSOUGARTE/suggest/', version='HTTP/1.1', remote_ip='HIDDEN') Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1590, in _execute result = method(*self.path_args, **self.path_kwargs) File "/usr/local/lib/python2.7/dist-packages/powa/wizard.py", line 78, in post to_date) File "/usr/local/lib/python2.7/dist-packages/powa/sql/init.py", line 441, in get_any_sample_query _from, _to, 'most executed') File "/usr/local/lib/python2.7/dist-packages/powa/sql/init.py", line 404, in get_unjumbled_query queries=[queryid]) File "/usr/local/lib/python2.7/dist-packages/powa/sql/init.py", line 450, in qualstat_get_figures queries_str = ','.join(queries) TypeError: sequence item 0: expected string, long found [E 210807 00:22:22 web:2162] 500 POST /server/1/database/ALFONSOUGARTE/suggest/ (HIDDEN) 1277.34ms

rjuju commented 2 years ago

Hi,

Is that the whole message? It's missing what was actually found:

File "/usr/local/lib/python2.7/dist-packages/powa/sql/init.py", line 450, in qualstat_get_figures
queries_str = ','.join(queries)
TypeError: sequence item 0: expected string, long found

Could you check what the browser (using your browser developer tool in the network section) is actually sending in the wizard post handler? It should have contain a json object with a queryids, but ideally showing the whole payload would be better.

U17205367 commented 2 years ago

RESPONSE.txt

Hello, I send you what I found in the development tool of my browser.

Does it have to see that the time range is 1 day?

rjuju commented 2 years ago

I'm not sure that I understand the problem, the queryids are in the right format.

Does it have to see that the time range is 1 day?

I don't understand this one. Are you saying that you're using a 1 day interval for the wizard? If yes it shouldn't have apart from maybe hitting the problematic value or something like that.

What version of powa-web are you using?

yhuelf commented 2 years ago

Hi, I've got the same backtrace with powa-web 4.1.2.

Here is one of the queryids field in the POST :

"queryids": [
        "6167442547585670741",
        "-2056245484387921993",
        "7527482154290278670",
        "-9206039535882408558",
        "1132196786439118865",
        "-5918983608499890255",
        "-5001064372749587985"
    ],

The other ones look similar.

rjuju commented 2 years ago

Thanks for the additional details @yhuelf!

I finally found the problem: it was a bug in the code that tries to get a query string when no example query is available with pg_qualstats. I never noticed that as all my experiments are done using a limited number of normalized queries, meaning that there was always enough room in pg_qualstats to save all the query strings.

Commit https://github.com/powa-team/powa-web/commit/5eceb3dfc6ef922757dd7f82f68defbbc830b14e should fix the problem.

yhuelf commented 2 years ago

wow, that was fast! The fix does work :-)

rjuju commented 2 years ago

Ah, good news! Thanks for the confirmation @yhuelf !