superset icon indicating copy to clipboard operation
superset copied to clipboard

fix: ensure numeric values for extra metadata_cache_timeout payloads

Open kidusmakonnen opened this issue 1 year ago • 4 comments

SUMMARY

We identified an issue where FileSystemCache is used, setting values for table_cache_timeout and schema_cache_timeout in the database properties modal leads to failures in fetching schema and table lists in SQLLab. The requests to /api/v1/database/{dbId}/tables/?q=(force:!f,schema_name:{schemaName}) were returning a 422 UNPROCESSABLE ENTITY status.

The root cause of the issue was that table_cache_timeout and schema_cache_timeout values were being serialized as strings instead of numbers. The backend expected numeric values, resulting in the 422 error when it encountered strings. To resolve this, we need to ensure that these values are correctly converted to numbers before they are sent in the payload.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

https://github.com/apache/superset/assets/8809047/86dd8c56-0015-4450-ad51-bb49e7f85f2b

After

https://github.com/apache/superset/assets/8809047/88c1f072-1637-47d6-9510-52a4b85556dd

TESTING INSTRUCTIONS

  1. Ensure CACHE_CONFIG is set to use FileSystemCache in config.py/superset_config.py
  2. Go to Settings → Database Connections
  3. Edit a DB connection
  4. Go to Advanced → Performance
  5. Set values to SCHEMA CACHE TIMEOUT and TABLE CACHE TIMEOUT
  6. Go to SqlLab, select the DB you edited
  7. Try to refresh the schema list and table list

ADDITIONAL INFORMATION

  • [x] Has associated issue: Fixes #28735
  • [ ] Required feature flags:
  • [ ] Changes UI
  • [ ] Includes DB Migration (follow approval process in SIP-59)
    • [ ] Migration is atomic, supports rollback & is backwards-compatible
    • [ ] Confirm DB migration upgrade and downgrade tested
    • [ ] Runtime estimates and downtime expectations provided
  • [ ] Introduces new feature or API
  • [ ] Removes existing feature or API

kidusmakonnen avatar May 28 '24 05:05 kidusmakonnen

closing/reopening to kick-start CI. Let's see if we can get this across the finish line! CC @betodealmeida / @mistercrunch to see if we can get some 👀 on it.

rusackas avatar Mar 21 '25 17:03 rusackas

Ooops, one test is failing

FAIL src/components/Chart/DrillDetail/DrillDetailMenuItems.test.tsx (26.67 s)

mistercrunch avatar Mar 21 '25 22:03 mistercrunch

@kidusmakonnen can you look into the test failure? Would love to get this across the finish line :D

rusackas avatar Jun 13 '25 22:06 rusackas

@kidusmakonnen can you look into the test failure? Would love to get this across the finish line :D

Test is passing locally, hopefully CI agrees this time :sweat_smile:

kidusmakonnen avatar Jun 14 '25 01:06 kidusmakonnen

Merged! Thank you for the contribution!

mistercrunch avatar Jun 16 '25 20:06 mistercrunch