-
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 #11890] Check instance existence before expiring its metadata #11932
Open
nkorange
wants to merge
3
commits into
alibaba:develop
Choose a base branch
from
nkorange:hotfix_metadata_lost_after_nacos_restart
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+107
−6
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
这3个方法建议放置到 Cleaner中,作为私有方法
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.
这几个方法只和metadataId的结构有关系,似乎应该放在生成metadataId的地方,并作为公共方法比较好?
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.
但是只有这里有需要使用, 我觉得还是放cleaner里作为私有方法, 如果以后真需要再改。
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.
问题是如果后面其他地方有需要用,比较难发现某个cleaner已经定义了一个私有方法?
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.
这个问题你放在这里也可能是一样的, 这个必须通过review才可以,如果你一定要单独处理,要不就放到一个工具类里。
我的意见是暂时没有必要, 如果后续有需要,再做抽象即可, 不要为了不存在的需求做所谓的优化。
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.
为啥生成metadataID的方法是在这个类,解析metadataID又要放在别的类呢?这个metadataID本来就算是InstancePublishInfo的一个属性。
当我们有解析metadataID的需求的时候,我觉得很自然会去找到生成metadataID的类去看metadataID的结构,所以这3个方法放在这个类也是很合理的。
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.
因为只有你这个地方要解析, 没有别的地方要解析, 说白了要解析是你这个地方的特殊逻辑,当然要以私有方法方式支持。
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.
要不然你就把所有metadataID的相关操作,都封装到一个工具类里面。
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.
说白了, 现在这个PR只是为了修复这个问题的临时手段, 在临时手段中允许暂时的去解析metadataID,获取对应的数据,先修复问题,不考虑性能和处理手段,长期必须要合理处理这个机制,可能根本就不用去解析metadataId。
所以现在就应该把metadataID的解析工作,收敛到这个特殊的修复逻辑中, 不能发散成为一个通用手段。除非以后确定metadataID需要被拆分解析,如果到了那一步, 我反而倾向吧metadataID变为一个Object,而不是简单的字符串。