This is an automated email from the ASF dual-hosted git repository.

Aias00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git


The following commit(s) were added to refs/heads/master by this push:
     new 37f252b6de fix: Use selective updates for scale rules(#6709) (#6974)
37f252b6de is described below

commit 37f252b6de5d808c311719f999cc9036ac59754f
Author: Southern <[email protected]>
AuthorDate: Sat Sep 5 05:57:11 2026 +0800

    fix: Use selective updates for scale rules(#6709) (#6974)
    
    * fix: Use selective updates for scale rules
      - Replace updateByPrimaryKey with updateByPrimaryKeySelective.
    
    * fix: keep scale rule cache consistent after partial updates
    
      - Use selective update for scale rules
      - Reload the persisted rule before updating the cache
      - Preserve fields omitted from partial update requests
    
    ---------
    
    Co-authored-by: aias00 <[email protected]>
---
 .../org/apache/shenyu/admin/service/impl/ScaleRuleServiceImpl.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ScaleRuleServiceImpl.java
 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ScaleRuleServiceImpl.java
index 57a66e5928..6810040d0c 100644
--- 
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ScaleRuleServiceImpl.java
+++ 
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ScaleRuleServiceImpl.java
@@ -123,9 +123,10 @@ public class ScaleRuleServiceImpl implements 
ScaleRuleService {
     @Override
     public int update(final ScaleRuleDTO scaleRuleDTO) {
         final ScaleRuleDO after = ScaleRuleDO.buildScaleRuleDO(scaleRuleDTO);
-        int rows = scaleRuleMapper.updateByPrimaryKey(after);
+        int rows = scaleRuleMapper.updateByPrimaryKeySelective(after);
         if (rows > 0) {
-            
scaleRuleCache.addOrUpdateRuleToCache(ScaleRuleDO.buildScaleRuleDO(scaleRuleDTO));
+            final ScaleRuleDO persisted = 
scaleRuleMapper.selectByPrimaryKey(scaleRuleDTO.getId());
+            scaleRuleCache.addOrUpdateRuleToCache(persisted);
         }
         return rows;
     }

Reply via email to