Beihao-Zhou commented on code in PR #2491:
URL: https://github.com/apache/kvrocks/pull/2491#discussion_r1720997437
##########
src/search/index_info.h:
##########
@@ -52,21 +53,28 @@ struct FieldInfo {
struct IndexInfo {
using FieldMap = std::map<std::string, FieldInfo>;
+ using MutexMap = std::map<std::string, std::mutex>;
Review Comment:
While trying to move the exact same piece of code into `IndexUpdater`s, I
encountered the following errors:
```
‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 =
const std::__cxx11::basic_string<char>; _T2 = std::mutex]’ is implicitly
deleted because the default definition would be ill-formed:
314 | constexpr pair(const pair&) = default; ///< Copy constructor
```
I suspect that this is caused by `IndexUpdater`s are usually created on
stacks, which causes `std::map` doing some underlying copies and deletions,
while `IndexInfo`s are allocated on heap so doesn't have the issue.
I tried to wrap `std::mutex` into a `unique_ptr` but the compiler will
report the same error.
I'm not quite sure what I can do at this point, may leave it as it is, and
try to benchmark first. But feel free to let me know if you think there is
anything I missed, or any workaround you can think of. @PragmaTwice <3
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]