usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From toddn...@apache.org
Subject usergrid git commit: Adds trace logging for debugging purposes to diagnose issue
Date Wed, 21 Oct 2015 16:19:31 GMT
Repository: usergrid
Updated Branches:
  refs/heads/USERGRID-1052 [created] c417099d6


Adds trace logging for debugging purposes to diagnose issue


Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/c417099d
Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/c417099d
Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/c417099d

Branch: refs/heads/USERGRID-1052
Commit: c417099d6260163ad391c76162b673efb861bf3a
Parents: a09485a
Author: Todd Nine <tnine@apigee.com>
Authored: Wed Oct 21 10:19:28 2015 -0600
Committer: Todd Nine <tnine@apigee.com>
Committed: Wed Oct 21 10:19:28 2015 -0600

----------------------------------------------------------------------
 .../corepersistence/index/IndexServiceImpl.java |  3 +-
 .../core/astyanax/MultiRowColumnIterator.java   | 46 +++++++-------------
 .../shard/impl/ShardGroupColumnIterator.java    | 11 +++++
 .../impl/shard/impl/ShardsColumnIterator.java   | 10 +++++
 4 files changed, 38 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid/blob/c417099d/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
index d160aac..ccb6221 100644
--- a/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
+++ b/stack/core/src/main/java/org/apache/usergrid/corepersistence/index/IndexServiceImpl.java
@@ -204,8 +204,9 @@ public class IndexServiceImpl implements IndexService {
 
         //If we get no search results, its possible that something was already deleted or
         //that it wasn't indexed yet. In either case we can't delete anything and return
an empty observable..
-        if(crs.isEmpty())
+        if(crs.isEmpty()) {
             return Observable.empty();
+        }
 
         UUID timeUUID = UUIDUtils.isTimeBased(entityId.getUuid()) ? entityId.getUuid() :
UUIDUtils.newTimeUUID();
         //not actually sure about the timestamp but ah well. works.

http://git-wip-us.apache.org/repos/asf/usergrid/blob/c417099d/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java
b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java
index 667992c..c6c1a12 100644
--- a/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java
+++ b/stack/corepersistence/common/src/main/java/org/apache/usergrid/persistence/core/astyanax/MultiRowColumnIterator.java
@@ -50,7 +50,7 @@ import com.netflix.astyanax.util.RangeBuilder;
  */
 public class MultiRowColumnIterator<R, C, T> implements Iterator<T> {
 
-    private static final Logger LOG = LoggerFactory.getLogger( MultiRowColumnIterator.class
);
+    private static final Logger logger = LoggerFactory.getLogger( MultiRowColumnIterator.class
);
 
     private final int pageSize;
 
@@ -148,6 +148,9 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T>
{
 
     public void advance() {
 
+
+        logger.trace( "Advancing multi row column iterator" );
+
         /**
          * If the edge is present, we need to being seeking from this
          */
@@ -156,7 +159,6 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T>
{
 
 
 
-        //TODO, finalize why this isn't working as expected
         final int selectSize = skipFirstColumn ? pageSize + 1 : pageSize;
 
         final RangeBuilder rangeBuilder = new RangeBuilder();
@@ -174,6 +176,7 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T>
{
 
         rangeBuilder.setLimit( selectSize );
 
+        logger.trace( "Executing cassandra query" );
 
         /**
          * Get our list of slices
@@ -242,7 +245,7 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T>
{
 
         currentColumnIterator = mergedResults.iterator();
 
-        LOG.trace( "Finished parsing {} rows for results", rowKeys.size() );
+        logger.trace( "Finished parsing {} rows for results", rowKeys.size() );
     }
 
 
@@ -275,6 +278,7 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T>
{
      */
     private List<T> singleRowResult( final Rows<R, C> result ) {
 
+        logger.trace( "Only a single row has columns.  Parsing directly" );
 
         for ( R key : result.getKeys() ) {
             final ColumnList<C> columnList = result.getRow( key ).getColumns();
@@ -307,6 +311,8 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T>
{
      */
     private List<T> mergeResults( final Rows<R, C> result, final int maxSize
) {
 
+        logger.trace( "Multiple rows have columns.  Merging" );
+
 
         final List<T> mergedResults = new ArrayList<>(maxSize);
 
@@ -354,50 +360,28 @@ public class MultiRowColumnIterator<R, C, T> implements Iterator<T>
{
                     continue;
                 }
 
+                logger.trace( "Adding value {} to merged set at index {}", returnedValue,
insertIndex );
+
                 mergedResults.add( insertIndex, returnedValue );
 
 
                 //prune the mergedResults
                 while ( mergedResults.size() > maxSize ) {
+
+                    logger.trace( "Trimming results to size {}", maxSize );
+
                     //just remove from our tail until the size falls to the correct value
                     mergedResults.remove(mergedResults.size()-1);
                 }
             }
 
-            LOG.trace( "Candidate result set size is {}", mergedResults.size() );
+            logger.trace( "Candidate result set size is {}", mergedResults.size() );
 
         }
         return mergedResults;
     }
 
 
-    /**
-     * Iterator wrapper that parses as it iterates for single row cases
-     */
-    private class SingleRowIterator implements Iterator<T> {
-
-        private Iterator<Column<C>> columnIterator;
-
-        private SingleRowIterator (final ColumnList<C> columns){
-            this.columnIterator = columns.iterator();
-        }
-        @Override
-        public boolean hasNext() {
-            return columnIterator.hasNext();
-        }
-
-
-        @Override
-        public T next() {
-            return columnParser.parseColumn( columnIterator.next() );
-        }
-
-
-        @Override
-        public void remove() {
-          throw new UnsupportedOperationException( "Unable to remove single row" );
-        }
-    }
 }
 
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/c417099d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupColumnIterator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupColumnIterator.java
b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupColumnIterator.java
index 8779b96..a794a16 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupColumnIterator.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardGroupColumnIterator.java
@@ -28,6 +28,9 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.usergrid.persistence.core.astyanax.ColumnNameIterator;
 import org.apache.usergrid.persistence.core.astyanax.MultiKeyColumnNameIterator;
 import org.apache.usergrid.persistence.core.astyanax.MultiTennantColumnFamily;
@@ -51,6 +54,8 @@ import com.netflix.astyanax.util.RangeBuilder;
 public abstract class ShardGroupColumnIterator<T> implements Iterator<T> {
 
 
+    private static final Logger logger = LoggerFactory.getLogger( ShardGroupColumnIterator.class
);
+
     private final Iterator<ShardEntryGroup> entryGroupIterator;
     private Iterator<T> elements;
 
@@ -108,21 +113,27 @@ public abstract class ShardGroupColumnIterator<T> implements Iterator<T>
{
 
     public boolean advance(){
 
+        logger.trace( "Advancing from shard entry group iterator" );
+
         while(entryGroupIterator.hasNext()){
 
             final ShardEntryGroup group = entryGroupIterator.next();
 
+            logger.trace( "Shard entry group is {}.  Searching for edges in the shard", group
);
+
             elements = getIterator( group.getReadShards() );
 
             /**
              * We're done, we have some columns to return
              */
             if(elements.hasNext()){
+                logger.trace( "Found edges in shard entry group {}", group );
                 return true;
             }
 
         }
 
+        logger.trace( "Completed iterating shard group iterator" );
 
         return false;
 

http://git-wip-us.apache.org/repos/asf/usergrid/blob/c417099d/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
index e35107c..4411c25 100644
--- a/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
+++ b/stack/corepersistence/graph/src/main/java/org/apache/usergrid/persistence/graph/serialization/impl/shard/impl/ShardsColumnIterator.java
@@ -6,6 +6,9 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.apache.usergrid.persistence.core.astyanax.ColumnNameIterator;
 import org.apache.usergrid.persistence.core.astyanax.MultiKeyColumnNameIterator;
 import org.apache.usergrid.persistence.core.astyanax.MultiRowColumnIterator;
@@ -28,6 +31,9 @@ import com.netflix.astyanax.util.RangeBuilder;
  */
 public class ShardsColumnIterator<R, C, T> implements Iterator<T> {
 
+
+    private static final Logger logger = LoggerFactory.getLogger( ShardsColumnIterator.class
);
+
     private final EdgeSearcher<R, C, T> searcher;
 
     private final MultiTennantColumnFamily<ScopedRowKey<R>, C> cf;
@@ -87,6 +93,8 @@ public class ShardsColumnIterator<R, C, T> implements Iterator<T>
{
      */
     private void startIterator() {
 
+        logger.trace( "Starting shards column iterator" );
+
 
         /**
          * If the edge is present, we need to being seeking from this
@@ -105,6 +113,8 @@ public class ShardsColumnIterator<R, C, T> implements Iterator<T>
{
          */
         final List<ScopedRowKey<R>> rowKeys = searcher.getRowKeys();
 
+        logger.trace( "Searching with row keys {}", rowKeys );
+
         currentColumnIterator = new MultiRowColumnIterator<>( keyspace, cf,  consistencyLevel,
searcher, searcher, searcher.getComparator(), rowKeys, pageSize);
 
 


Mime
View raw message