-
Notifications
You must be signed in to change notification settings - Fork 308
HPCC-35022 CRoxieFileCache::lookupFile should allow concurrent lookups #20425
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
Conversation
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.
Pull Request Overview
This PR refactors the CRoxieFileCache::lookupFile method to allow concurrent lookups by changing the synchronization approach and separating file initialization from lookup. The change addresses performance bottlenecks in file access by allowing multiple threads to lookup files simultaneously while maintaining thread safety for initialization.
Key changes:
- Replaced global critical section with per-file initialization synchronization
- Added lazy initialization pattern for file objects
- Restructured lookupFile method to handle concurrent access scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
system/jlib/jhash.hpp | Added static mapToValue helper method for type-safe hash map value extraction |
roxie/ccd/ccdfile.cpp | Refactored CRoxieFileCache with concurrent lookup support, lazy initialization, and improved synchronization |
IArrayOf<IFile> sources; | ||
Owned<IFile> logical; | ||
Owned<IFileIO> current; | ||
Linked<IFileIO> current; |
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.
Changing from Owned<IFileIO>
to Linked<IFileIO>
affects ownership semantics. This change should be carefully reviewed to ensure proper resource management, as Linked<>
doesn't automatically manage object lifetime like Owned<>
does.
Linked<IFileIO> current; | |
Owned<IFileIO> current; |
Copilot uses AI. Check for mistakes.
CopyMappingStringToIInterface * map = (CopyMappingStringToIInterface *)_map; | ||
IInterface ** x = &map->getValue(); | ||
return x ? (C *)(BASE *)*x : NULL; |
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 C-style casts should be replaced with static_cast for better type safety. Additionally, taking the address of a temporary return value from getValue()
is undefined behavior if getValue()
returns by value.
Copilot uses AI. Check for mistakes.
roxie/ccd/ccdfile.cpp
Outdated
if (!resolved->initialised) | ||
{ | ||
initializeNewFileInstance(resolved, lfn, fileType, pdesc, remotePDesc, numParts, channel, startFileCopy, partNo, localLocation, dfsSize, dfsDate); | ||
//No possibility of a mistmatch if the entry has just been initialised => return immediately |
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 is a typo in the comment: 'mistmatch' should be 'mismatch'.
//No possibility of a mistmatch if the entry has just been initialised => return immediately | |
//No possibility of a mismatch if the entry has just been initialised => return immediately |
Copilot uses AI. Check for mistakes.
roxie/ccd/ccdfile.cpp
Outdated
if (!resolved) // May have been cleared above... | ||
continue; // try again |
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 infinite loop with for (;;)
and continue
statements could potentially create an endless loop if the file consistently fails to resolve. Consider adding a retry limit or timeout mechanism to prevent infinite loops.
Copilot uses AI. Check for mistakes.
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-35002 Jirabot Action Result: |
@ghalliday there's a typo in the Jira number. I was wondering why you reassigned my "not equal" filter terms issue, then saw a completely unrelated change. |
6510637
to
001ff08
Compare
Jira Issue: https://hpccsystems.atlassian.net//browse/HPCC-35022 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.
I am ok with all the changes.
Approved.
But add checkboxes |
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.
Second commit looks good.
Approved.
…s when adding files Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Jirabot Action Result: |
Type of change:
Checklist:
Smoketest:
Testing: