question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filter Box Caching Incorrectly for Multi-Query Use Case

See original GitHub issue

A filter box that generates multiple queries (multiple filter controls) does not generate the correct cache entries for each filter control. It appears that only 1 (the first) query gets cached correctly. A correct cache entry should have a single query and associated results. What I see for most filter box cache entries are multiple queries from the filter box. So when the filter box gets reloaded, it only finds one of the cached queries and has cache misses for the rest. In each successive reload, the cache misses decrease by one. I suspect only the first query is generating the correct cache entry.

I am thinking the issue might be related to ‘class FilterBoxViz’ and/or ‘run_extra_queries’

Expected results

If I have a filter box with 16 filter controls, then a reload of the page within the cache TTL should generate 16 cache hits.

Actual results

Only 1 cache hit and 15 cache misses. I see 15 more logs like 2019-06-06 14:09:09,893:INFO:root:Caching 1180 chars at key c4dceda1ab0aef7047ef06ebb6063d88

Screenshots

Here is my filter box (16 controls) Screen Shot 2019-06-06 at 9 59 17 AM

How to reproduce the bug

Set logging to INFO. I am using REDIS cache but probably any cache would do.

  1. Load a dashboard containing a filter box with more than 1 filter control. Note occurrences of Caching xxxx chars at key yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
  2. Reload the page and note occurrences of “Caching abcd chars at key …” and occurrences of “Serving from cache”
  3. Note that there is only 1 cache hit for the filter box and that superset generated different cache keys then it did in step 1
  4. Inspect the cache for the cache keys observed in step 1 and note that they contain multiple queries…they should contain a single query.

Environment

(please complete the following information):

  • superset version: 0.26.3
  • python version: 2.7
  • node.js version: not installed
  • npm version: `not installed

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • [x ] I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven’t found one similar.

Additional context

Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
villebrocommented, Jul 18, 2019

I think I was able to replicate, will investigate.

1reaction
villebrocommented, Jun 23, 2019

I can take a look at this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Filter Box Caching Incorrectly for Multi-Query Use Case #7666
A filter box that generates multiple queries (multiple filter controls) does not generate the correct cache entries for each filter control.
Read more >
Cache geodjango query with bounding box filter
Im using geodjango (postgis) to retrieve points contained inside a bounding box (made by leafletjs), it works so nice, but now I want...
Read more >
Troubleshooting common filter suggestion issues | Looker
User B wonders why the filter suggestions are incorrect. The reason for the disparity is that the cached suggestion query did not update...
Read more >
In-memory Caching for Multi-query Optimization of Data ...
To find feasible and efficient execution plans, our method uses a cost-based optimiza- tion formulation akin to the multiple-choice knapsack problem.
Read more >
How to invalidate cached data in Apollo and handle updating ...
The Problem. When using the Apollo client, the response from any Query that gets sent to the server is cached locally (unless we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found