Github user chiastic-security commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/118#discussion_r41122346
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/schema/PMetaDataImpl.java ---
    @@ -160,7 +160,7 @@ public PMetaDataCache cloneMinusOverage(long overage) {
                         newCache.put(tableRef.table.getKey(), new 
PTableRef(tableRef));
                         toRemove.add(tableRef);
                         toRemoveBytes += tableRef.estSize;
    -                    if (toRemoveBytes - toRemove.peekLast().estSize > 
overage) {
    +                    while (toRemoveBytes - toRemove.peekLast().estSize >= 
overage) {
    --- End diff --
    
    I've added a couple more tests.
    
    The `cloneMinusOverage()` method does sometimes need to clear everything 
out, because it's what happens prior to adding the new thing, so it's correct 
for it not to break out of the loop when the size is one. I've added a test to 
confirm this (`shouldAlwaysKeepAtLeastOneEntryEvenIfTooLarge()`).
    
    I've also added a test to check things work out OK when the max size is 
zero. In this case there should always be exactly one thing in the cache (after 
the first item has been added). This test also passes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to