-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
api:restIssues related to REST APIIssues related to REST APIbackend:serverIssues relating to Cube Core's ServerIssues relating to Cube Core's ServerbugLEGACY. Use the Bug issue type insteadLEGACY. Use the Bug issue type instead
Description
First of all, I’d like to thank everyone who introduced and developed this feature. 👍
Describe the bug
Cache disabling doesn’t work for instant queries that run without any delay.
To Reproduce
I made a test using Java + Cube REST API like this (see java code + logging at the end)
- added old entity to DB
- GET load / entity id, count(id)
- returned only old one ✅
- added new entity to DB
- GET load / entity id, count(id) (mainly to test cache)
- returned only old one ✅
- GET load / entity id, count(id) with cache = "no-cache"
- Still returned only old one 🔴
Expected behavior
Both entities should be returned when cache = "no-cache"
Version:
1.5.0 - 🔴
1.5.3 - 🔴
Additional context
If you need more logs or details, just let me know.
Java test
@Test
public void testCubeCache() {
var oldMerchant = dataService.merchantBuilder()
.withName("Old Cube Merchant")
.save();
var dto = new ReportQueryDto();
dto.measures = List.of(Cube.merchant_id__count);
dto.dimensions = List.of(Cube.merchant_id);
dto.orderDescBy(Cube.merchant_id);
dto.size = 3;
var query = dto.build();
var result = cubeJsService.load(walletId(), query, true); // true = use cache
assertTrue(containsMerchantId(result, oldMerchant.getId()));
var newMerchant = dataService.merchantBuilder()
.withName("New Cube Merchant")
.save();
assertTrue(newMerchant.getId() > oldMerchant.getId());
var result2 = cubeJsService.load(walletId(), query, true);
assertTrue(containsMerchantId(result2, oldMerchant.getId()));
assertFalse(containsMerchantId(result2, newMerchant.getId()));
var result3 = cubeJsService.load(walletId(), query, false); // false = no cache
assertTrue(containsMerchantId(result3, oldMerchant.getId()));
// fails on this line as resutl3 contains only one line with old one
assertTrue(containsMerchantId(result3, newMerchant.getId()));
}
Cube logging
[CUBE] STDOUT: 🔥 Cube Store (1.5.0) is assigned to 3030 port.
[CUBE] STDOUT: 🔓 Authentication checks are disabled in developer mode. Please use NODE_ENV=production to enable it.
[CUBE] STDOUT: 🦅 Dev environment available at http://localhost:4000
[CUBE] STDOUT: 🔗 Cube SQL (pg) is listening on 0.0.0.0:15432
[CUBE] STDOUT: 🚀 Cube API server (1.5.0) is listening on 4000
[CUBE] STDOUT: Executing SQL: 85fd74f9-5309-4ca0-8b52-66284ef9901c-span-1
[CUBE] STDOUT: --
[CUBE] STDOUT: SELECT
[CUBE] STDOUT: "merchant".id "merchant__id", count("merchant".id) "merchant__id__count"
[CUBE] STDOUT: FROM
[CUBE] STDOUT: merchant AS "merchant" WHERE ("merchant".wallet_id = '373662154753') GROUP BY 1 ORDER BY 1 DESC LIMIT 3
[CUBE] STDOUT: --
[CUBE] STDOUT: Performing query completed: 85fd74f9-5309-4ca0-8b52-66284ef9901c-span-1 (8ms)
[CUBE] STDOUT: Load Request Success: 85fd74f9-5309-4ca0-8b52-66284ef9901c-span-1 (221ms)
[CUBE] STDOUT: --
[CUBE] STDOUT: {
[CUBE] STDOUT: "measures": [
[CUBE] STDOUT: "merchant.id__count"
[CUBE] STDOUT: ],
[CUBE] STDOUT: "dimensions": [
[CUBE] STDOUT: "merchant.id"
[CUBE] STDOUT: ],
[CUBE] STDOUT: "segments": [],
[CUBE] STDOUT: "timeDimensions": [],
[CUBE] STDOUT: "filters": [],
[CUBE] STDOUT: "limit": 3,
[CUBE] STDOUT: "offset": 0,
[CUBE] STDOUT: "order": {
[CUBE] STDOUT: "merchant.id": "desc"
[CUBE] STDOUT: },
[CUBE] STDOUT: "timezone": "UTC",
[CUBE] STDOUT: "cacheMode": "stale-if-slow"
[CUBE] STDOUT: }
DEBUG 36144 --- HTTP POST http://localhost:43120/cubejs-api/v1/load
DEBUG 36144 --- Accept=[application/json, application/*+json]
DEBUG 36144 --- Writing
[CUBE] STDOUT: Load Request Success: 424566f5-eab8-4132-b87c-326a1ce89e1c-span-1 (180ms)
[CUBE] STDOUT: --
[CUBE] STDOUT: {
[CUBE] STDOUT: "measures": [
[CUBE] STDOUT: "merchant.id__count"
[CUBE] STDOUT: ],
[CUBE] STDOUT: "dimensions": [
[CUBE] STDOUT: "merchant.id"
[CUBE] STDOUT: ],
[CUBE] STDOUT: "segments": [],
[CUBE] STDOUT: "timeDimensions": [],
[CUBE] STDOUT: "filters": [],
[CUBE] STDOUT: "limit": 3,
[CUBE] STDOUT: "offset": 0,
[CUBE] STDOUT: "order": {
[CUBE] STDOUT: "merchant.id": "desc"
[CUBE] STDOUT: },
[CUBE] STDOUT: "timezone": "UTC",
[CUBE] STDOUT: "cacheMode": "stale-if-slow"
[CUBE] STDOUT: }
[CUBE] STDOUT: --
DEBUG 36144 --- HTTP POST http://localhost:43120/cubejs-api/v1/load
DEBUG 36144 --- Accept=[application/json, application/*+json]
[CUBE] STDOUT: Load Request Success: e6ea74b5-ff56-46a6-8404-7a9c32f15664-span-1 (155ms)
[CUBE] STDOUT: --
[CUBE] STDOUT: {
[CUBE] STDOUT: "measures": [
[CUBE] STDOUT: "merchant.id__count"
[CUBE] STDOUT: ],
[CUBE] STDOUT: "dimensions": [
[CUBE] STDOUT: "merchant.id"
[CUBE] STDOUT: ],
[CUBE] STDOUT: "segments": [],
[CUBE] STDOUT: "timeDimensions": [],
[CUBE] STDOUT: "filters": [],
[CUBE] STDOUT: "limit": 3,
[CUBE] STDOUT: "offset": 0,
[CUBE] STDOUT: "order": {
[CUBE] STDOUT: "merchant.id": "desc"
[CUBE] STDOUT: },
[CUBE] STDOUT: "timezone": "UTC",
[CUBE] STDOUT: "cacheMode": "no-cache"
[CUBE] STDOUT: }
[CUBE] STDOUT: --
Metadata
Metadata
Assignees
Labels
api:restIssues related to REST APIIssues related to REST APIbackend:serverIssues relating to Cube Core's ServerIssues relating to Cube Core's ServerbugLEGACY. Use the Bug issue type insteadLEGACY. Use the Bug issue type instead