Github user JamesRTaylor commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/37#discussion_r24786114
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java ---
    @@ -488,7 +490,55 @@ public void rollback(PhoenixConnection connection) 
throws SQLException {
             numRows = 0;
         }
         
    +    private Set<Integer> getOrderOfUncommittedStatements() {
    +           Set<Integer> result = newHashSet();
    +           for (Map<ImmutableBytesPtr, RowMutationState> rowMutations : 
mutations.values()) {
    +                   for (RowMutationState rowMutationState : 
rowMutations.values()) {
    +                           
result.addAll(rowMutationState.getOrderOfStatementsInConnection());
    +                   }
    +           }
    +           return result;
    +    }
    +    
         @Override
         public void close() throws SQLException {
         }
    +    
    +    public static class RowMutationState {
    +           private Map<PColumn,byte[]> columnValues;
    +           private Set<Integer> orderOfStatementsInConnection;
    --- End diff --
    
    I'm somewhat worried about the memory bloat of adding another Set object 
here. An alternative would be a long[] that acts as a bit set where any set bit 
represents the statement index. It's unlikely that there'd be more than 64 
statements in a commit, but if there were, you could always re-allocate the 
long[]. You could then materialize the set of statement indexes from it. 
    
    Another more flexible alternative would be to make RowMutationState an 
interface and have a SingleStatementRowMutationState that has a single int 
index member variable (likely the common case). Then, add a join method that 
returns a new MultiRowMutationState with a long as a bitset and maybe one more 
with a long[] as a bitset.


---
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