-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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. #13002
base: develop
Are you sure you want to change the base?
Changes from all commits
4ac2eba
046940e
745949c
08564eb
e854f8f
dfd421e
83b5957
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) { | ||
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 |
||
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.
deleteConfigs should check capacity , or can we split deleteConfigs operation to serval single deleteConfig operation in ConfigController?