Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release history cleaning function #4813

Merged
merged 91 commits into from
Mar 27, 2023
Merged

Conversation

klboke
Copy link
Contributor

@klboke klboke commented Mar 24, 2023

What's the purpose of this PR

  • Add release history cleaning function
  • You can use the apollo.release-history.retention.size configuration to set the global retention time for release history, or use the apollo.release-history.retention.size.override configuration to finely control the number of release history for each appId+clusterName+namespaceName+branchName.

Which issue(s) this PR fixes:

Fixes #3208

klboke and others added 30 commits May 16, 2019 11:07
@klboke klboke requested a review from nobodyiam March 24, 2023 08:51
@codecov
Copy link

codecov bot commented Mar 24, 2023

Codecov Report

Merging #4813 (0743f96) into master (5b85b42) will increase coverage by 0.37%.
The diff coverage is 75.60%.

@@             Coverage Diff              @@
##             master    #4813      +/-   ##
============================================
+ Coverage     47.89%   48.26%   +0.37%     
- Complexity     1701     1722      +21     
============================================
  Files           346      346              
  Lines         10697    10778      +81     
  Branches       1066     1075       +9     
============================================
+ Hits           5123     5202      +79     
+ Misses         5258     5254       -4     
- Partials        316      322       +6     
Impacted Files Coverage Δ
...work/apollo/biz/service/ReleaseHistoryService.java 76.84% <70.58%> (-16.02%) ⬇️
...m/ctrip/framework/apollo/biz/config/BizConfig.java 48.57% <100.00%> (+12.85%) ⬆️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -42,4 +44,9 @@ Page<ReleaseHistory> findByAppIdAndClusterNameAndNamespaceNameOrderByIdDesc(Stri
@Query("update ReleaseHistory set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?4 where AppId=?1 and ClusterName=?2 and NamespaceName = ?3 and IsDeleted = false")
int batchDelete(String appId, String clusterName, String namespaceName, String operator);

@Query(value = "select Id from ReleaseHistory where AppId=?1 and ClusterName=?2 and NamespaceName = ?3 and BranchName = ?4 and IsDeleted = false order by Id desc Limit 1 offset ?5", nativeQuery = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need to use native query here as it may not work well with other databases. I can see the limit offset setup but I suppose it could be replaced with Pageable?

Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nobodyiam nobodyiam merged commit 8344788 into apolloconfig:master Mar 27, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2023
@nobodyiam nobodyiam added this to the 2.2.0 milestone Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release表清理策略
3 participants