accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <...@git.apache.org>
Subject [GitHub] accumulo pull request #229: ACCUMULO-4597 fixed bug in rfile-info
Date Tue, 07 Mar 2017 23:26:16 GMT
Github user keith-turner commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/229#discussion_r104807544
  
    --- Diff: core/src/main/java/org/apache/accumulo/core/file/rfile/RFile.java ---
    @@ -1015,14 +1018,23 @@ public void init(SortedKeyValueIterator<Key,Value> source,
Map<String,String> op
     
         }
     
    +    /**
    +     * @return map of locality group names to column families. The default locality group
will have {@code null} for a name. RFile will only track up to
    +     *         {@value Writer#MAX_CF_IN_DLG} families for the default locality group.
After this it will stop tracking. For the case where the default group has
    +     *         more thn {@value Writer#MAX_CF_IN_DLG} families an empty list of families
is returned.
    +     * @see LocalityGroupUtil#seek(Reader, Range, String, Map)
    +     */
         public Map<String,ArrayList<ByteSequence>> getLocalityGroupCF() {
           Map<String,ArrayList<ByteSequence>> cf = new HashMap<>();
     
           for (LocalityGroupMetadata lcg : localityGroups) {
    -        ArrayList<ByteSequence> setCF = new ArrayList<>();
    +        ArrayList<ByteSequence> setCF;
     
    -        for (Entry<ByteSequence,MutableLong> entry : lcg.columnFamilies.entrySet())
{
    -          setCF.add(entry.getKey());
    +        if (lcg.columnFamilies == null) {
    +          Preconditions.checkState(lcg.isDefaultLG, " Group %s has null families. Only
expect default locality group to have null families.", lcg.name);
    --- End diff --
    
    You can thank findbugs for the message.  I had some different code that accomplished the
same thing and made findbugs unhappy.  So I changed it to this to soothe findbugs.  I don't
expect this case to happen, and if it does I would have been happy with an NPE.  There are
many places that could have an NPE when there is a bug, we don't handle them all with detailed
error messages.
    
    Findbugs has found some nasty bugs.   The false positives can be a little annoying, but
I think its worth it.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message