-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
rebuild index for new prop #3332
Conversation
Thx for contribution, does this PR origin from https://discuss.nebula-graph.com.cn/t/topic/6376? |
Yes |
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.
I have a suggestion to fix this issue:
- Perhaps don't modify the
RowReader
orRowReaderWrapper
, becauseRowReader
is bound to a specific schema by design, and thesetLatestSchema
method will introduce meny problem. (e.g. read from an old schema by latest schema will have undefined behaviors) - To fix this issue, when we call
reader->getValueByName
inIndexKeyUtils::collectIndexValues
, we will returnNullType::UNKNOWN_PROP
for a not existed property in old schema (see line 55 inRowReaderV2.cpp
). When you find the value is unknown, we can use latest schema to check if it is nullable or has default value:- return error when it isn't nullable and does not have default value
- or use the predefined value to build the index
1.The scheme used to read data is the schema included in the row data instead of the latest schema. The latest schema is only used in IndexKeyUtils::collectIndexValues when the schema included in the data is different from the latest schema. Besides, since the index will be deleted when the associated prop is deleted, I'm not very sure what problem will be introduced. 2.In this case, a new parameters named latestSchema need to be added in IndexKeyUtils::collectIndexValues and everywhere call this function need to modify as well. Of course, that's OK. |
By the way, I wonder how to call pre-commit by my-self before commit... |
You mean the lint failed? We need to do the |
Perhaps I didn't clarify very clearly. The reason I don't suggest to add As for |
That's OK. The point is to avoid call getLatestSchem lots of time. |
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.
Good job, only one thing to check, please see the inline comments.
PS: some lint failed, please fix them according to https://github.com/vesoft-inc/nebula/runs/4319257516?check_suite_focus=true
src/common/utils/IndexKeyUtils.cpp
Outdated
const std::string propName, | ||
const meta::SchemaProviderIf* latestSchema) { | ||
auto value = reader->getValueByName(propName); | ||
if (latestSchema == nullptr |
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.
The condition NullType::NULL is handled by IndexKeyUtils::checkValue
. Maybe I don't need to handle it in function readValueWithLatestSche
.
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.
I mean if the value in RowReader is the NullType::NULL
, we should directly return it. What do you think?
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.
Ah, my bad, I see the point here (when != UNKNOWN_PROP
will return the value). Never mind.
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.
LGTM now. Thanks a lot.
Em.. the code format failed again. You could try to read the conduct |
Thx, I will try it |
Hi @yixinglu , when I run make fmt in tests directory. The result is
A lot of files have been reformatted. And the change is like follows :
However, it is failed to reformat index.feature. The error is :
I also run |
You probably need to rebase onto latest master, which will works fine. |
I have been rebased the latest master while produce the same results. Fortunately, formatting is successful in docker... |
LGTM and please deal with the conflict. |
That's OK. I have been resolved the conflict in my machine. However, I can not upgrade to third-party 3.0 to compile the code. The information is here #3462 (comment) |
Can you push your code, then try to compile it by CI of repo first. 😂 |
What type of PR is this?
What does this PR do?
rebuild tag index with old schema version value
Which issue(s)/PR(s) this PR relates to?
#3274 (reference)
Special notes for your reviewer, ex. impact of this fix, etc:
Additional context:
Checklist:
Release notes:
Please confirm whether to reflect in release notes and how to describe: