-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[ISSUE#12994]Optimize config operation and capacity management. #13002
Changes from 7 commits
4ac2eba
046940e
745949c
08564eb
e854f8f
dfd421e
83b5957
789c353
3ad36a1
353c23c
3a57e4d
a1b8222
b3fd30b
e261fce
1abdaa8
eb7cfcc
02d71b8
5b9ed8d
d2afe08
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,9 +22,11 @@ | |
import com.alibaba.nacos.common.utils.MapUtil; | ||
import com.alibaba.nacos.common.utils.NumberUtils; | ||
import com.alibaba.nacos.common.utils.StringUtils; | ||
import com.alibaba.nacos.config.server.model.ConfigAllInfo; | ||
import com.alibaba.nacos.config.server.model.ConfigInfo; | ||
import com.alibaba.nacos.config.server.model.ConfigOperateResult; | ||
import com.alibaba.nacos.config.server.model.ConfigRequestInfo; | ||
import com.alibaba.nacos.config.server.model.SameConfigPolicy; | ||
import com.alibaba.nacos.config.server.model.event.ConfigDataChangeEvent; | ||
import com.alibaba.nacos.config.server.model.form.ConfigForm; | ||
import com.alibaba.nacos.config.server.model.gray.BetaGrayRule; | ||
|
@@ -293,13 +295,13 @@ private int getMaxGrayVersionCount() { | |
* Synchronously delete all pre-aggregation data under a dataId. | ||
*/ | ||
public Boolean deleteConfig(String dataId, String group, String namespaceId, String tag, String clientIp, | ||
String srcUser) { | ||
String srcUser, String srcType) { | ||
String persistEvent = ConfigTraceService.PERSISTENCE_EVENT; | ||
String grayName = ""; | ||
if (StringUtils.isBlank(tag)) { | ||
configInfoPersistService.removeConfigInfo(dataId, group, namespaceId, clientIp, srcUser); | ||
} else { | ||
persistEvent = ConfigTraceService.PERSISTENCE_EVENT_TAG + "-" + tag; | ||
persistEvent = ConfigTraceService.PERSISTENCE_EVENT_TAG + "_" + tag; | ||
grayName = TagGrayRule.TYPE_TAG + "_" + tag; | ||
configInfoGrayPersistService.removeConfigInfoGray(dataId, group, namespaceId, grayName, clientIp, srcUser); | ||
deleteConfigTagv1(dataId, group, namespaceId, tag, clientIp, srcUser); | ||
|
@@ -319,6 +321,36 @@ private void deleteConfigTagv1(String dataId, String group, String namespaceId, | |
configInfoTagPersistService.removeConfigInfoTag(dataId, group, namespaceId, tag, clientIp, srcUser); | ||
} | ||
} | ||
|
||
/** | ||
* Deletes configuration information based on the IDs list. | ||
*/ | ||
public Boolean deleteConfigs(List<Long> ids, String srcIp, String srcUser) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. deleteConfigs should check capacity , or can we split deleteConfigs operation to serval single deleteConfig operation in ConfigController? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we have already split batch operations on controllers, method deteConfigs should be removed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
List<ConfigAllInfo> configInfoList = configInfoPersistService.removeConfigInfoByIds(ids, srcIp, srcUser); | ||
if (configInfoList == null || configInfoList.isEmpty()) { | ||
return true; | ||
} | ||
|
||
Timestamp time = TimeUtils.getCurrentTime(); | ||
for (ConfigAllInfo configInfo : configInfoList) { | ||
ConfigChangePublisher.notifyConfigChange( | ||
new ConfigDataChangeEvent(configInfo.getDataId(), configInfo.getGroup(), configInfo.getTenant(), | ||
time.getTime())); | ||
ConfigTraceService.logPersistenceEvent(configInfo.getDataId(), configInfo.getGroup(), | ||
configInfo.getTenant(), null, time.getTime(), srcIp, ConfigTraceService.PERSISTENCE_EVENT, | ||
ConfigTraceService.PERSISTENCE_TYPE_REMOVE, null); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* Batch insert or update configuration information. | ||
*/ | ||
public Map<String, Object> batchInsertOrUpdate(List<ConfigAllInfo> configInfoList, String srcUser, String srcIp, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all batch operation invoked ConfigOperationService single operation interface, all aspects works at single config publish & delete interface of ConfigOperationService There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we have already split batch operations on controllers, method batchInsertOrUpdate should be removed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
Map<String, Object> configAdvanceInfo, SameConfigPolicy policy) throws NacosException { | ||
return configInfoPersistService.batchInsertOrUpdate(configInfoList, srcUser, srcIp, configAdvanceInfo, policy); | ||
} | ||
|
||
public Map<String, Object> getConfigAdvanceInfo(ConfigForm configForm) { | ||
Map<String, Object> configAdvanceInfo = new HashMap<>(10); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why changing split "-" to "_"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is when the deletion configuration method on the SDK side is changed to call the deletion method of ConfigOperationService. In order to maintain consistency with the original format on the SDK side, as shown in the following figure.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all right , if delete config using "" and publish config using "-", it will be more proper to change "" to "-" in delete config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done,Has been changed to "-".