Subversion Repositories SmartDukaan

Rev

Show changed files | Directory listing | RSS feed

Filtering Options

Rev Age Author Path Log message Diff
36335 12 h 36 m ranu /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/model/ rbm rating dashboard view commited  
36334 12 h 38 m ranu /trunk/ rbm rating dashboard view commited  
36333 12 h 46 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/ Fix IllegalStateException: drop 'unless' when using @Cacheable(sync=true)

Spring Cache rejects @Cacheable with both sync=true AND an 'unless' attribute,
throwing IllegalStateException on every invocation. Surfaced in production log
on smartdukaan — MonitorController.todayPORBM:739 was returning 500 on 40
observed calls this session.

Dropped 'unless'. Caching an occasionally-empty List for 5 min is harmless:
months with no sales produce an empty result, which is cheaper to re-query
after 5 min than to keep special-casing. The real fix driver for sync=true
(stampede protection) is preserved.
 
36332 13 h 17 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/transaction/ moveToBill: fix loop reassigning order back to worse warehouse

- Break after first warehouse that covers remaining qty; loop used to
fall through and overwrite fulfilment WH with every subsequent snapshot,
so orders ended up pinned to the last (least-available) candidate.
- Sort candidates by net availability (availability - reserved) desc
so the best warehouse is tried first.
- Track remainingQty across splits; keep current orderId on the chunk
being placed and move the leftover to the deferred order.
- Null guard on itemSnapshots when no vendor under the billing WH has
stock/reservation for the item.
 
36331 14 h 20 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/inventory/ Fix @Cacheable name collision between getSaholicStockList variants

SaholicInventoryServiceImpl:271 and :282 both used @Cacheable(value =
'saholicCISList') on no-arg methods. Spring's default SimpleKey.EMPTY means
both methods shared ONE cache entry — whichever was called first poisoned the
cache for the other, even though they return different filtered sets:

- getSaholicStockList (:272) runs selectWarehouseCisNew — tl.active=1 only
- getSaholicStockListWithoutCatalogMovingStatus (:283) runs
selectWarehouseCisNewWithoutCatalogMovingStatus — includes catalog moving
status join and filters out non-stocked OTHER/SLOWMOVING items

Renamed the second cache to 'saholicCISListWithStatus' so each method uses
its own namespace. Consumers of either method now get their method's actual
result, not a random earlier caller's.

This is a correctness fix (wrong cached data) more than a perf fix, though
it does mean both caches fill independently now (tiny cold-path DB uptick,
already mitigated by 5-min TTL via timeoutCacheManager).
 
36330 14 h 44 m amit /trunk/profitmandi-dao/src/main/ Fix getWarehousewiseCollection: add timestamp index, drop misleading FORCE INDEX

EXPLAIN on hadb1 showed the query was full-scanning transaction.userwallethistory
(1.9M rows) despite FORCE INDEX (idx_uwh_wallet_timestamp). The composite
(wallet_id, timestamp) needs an equality predicate on wallet_id to be usable,
but this query filters by uwh.timestamp at the scan level with no wallet_id —
driven from fofo_store via joins. Optimizer correctly rejected the hint and
picked ALL. Query averaged 773 ms across 4,095 calls (3,167 s cumulative).

- add_idx_uwh_timestamp_reftype.sql: new index on (timestamp, reference_type)
so the range scan narrows by time and reference_type filters inline.
- UserWalletRepositoryImpl:110: drop FORCE INDEX hint; let optimizer choose.
Updated comment to explain why.

Left PartnerCollectionPlanRepositoryImpl.getCommitmentCollectionSummary:117
untouched — that query drives from pcp → userwallet → userwallethistory and
the join has wallet_id = uw.id known at scan, so (wallet_id, timestamp) is
the right index there; FORCE INDEX remains appropriate.
 
36329 14 h 50 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/service/ Tune rbmWeeklyBilling cache: 2m→5m TTL + sync=true

The RBM weekly billing aggregate query takes ~2s per call (1,924 cumulative hits
on hadb1 = 3,800s DB time). Previously cached for only 2 minutes with no
stampede protection — every 2m window, every concurrent dashboard load ran the
aggregate in parallel and burnt Hikari slots simultaneously.

- 2m → 5m: this is month-level aggregate bucketed by week, doesn't need
sub-minute freshness for an RBM dashboard.
- sync=true: single in-JVM computation per (monthStart, monthEnd) key per
expiry window; concurrent misses wait for the in-flight load instead of
racing to the DB.

fiveMintimeoutCacheManager already exists in CacheConfig:73 (Caffeine, in-memory,
so no Redis/LocalDateTime serialization concerns).
 
36328 16 h 0 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/dao/repository/transaction/ Remove @Cacheable from getFirstBillingDate — LocalDateTime + Redis incompatibility

The redisOneDayCacheManager (CacheConfig.java:109-116) is configured with
enableDefaultTyping(NON_FINAL, JsonTypeInfo.As.PROPERTY). That embeds type info
as a JSON object property, which is only valid for objects ({}) — not arrays.
JavaTimeModule serializes LocalDateTime as an array ([y,m,d,h,m,s]), so the
write drops type metadata and reads fail with MismatchedInputException
('need JSON String that contains type id').

The underlying NamedQuery (Order.selectFirstBillingByRetailer) uses MIN() on
the idx_order_customer_billing composite index — EXPLAIN reports 'Select tables
optimized away'. Per-call latency is microseconds even uncached, so Redis
caching was optimization rather than requirement. Simpler to drop the annotation
than reconfigure the shared cache manager.
 
36327 17 h 19 m amit /trunk/profitmandi-dao/src/main/java/com/spice/profitmandi/ Fix currentinventorysnapshot/currentreservationsnapshot deadlock and optimize getFirstBillingDate

- SaholicInventoryServiceImpl: enforce reservation-snapshot → inventory-snapshot
lock order in addReservationCount and reduceReservationCount via explicit
session.flush(); eliminates the hadb1 deadlock recorded 2026-04-20 19:43:24
between these two methods' opposite-order writes.
- SaholicInventorySnapshot: add @DynamicUpdate so UPDATEs only rewrite the
changed column instead of all three — cuts redo/binlog write amplification
and makes deadlock dumps pinpoint the actual business path.
- TransactionRepositoryImpl.getFirstBillingDate: replace filesort-over-all-billed-
orders with MIN(billingTimestamp) via new Order.selectFirstBillingByRetailer
named query (Select tables optimized away). Preserves 2017-01-01 cutoff and
null-for-unbilled-partner semantics.
- Add @Cacheable on redisOneDayCacheManager keyed by fofoId (unless null) so the
8 call sites stop piling up identical SELECTs on the order table — this was
the query pinning Hikari slots at 150-460s each in recent processlist dumps.
 
36326 17 h 33 m ranu /trunk/profitmandi-fofo/src/main/java/com/spice/profitmandi/web/service/ rbm rating dashboard view commited  
36325 18 h 16 m aman /trunk/profitmandi-fofo/src/main/ Fix: Tier-Based Referral Payout  
36324 18 h 18 m aman /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/controller/ Fix: Tier-Based Referral Payout  
36323 18 h 32 m amit /trunk/profitmandi-dao/src/main/resources/ Fix app config  
36322 1 d 7 h vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/controller/ New APIs Version 2  
36321 1 d 7 h vikas /trunk/profitmandi-web/src/main/java/com/spice/profitmandi/web/ New APIs Version 2  
36320 1 d 11 h vikas /trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/web/ CORS update, accept referrer  
36319 1 d 11 h aman /trunk/profitmandi-fofo/src/main/webapp/WEB-INF/views/ftl/ Fix:Migrate legacy Purchase Return flow (Report + Bulk Create + Debit Notes) into FOFO  
36318 1 d 11 h aman /trunk/ Fix:Migrate legacy Purchase Return flow (Report + Bulk Create + Debit Notes) into FOFO  
36317 1 d 11 h aman /trunk/profitmandi-common/src/main/java/com/spice/profitmandi/common/model/ Fix:Migrate legacy Purchase Return flow (Report + Bulk Create + Debit Notes) into FOFO  
36316 1 d 11 h aman /trunk/ Fix:Migrate legacy Purchase Return flow (Report + Bulk Create + Debit Notes) into FOFO  

Show All