Operational Defect Database

BugZero found this defect 19 days ago.

MongoDB | 2672229

Remove unwanted copy of hash table

Last update date:

5/15/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

While testing a isMember call in the profiler, I spotted that SERVER-51537 changed the temp variable for a call to values() from being a reference to being a full type, leading to a deep copy of the hash table: } else if (arrTag == value::TypeTags::ArraySet) { + // An empty ArraySet may not have a collation, but we don't need one to definitively + // determine that the empty set doesn't contain the value we are checking. auto arrSet = value::getArraySetView(arrVal); - auto& values = arrSet->values(); - - const bool found = values.find({inputTag, inputVal}) != values.end(); - - return {false, value::TypeTags::Boolean, value::bitcastFrom(found)}; + if (arrSet->size() == 0) { + return {false, value::TypeTags::Boolean, value::bitcastFrom(false)}; + } + auto values = arrSet->values();

Top User Comments


Steps to Reproduce


Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

In Code Review

Learn More

Search:

...