-
Notifications
You must be signed in to change notification settings - Fork 336
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
获取配置中心时,会获取***_failover 文件,但实际是没有这个文件的,2.2.5版本才出现这个错误 #762
Comments
查看源码发现2.2.5之后才出现的这个报错,请问这个报错是有什么特殊含义吗,因为看起来这个报错没什么意义(也可能是我不理解) // GetFailover , get failover content
func GetFailover(key, dir string) string {
filePath := GetConfigFailOverContentFileName(key, dir)
return getFailOverConfig(filePath, ConfigContent)
}
func getFailOverConfig(filePath string, fileType ConfigCachedFileType) string {
if !file.IsExistFile(filePath) {
errMsg := fmt.Sprintf("read %s failed. cause file doesn't exist, file path: %s.", fileType, filePath)
logger.Error(errMsg)
return ""
}
logger.Warnf("reading failover %s from path:%s", fileType, filePath)
fileContent, err := os.ReadFile(filePath)
if err != nil {
logger.Errorf("fail to read failover %s from %s", fileType, filePath)
return ""
}
return string(fileContent)
} 2.2.5之前的代码不包括2.2.5 // GetFailover , get failover content
func GetFailover(key, dir string) string {
filePath := dir + string(os.PathSeparator) + key + constant.FAILOVER_FILE_SUFFIX
if !file.IsExistFile(filePath) {
return ""
}
logger.Warnf("reading failover content from path:%s", filePath)
fileContent, err := os.ReadFile(filePath)
if err != nil {
logger.Errorf("fail to read failover content from %s", filePath)
return ""
}
return string(fileContent)
} |
liuhengbo
changed the title
获取配置中心时,会获取***_failover 文件,但实际是没有这个文件的
获取配置中心时,会获取***_failover 文件,但实际是没有这个文件的,2.2.5版本才出现
Jun 15, 2024
liuhengbo
changed the title
获取配置中心时,会获取***_failover 文件,但实际是没有这个文件的,2.2.5版本才出现
获取配置中心时,会获取***_failover 文件,但实际是没有这个文件的,2.2.5版本才出现这个错误
Jun 15, 2024
我也遇到这个问题了,等一个解答!🤔 |
看起来可能是做了一次破坏性功能升级,或者是没有兼容一些情况,回退版本可以使用,确实是新版本有这个问题。 |
看起来是2.25版本这段加了一个日志打印, 之前版本没有这个打印 if !file.IsExistFile(filePath) {
errMsg := fmt.Sprintf("read %s failed. cause file doesn't exist, file path: %s.", fileType, filePath)
logger.Error(errMsg)
return ""
} |
我也遇到这个问题了,切到2.24无错误输出 |
同样遇到了这个问题 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
请教一下为什么会出现这个报错
go版本
go 1.21.1
包版本:
代码如下:
文件
实际写入的文件尾部没有 _failover
错误信息:
The text was updated successfully, but these errors were encountered: