Alexey Serbin has posted comments on this change. ( http://gerrit.cloudera.org:8080/20607 )
Change subject: KUDU-613: Introduce SLRU cache ...................................................................... Patch Set 16: (10 comments) http://gerrit.cloudera.org:8080/#/c/20607/16/src/kudu/util/slru_cache.cc File src/kudu/util/slru_cache.cc: http://gerrit.cloudera.org:8080/#/c/20607/16/src/kudu/util/slru_cache.cc@254 PS16, Line 254: e = table_.Lookup(key, hash); What guarantees do we have to be sure that 'table_' cannot be modified under the hood by concurrently running SLRUCacheShard::Insert()? It would be great to add a note about that. http://gerrit.cloudera.org:8080/#/c/20607/16/src/kudu/util/slru_cache.cc@267 PS16, Line 267: e = table_.Lookup(key, hash); ditto: what if Insert() is running concurrently and modifying the 'table_' -- what protects us from such concurrency issues? Would be great to add a note in the code. http://gerrit.cloudera.org:8080/#/c/20607/17/src/kudu/util/slru_cache.cc File src/kudu/util/slru_cache.cc: http://gerrit.cloudera.org:8080/#/c/20607/17/src/kudu/util/slru_cache.cc@273 PS17, Line 273: bool last_reference = Unref(e); : if (last_reference) { nit: could these be joined, adding a comment on what's the intention of this code? http://gerrit.cloudera.org:8080/#/c/20607/17/src/kudu/util/slru_cache.cc@471 PS17, Line 471: { What is the purpose of this extra scope? http://gerrit.cloudera.org:8080/#/c/20607/17/src/kudu/util/slru_cache.cc@501 PS17, Line 501: { What is the purpose of this extra scope? http://gerrit.cloudera.org:8080/#/c/20607/17/src/kudu/util/slru_cache.cc@552 PS17, Line 552: { What is the purpose of this extra scope? http://gerrit.cloudera.org:8080/#/c/20607/17/src/kudu/util/slru_cache.cc@561 PS17, Line 561: { What is the purpose of this extra scope? http://gerrit.cloudera.org:8080/#/c/20607/17/src/kudu/util/slru_cache.cc@581 PS17, Line 581: nit: http://gerrit.cloudera.org:8080/#/c/20607/17/src/kudu/util/slru_cache.cc@601 PS17, Line 601: // Similar to STLDeleteElements(). : auto begin = shards_.begin(); : while (begin != shards_.end()) { : auto temp = begin; : ++begin; : temp->reset(nullptr); : } Is this really needed? Wouldn't the contained unique_ptr be destroyed automatically upon the destruction of the containing vector? http://gerrit.cloudera.org:8080/#/c/20607/17/src/kudu/util/slru_cache.cc@694 PS17, Line 694: uint8_t* data = reinterpret_cast<uint8_t*>(h); : delete [] data; nit: could these lines be joined? -- To view, visit http://gerrit.cloudera.org:8080/20607 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: kudu Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I45531534a2049dd38c002f4dc7982df9fd46e0bb Gerrit-Change-Number: 20607 Gerrit-PatchSet: 16 Gerrit-Owner: Mahesh Reddy <mre...@cloudera.com> Gerrit-Reviewer: Abhishek Chennaka <achenn...@cloudera.com> Gerrit-Reviewer: Alexey Serbin <ale...@apache.org> Gerrit-Reviewer: Attila Bukor <abu...@apache.org> Gerrit-Reviewer: Kudu Jenkins (120) Gerrit-Reviewer: Mahesh Reddy <mre...@cloudera.com> Gerrit-Reviewer: Marton Greber <greber...@gmail.com> Gerrit-Reviewer: Tidy Bot (241) Gerrit-Comment-Date: Fri, 10 May 2024 21:33:01 +0000 Gerrit-HasComments: Yes