[BUG] why thre are two same selector when register a new client
Bug
when i register a new client,there are two same selector data
and in database, there are two records
after debug, i find if using nacos as registration center, and deploy more than one admin instance(for example two). when i start a client and to register, both admin server receive nacos change event and start to register meta data as follow:
org.apache.shenyu.admin.service.impl.SelectorServiceImpl#registerDefault(org.apache.shenyu.register.common.dto.MetaDataRegisterDTO, java.lang.String, java.lang.String)
below code, both admin instance with not find selectorDO and will create two same selector data
String contextPath = ContextPathUtils.buildContextPath(dto.getContextPath(), dto.getAppName());
SelectorDO selectorDO = findByNameAndPluginName(contextPath, pluginName);
if (Objects.isNull(selectorDO)) {
SelectorDTO selectorDTO = SelectorUtil.buildSelectorDTO(contextPath, pluginMapper.selectByName(pluginName).getId());
selectorDTO.setHandle(selectorHandler);
return registerDefault(selectorDTO);
}
that cause lot of warn
AbstractRetryTask [shenyu-shared_wheel_timer-2] Failed to execute task:/o:divide,retried:1 ,total retries:-1,cause:nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2
version pls?
version pls?
2.5.0,a little bit old, but i see the newest code org.apache.shenyu.admin.service.register.AbstractShenyuClientRegisterServiceImpl#register may has the same problem if more than one shenyu admin instance receive meta data register nacos change event at the same time
version pls?
2.5.0,a little bit old, but i see the newest code
org.apache.shenyu.admin.service.register.AbstractShenyuClientRegisterServiceImpl#registermay has the same problem if more than one shenyu admin instance receive meta data register nacos change event at the same time
hi, if u have time to handle this problem, u can make a pr to resolve it. 😊