From 0a10dfc71b32dcf9dc021f167f12594b979d28e1 Mon Sep 17 00:00:00 2001
From: "lancer.hong"
Date: Wed, 27 Apr 2022 22:53:53 +0800
Subject: [PATCH] Release 2.6.2
---
README.en-us.md | 3 +-
README.md | 3 +-
docker-compose.yml | 6 +-
fizz-bootstrap/pom.xml | 2 +-
fizz-common/pom.xml | 2 +-
fizz-core/pom.xml | 2 +-
.../src/main/java/we/stats/FlowStat.java | 55 ++++++++++++-------
.../stats/circuitbreaker/CircuitBreaker.java | 2 +-
.../src/test/java/we/stats/FlowStatTests.java | 2 +-
.../CircuitBreakManagerTests.java | 2 +
fizz-plugin/pom.xml | 2 +-
fizz-spring-boot-starter/pom.xml | 2 +-
pom.xml | 2 +-
13 files changed, 51 insertions(+), 34 deletions(-)
diff --git a/README.en-us.md b/README.en-us.md
index 1e3c672..cff5961 100644
--- a/README.en-us.md
+++ b/README.en-us.md
@@ -4,7 +4,7 @@ English | [简体中文](./README.md)
-
+
@@ -122,6 +122,7 @@ Starting from v1.3.0, the frontend and backend of the management backend are mer
| v2.5.2 | v2.5.2 |
| v2.6.0 | v2.6.0 |
| v2.6.1 | v2.6.1 |
+| v2.6.2 | v2.6.2 |
Please download the corresponding management backend version according to the version of the community version
diff --git a/README.md b/README.md
index 96f4fb9..23901fb 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
-
+
@@ -120,6 +120,7 @@ API地址:http://demo.fizzgate.com/proxy/[服务名]/[API_Path]
| v2.5.2 | v2.5.2 |
| v2.6.0 | v2.6.0 |
| v2.6.1 | v2.6.1 |
+| v2.6.2 | v2.6.2 |
请根据社区版的版本下载对应的管理后台版本
diff --git a/docker-compose.yml b/docker-compose.yml
index 467196a..0e3c0d0 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -2,7 +2,7 @@ version: "3.6"
services:
fizz-mysql:
- image: "fizzgate/fizz-mysql:2.6.2-beta1"
+ image: "fizzgate/fizz-mysql:2.6.2"
container_name: fizz-mysql
restart: always
hostname: fizz-mysql
@@ -27,7 +27,7 @@ services:
- fizz
fizz-gateway-community:
- image: "fizzgate/fizz-gateway-community:2.6.2-beta1"
+ image: "fizzgate/fizz-gateway-community:2.6.2"
container_name: fizz-gateway-community
restart: always
hostname: fizz-gateway-community
@@ -48,7 +48,7 @@ services:
- fizz
fizz-manager-professional:
- image: "fizzgate/fizz-manager-professional:2.6.2-beta1"
+ image: "fizzgate/fizz-manager-professional:2.6.2"
container_name: fizz-manager-professional
restart: always
hostname: fizz-manager-professional
diff --git a/fizz-bootstrap/pom.xml b/fizz-bootstrap/pom.xml
index f469aa0..cdf0738 100644
--- a/fizz-bootstrap/pom.xml
+++ b/fizz-bootstrap/pom.xml
@@ -12,7 +12,7 @@
com.fizzgate
fizz-bootstrap
- 2.6.2-beta1
+ 2.6.2
1.8
diff --git a/fizz-common/pom.xml b/fizz-common/pom.xml
index fe09e5d..dabbe42 100644
--- a/fizz-common/pom.xml
+++ b/fizz-common/pom.xml
@@ -5,7 +5,7 @@
fizz-gateway-community
com.fizzgate
- 2.6.2-beta1
+ 2.6.2
../pom.xml
4.0.0
diff --git a/fizz-core/pom.xml b/fizz-core/pom.xml
index ea1ba71..7bf45a8 100644
--- a/fizz-core/pom.xml
+++ b/fizz-core/pom.xml
@@ -5,7 +5,7 @@
fizz-gateway-community
com.fizzgate
- 2.6.2-beta1
+ 2.6.2
../pom.xml
4.0.0
diff --git a/fizz-core/src/main/java/we/stats/FlowStat.java b/fizz-core/src/main/java/we/stats/FlowStat.java
index f4d4ad7..6cb6996 100644
--- a/fizz-core/src/main/java/we/stats/FlowStat.java
+++ b/fizz-core/src/main/java/we/stats/FlowStat.java
@@ -52,6 +52,10 @@ public class FlowStat {
*/
public static long INTERVAL = 1000;
+ public boolean cleanResource = true;
+
+ public boolean createTimeSlotOnlyTraffic = true;
+
/**
* A string Resource ID as key
*/
@@ -73,6 +77,12 @@ public class FlowStat {
runScheduleJob();
}
+ public FlowStat(boolean cleanResource, boolean createTimeSlotOnlyTraffic) {
+ this.cleanResource = cleanResource;
+ this.createTimeSlotOnlyTraffic = createTimeSlotOnlyTraffic;
+ runScheduleJob();
+ }
+
public FlowStat(CircuitBreakManager circuitBreakManager) {
this.circuitBreakManager = circuitBreakManager;
runScheduleJob();
@@ -588,27 +598,28 @@ public class FlowStat {
lastSlotId = slotId;
// log.debug("housekeeping done");
-
- long currentTimeSlot = stat.currentTimeSlotId();
- long startTimeSlot = currentTimeSlot - n;
- for (Entry entry : stat.resourceStats.entrySet()) {
- String resource = entry.getKey();
- if (ResourceIdUtils.NODE_RESOURCE.equals(resource)) {
- continue;
- }
- ResourceStat resourceStat = entry.getValue();
- boolean noTraffic = true;
- long timeSlot = startTimeSlot;
- for ( ; timeSlot < currentTimeSlot; timeSlot += FlowStat.INTERVAL) {
- int reqCnt = resourceStat.getTimeSlot(timeSlot).getCounter();
- if (reqCnt > 0) {
- noTraffic = false;
- break;
+ if (cleanResource) {
+ long currentTimeSlot = stat.currentTimeSlotId();
+ long startTimeSlot = currentTimeSlot - n;
+ for (Entry entry : stat.resourceStats.entrySet()) {
+ String resource = entry.getKey();
+ if (ResourceIdUtils.NODE_RESOURCE.equals(resource)) {
+ continue;
+ }
+ ResourceStat resourceStat = entry.getValue();
+ boolean noTraffic = true;
+ long timeSlot = startTimeSlot;
+ for (; timeSlot < currentTimeSlot; timeSlot += FlowStat.INTERVAL) {
+ int reqCnt = resourceStat.getTimeSlot(timeSlot).getCounter();
+ if (reqCnt > 0) {
+ noTraffic = false;
+ break;
+ }
+ }
+ if (noTraffic) {
+ stat.resourceStats.remove(resource);
+ log.info("HousekeepJob remove {}", resource);
}
- }
- if (noTraffic) {
- stat.resourceStats.remove(resource);
- log.info("HousekeepJob remove {}", resource);
}
}
@@ -644,7 +655,9 @@ public class FlowStat {
// curTimeSlotId);
ResourceStat resourceStat = entry.getValue();
- if (resourceStat.getConcurrentRequests().get() > 0) {
+ if (createTimeSlotOnlyTraffic && resourceStat.getConcurrentRequests().get() > 0) {
+ resourceStat.getTimeSlot(curTimeSlotId);
+ } else {
resourceStat.getTimeSlot(curTimeSlotId);
}
diff --git a/fizz-core/src/main/java/we/stats/circuitbreaker/CircuitBreaker.java b/fizz-core/src/main/java/we/stats/circuitbreaker/CircuitBreaker.java
index 3f96bf9..7e6a637 100644
--- a/fizz-core/src/main/java/we/stats/circuitbreaker/CircuitBreaker.java
+++ b/fizz-core/src/main/java/we/stats/circuitbreaker/CircuitBreaker.java
@@ -319,13 +319,13 @@ public class CircuitBreaker {
public boolean transit(State current, State target, long currentTimeWindow, FlowStat flowStat) {
if (stateRef.compareAndSet(current, target)) {
- stateStartTime = currentTimeWindow;
ResourceStat resourceStat = flowStat.getResourceStat(resource);
/*AtomicLong circuitBreakNum = resourceStat.getTimeSlot(currentTimeWindow).getCircuitBreakNum();
circuitBreakNum.set(0);*/
resourceStat.getTimeSlot(currentTimeWindow).setCircuitBreakNum(0);
resourceStat.updateCircuitBreakState(currentTimeWindow, current, target);
LOGGER.debug("transit {} current time window {} from {} which start at {} to {}", resource, currentTimeWindow, current, stateStartTime, target);
+ stateStartTime = currentTimeWindow;
return true;
}
return false;
diff --git a/fizz-core/src/test/java/we/stats/FlowStatTests.java b/fizz-core/src/test/java/we/stats/FlowStatTests.java
index 4cd07ee..238541b 100644
--- a/fizz-core/src/test/java/we/stats/FlowStatTests.java
+++ b/fizz-core/src/test/java/we/stats/FlowStatTests.java
@@ -39,7 +39,7 @@ import we.util.JacksonUtils;
*/
public class FlowStatTests {
- private FlowStat stat = new FlowStat();
+ private FlowStat stat = new FlowStat(false, false);
class FlowRuleCase {
public int threads = 3;
diff --git a/fizz-core/src/test/java/we/stats/circuitbreaker/CircuitBreakManagerTests.java b/fizz-core/src/test/java/we/stats/circuitbreaker/CircuitBreakManagerTests.java
index ffccdf9..4758b66 100644
--- a/fizz-core/src/test/java/we/stats/circuitbreaker/CircuitBreakManagerTests.java
+++ b/fizz-core/src/test/java/we/stats/circuitbreaker/CircuitBreakManagerTests.java
@@ -68,6 +68,8 @@ public class CircuitBreakManagerTests {
@Test
void permitTest() {
FlowStat flowStat = new FlowStat(circuitBreakManager);
+ flowStat.cleanResource = false;
+ flowStat.createTimeSlotOnlyTraffic = false;
long currentTimeWindow = flowStat.currentTimeSlotId();
MockServerHttpRequest mockServerHttpRequest = MockServerHttpRequest.get("/xxx").build();
diff --git a/fizz-plugin/pom.xml b/fizz-plugin/pom.xml
index d50b9d0..03dc127 100644
--- a/fizz-plugin/pom.xml
+++ b/fizz-plugin/pom.xml
@@ -5,7 +5,7 @@
fizz-gateway-community
com.fizzgate
- 2.6.2-beta1
+ 2.6.2
../pom.xml
4.0.0
diff --git a/fizz-spring-boot-starter/pom.xml b/fizz-spring-boot-starter/pom.xml
index 4ad928f..e3f5a22 100644
--- a/fizz-spring-boot-starter/pom.xml
+++ b/fizz-spring-boot-starter/pom.xml
@@ -5,7 +5,7 @@
fizz-gateway-community
com.fizzgate
- 2.6.2-beta1
+ 2.6.2
../pom.xml
4.0.0
diff --git a/pom.xml b/pom.xml
index e096f7f..f9177a0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
fizz-gateway-community
${project.artifactId}
fizz gateway community
- 2.6.2-beta1
+ 2.6.2
pom
fizz-common