-
Notifications
You must be signed in to change notification settings - Fork 302
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
HPCC-32845 Guard against KJ reading TLKs as regular index parts #19223
HPCC-32845 Guard against KJ reading TLKs as regular index parts #19223
Conversation
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-32845 Jirabot Action Result: |
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.
Does there need to be a similar check in index read?
Also, as discussed we want this to be able to error but continue.
aa52969
to
8b86f78
Compare
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.
one question/comment and one minor suggestion.
Happy to merge as is.
thorlcr/thorutil/thormisc.cpp
Outdated
part.getFilename(rfn); | ||
StringBuffer filename; | ||
rfn.getPath(filename); | ||
Owned<IKeyIndex> index = createKeyIndex(filename, 0, false, 0); |
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.
Is there any way of avoiding this on indexes that really do not have a TLK? Since we do not think this occurs in practice it can wait/maybe never be done.
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 think in practice all indexes > 1 part will/should have TLK since they are by def. created by Thor and default with buildLocalTlks default on.
It could workout that the group is N and this is N+1 so means it really is an index with a TLK - and only check then, but don't think it's worth it?
bool hasTLK(IDistributedFile &file, CActivityBase *activity) | ||
{ | ||
unsigned np = file.numParts(); | ||
IDistributedFilePart &part = file.queryPart(np-1); |
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.
minor: could move test from line 1718 earlier:
if (np [<]= 1)
return false;
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.
have made that change.
8b86f78
to
8a51134
Compare
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.
@jakesmith please squash and I will merge
@@ -159,9 +159,9 @@ class IndexWriteActivityMaster : public CMasterActivity | |||
checkFormatCrc(this, _f, helper->getFormatCrc(), nullptr, helper->getFormatCrc(), nullptr, true); |
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.
future: could add extra protection against user error:
if (!isFileKey(_f))
throw MakeActivityException(this, ENGINEERR_FILE_TYPE_MISMATCH, "Attempting to read flat file as an index: %s", indexFileName.get());
Check that the last part in an index/subindex is a TLK if the meta data is missing. Also remove some redundant 'delayed' functionality. Signed-off-by: Jake Smith <[email protected]>
f1ffb34
to
c415ffd
Compare
@ghalliday - squashed |
Jirabot Action Result: |
Also remove some redundant 'delayed' functionality.
Type of change:
Checklist:
Smoketest:
Testing: