juicewcode commented on PR #6974:
URL: https://github.com/apache/shenyu/pull/6974#issuecomment-5426230292

   > Switching the mapper to `updateByPrimaryKeySelective` preserves omitted 
columns in the database, but the cache update still replaces the whole cached 
rule with `ScaleRuleDO.buildScaleRuleDO(scaleRuleDTO)`. For a partial update, 
any field left null in the DTO remains unchanged in the DB but becomes null in 
`ScaleRuleCache`, because `addOrUpdateRuleToCache` stores that partial object 
directly. Could we refresh the persisted row after the selective update, or 
merge the existing cached/DB rule before updating the cache, so the in-memory 
scale rule matches the database after partial updates?
   
    This change updates scale-rule handling in two ways:
   
     - Use updateByPrimaryKeySelective so fields omitted from the request 
remain unchanged in the database.
     - Reload the persisted ScaleRuleDO after the update and use the complete 
entity to refresh the cache, preventing omitted
     fields from becoming null in the cache.
   
     The stale cache entry caused by changing metricName is addressed 
separately in PR #6975 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to