alibaba / alibaba/Sentinel

DynamicSentinelProperty类中updateValue方法中使用的isEqual判断会造成规则无效更新吧

Open
#2,050 2 comments 0 reactions 0 assignees View on GitHub
kind/discussion
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## Issue Description

Type: *bug report*

### Describe what happened (or what feature you want)
isEqual 比较时直接使用了AbstractList类中equals方法进行比较,这个方法要求集合中对应位置元素都相同才会判断为相同;实际使用时只要俩规则集合拥有相同的元素(元素在集合中位置不一定一一对应),即可认为这俩规则集是相等的。
这个bug在sentinel运行中会带来规则的无效(多余)更新。

### Describe what you expected to happen
isEqual 方法判断时不应该要求规则集中每个相同元素在集合中位置一一对应。eg. A[a,b,c] 和 B[c,a.b] 是俩相同规则集。

### How to reproduce it (as minimally and precisely as possible)

1.
2.
3.

### Tell us your environment
sentinel1.8 jdk1.8

### Anything else we need to know?

Contributor guide

Open the contributing guide

Research direction

Start by locating DynamicSentinelProperty.updateValue and its isEqual comparison. Review how rule collections are compared and reproduce the ordering case described by A[a,b,c] and B[c,a,b]. Done means equivalent rule sets with different element order no longer cause unnecessary rule updates, while genuinely different sets still do.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.