You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/03/14 14:43:10 UTC

[3/7] ignite git commit: Merge master into ignite-3477

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index b0e7956,46fbb9e..a3e492a
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@@ -55,8 -56,10 +56,9 @@@ import java.util.concurrent.atomic.Atom
  import javax.cache.Cache;
  import javax.cache.CacheException;
  import org.apache.ignite.IgniteCheckedException;
+ import org.apache.ignite.IgniteDataStreamer;
  import org.apache.ignite.IgniteException;
  import org.apache.ignite.IgniteLogger;
 -import org.apache.ignite.cache.CacheMemoryMode;
  import org.apache.ignite.cache.query.QueryCancelledException;
  import org.apache.ignite.cache.query.QueryCursor;
  import org.apache.ignite.cache.query.SqlFieldsQuery;
@@@ -75,17 -78,14 +77,20 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
  import org.apache.ignite.internal.processors.cache.GridCacheAffinityManager;
  import org.apache.ignite.internal.processors.cache.GridCacheContext;
+ import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 -import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 +import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
 +import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
 +import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 +import org.apache.ignite.internal.processors.cache.KeyCacheObject;
  import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
 +import org.apache.ignite.internal.processors.cache.database.CacheDataRow;
 +import org.apache.ignite.internal.processors.cache.database.tree.io.PageIO;
  import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
  import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
  import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
 +import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+ import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
+ import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
  import org.apache.ignite.internal.processors.query.GridQueryCancel;
  import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
  import org.apache.ignite.internal.processors.query.GridQueryFieldsResult;
@@@ -95,13 -95,7 +100,14 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.query.GridQueryProperty;
  import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
  import org.apache.ignite.internal.processors.query.IgniteSQLException;
+ import org.apache.ignite.internal.processors.query.h2.opt.DistributedJoinMode;
 +import org.apache.ignite.internal.processors.query.h2.database.H2PkHashIndex;
 +import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
 +import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
 +import org.apache.ignite.internal.processors.query.h2.database.io.H2ExtrasInnerIO;
 +import org.apache.ignite.internal.processors.query.h2.database.io.H2ExtrasLeafIO;
 +import org.apache.ignite.internal.processors.query.h2.database.io.H2InnerIO;
 +import org.apache.ignite.internal.processors.query.h2.database.io.H2LeafIO;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2DefaultTableEngine;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOffheap;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2KeyValueRowOnheap;
@@@ -146,9 -140,9 +152,10 @@@ import org.h2.api.ErrorCode
  import org.h2.api.JavaObjectSerializer;
  import org.h2.command.CommandInterface;
  import org.h2.command.Prepared;
+ import org.h2.command.dml.Insert;
  import org.h2.engine.Session;
  import org.h2.engine.SysProperties;
 +import org.h2.index.Cursor;
  import org.h2.index.Index;
  import org.h2.index.SpatialIndex;
  import org.h2.jdbc.JdbcConnection;
@@@ -211,16 -211,6 +224,16 @@@ import static org.apache.ignite.interna
   */
  @SuppressWarnings({"UnnecessaryFullyQualifiedName", "NonFinalStaticVariableUsedInClassInitialization"})
  public class IgniteH2Indexing implements GridQueryIndexing {
 +
 +    /**
 +     * Register IO for indexes.
 +     */
 +    static {
 +        PageIO.registerH2(H2InnerIO.VERSIONS, H2LeafIO.VERSIONS);
 +        H2ExtrasInnerIO.register();
 +        H2ExtrasLeafIO.register();
 +    }
-     
++
      /** Default DB options. */
      private static final String DB_OPTIONS = ";LOCK_MODE=3;MULTI_THREADED=1;DB_CLOSE_ON_EXIT=FALSE" +
          ";DEFAULT_LOCK_TIMEOUT=10000;FUNCTIONS_IN_SCHEMA=true;OPTIMIZE_REUSE_RESULTS=0;QUERY_CACHE_SIZE=0" +

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
index ea7173c,fc5eb4b..00db055
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2IndexBase.java
@@@ -478,7 -486,7 +503,7 @@@ public abstract class GridH2IndexBase e
  
                      assert !msg.bounds().isEmpty() : "empty bounds";
  
-                     src = new RangeSource(msg.bounds(), snapshotTree, qctx.filter());
 -                    src = new RangeSource(msg.bounds(), msg.segment(), snapshot0, qctx.filter());
++                    src = new RangeSource(msg.bounds(), msg.segment(), snapshotTree, qctx.filter());
                  }
                  else {
                      // This is request to fetch next portion of data.
@@@ -514,9 -520,11 +539,9 @@@
                  }
                  else if (msg.bounds() == null) {
                      // Drop saved source.
-                     qctx.putSource(node.id(), msg.batchLookupId(), null);
+                     qctx.putSource(node.id(), msg.segment(), msg.batchLookupId(), null);
                  }
  
 -                assert !ranges.isEmpty();
 -
                  res.ranges(ranges);
                  res.status(STATUS_OK);
              }
@@@ -1377,14 -1519,17 +1536,17 @@@
          int curRangeId = -1;
  
          /** */
 -        Iterator<GridH2Row> curRange = emptyIterator();
 -
 -        /** */
 -        final ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> tree;
 +        final IgniteTree tree;
  
          /** */
+         private final int segment;
+ 
+         /** */
          final IndexingQueryFilter filter;
  
 +        /** Iterator. */
 +        Iterator<GridH2Row> iter = emptyIterator();
 +
          /**
           * @param bounds Bounds.
           * @param tree Snapshot.
@@@ -1392,9 -1537,11 +1554,11 @@@
           */
          RangeSource(
              Iterable<GridH2RowRangeBounds> bounds,
+             int segment,
 -            ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> tree,
 +            IgniteTree tree,
              IndexingQueryFilter filter
          ) {
+             this.segment = segment;
              this.filter = filter;
              this.tree = tree;
              boundsIter = bounds.iterator();
@@@ -1452,11 -1599,11 +1616,11 @@@
                  SearchRow first = toSearchRow(bounds.first());
                  SearchRow last = toSearchRow(bounds.last());
  
-                 IgniteTree t = tree != null ? tree : treeForRead();
 -                ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> t = tree != null ? tree : treeForRead(segment);
++                IgniteTree t = tree != null ? tree : treeForRead(segment);
  
 -                curRange = doFind0(t, first, true, last, filter);
 +                iter = new CursorIteratorWrapper(doFind0(t, first, true, last, filter));
  
 -                if (!curRange.hasNext()) {
 +                if (!iter.hasNext()) {
                      // We have to return empty range here.
                      GridH2RowRange emptyRange = new GridH2RowRange();
  
@@@ -1469,9 -1616,10 +1633,10 @@@
      }
  
      /**
-      * @return Snapshot for current thread if there is one.
+      * @param segment Segment Id.
+      * @return Snapshot for requested segment if there is one.
       */
-     protected <K, V> IgniteTree<K, V> treeForRead() {
 -    protected ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> treeForRead(int segment) {
++    protected <K, V> IgniteTree<K, V> treeForRead(int segment) {
          throw new UnsupportedOperationException();
      }
  
@@@ -1555,97 -1700,5 +1721,97 @@@
  
              return fltr.apply(key, val);
          }
 +
 +        /** {@inheritDoc} */
 +        @Override public boolean next() throws IgniteCheckedException {
 +            next = null;
 +
 +            while (cursor.next()) {
 +                GridH2Row t = cursor.get();
 +
 +                if (accept(t)) {
 +                    next = t;
 +                    return true;
 +                }
 +            }
 +
 +            return false;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public GridH2Row get() throws IgniteCheckedException {
 +            if (next == null)
 +                throw new NoSuchElementException();
 +
 +            return next;
 +        }
      }
 +
 +    /**
 +     *
 +     */
 +    private static final class CursorIteratorWrapper implements Iterator<GridH2Row> {
 +        /** */
 +        private final GridCursor<GridH2Row> cursor;
 +
 +        /** Next element. */
 +        private GridH2Row next;
 +
 +        /**
 +         * @param cursor Cursor.
 +         */
 +        private CursorIteratorWrapper(GridCursor<GridH2Row> cursor) {
 +            assert cursor != null;
 +
 +            this.cursor = cursor;
 +
 +            try {
 +                if (cursor.next())
 +                    next = cursor.get();
 +            }
 +            catch (IgniteCheckedException e) {
 +                throw U.convertException(e);
 +            }
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public boolean hasNext() {
 +            return next != null;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public GridH2Row next() {
 +            try {
 +                GridH2Row res = next;
 +
 +                if (cursor.next())
 +                    next = cursor.get();
 +                else
 +                    next = null;
 +
 +                return res;
 +            }
 +            catch (IgniteCheckedException e) {
 +                throw U.convertException(e);
 +            }
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public void remove() {
 +            throw new UnsupportedOperationException("operation is not supported");
 +        }
 +    }
 +
 +    /** Empty cursor. */
 +    protected static final GridCursor<GridH2Row> EMPTY_CURSOR = new GridCursor<GridH2Row>() {
 +        /** {@inheritDoc} */
 +        @Override public boolean next() {
 +            return false;
 +        }
 +
 +        /** {@inheritDoc} */
 +        @Override public GridH2Row get() {
 +            return null;
 +        }
 +    };
- }
+ }

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2RowDescriptor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
index 3cdc095,4d5ea4b..743f77a
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2Table.java
@@@ -31,24 -31,11 +31,19 @@@ import java.util.concurrent.locks.Reent
  import org.apache.ignite.IgniteCheckedException;
  import org.apache.ignite.IgniteInterruptedException;
  import org.apache.ignite.internal.processors.cache.CacheObject;
 +import org.apache.ignite.internal.processors.cache.GridCacheContext;
 +import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 +import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 +import org.apache.ignite.internal.processors.query.h2.database.H2RowFactory;
 +import org.apache.ignite.internal.processors.query.h2.database.H2TreeIndex;
  import org.apache.ignite.internal.util.offheap.unsafe.GridUnsafeMemory;
 +import org.apache.ignite.internal.util.typedef.F;
 +import org.apache.ignite.internal.util.typedef.internal.U;
 +import org.apache.ignite.lang.IgniteBiTuple;
  import org.h2.api.TableEngine;
  import org.h2.command.ddl.CreateTableData;
- import org.h2.engine.Database;
- import org.h2.engine.DbObject;
  import org.h2.engine.Session;
- import org.h2.index.BaseIndex;
- import org.h2.index.Cursor;
  import org.h2.index.Index;
- import org.h2.index.IndexLookupBatch;
  import org.h2.index.IndexType;
  import org.h2.message.DbException;
  import org.h2.result.Row;
@@@ -1065,163 -871,13 +969,13 @@@ public class GridH2Table extends TableB
          }
  
          /** {@inheritDoc} */
-         @Override public IndexColumn[] getIndexColumns() {
-             return delegate().getIndexColumns();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public IndexType getIndexType() {
-             return type;
-         }
- 
-         /** {@inheritDoc} */
          @Override public String getPlanSQL() {
 -            return delegate.getTable().getSQL() + "." + SCAN_INDEX_NAME_SUFFIX;
 +            return delegate().getTable().getSQL() + "." + SCAN_INDEX_NAME_SUFFIX;
          }
  
          /** {@inheritDoc} */
-         @Override public Row getRow(Session ses, long key) {
-             return delegate().getRow(ses, key);
-         }
- 
-         /** {@inheritDoc} */
-         @Override public long getRowCount(Session ses) {
-             return delegate().getRowCount(ses);
-         }
- 
-         /** {@inheritDoc} */
-         @Override public long getRowCountApproximation() {
-             return delegate().getRowCountApproximation();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public Table getTable() {
-             return delegate().getTable();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public boolean isRowIdIndex() {
-             return treeIdx.isRowIdIndex();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public boolean needRebuild() {
-             return false;
-         }
- 
-         /** {@inheritDoc} */
-         @Override public void remove(Session ses) {
-             // No-op.
-         }
- 
-         /** {@inheritDoc} */
-         @Override public void remove(Session ses, Row row) {
-             // No-op.
-         }
- 
-         /** {@inheritDoc} */
-         @Override public void setSortedInsertMode(boolean sortedInsertMode) {
-             // No-op.
-         }
- 
-         /** {@inheritDoc} */
-         @Override public IndexLookupBatch createLookupBatch(TableFilter filter) {
-             return delegate().createLookupBatch(filter);
-         }
- 
-         /** {@inheritDoc} */
-         @Override public void truncate(Session ses) {
-             // No-op.
-         }
- 
-         /** {@inheritDoc} */
-         @Override public Schema getSchema() {
-             return delegate().getSchema();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public boolean isHidden() {
-             return delegate().isHidden();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public void checkRename() {
-             throw DbException.getUnsupportedException("rename");
-         }
- 
-         /** {@inheritDoc} */
-         @Override public ArrayList<DbObject> getChildren() {
-             return delegate().getChildren();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public String getComment() {
-             return delegate().getComment();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public String getCreateSQL() {
-             return null; // Scan should return null.
-         }
- 
-         /** {@inheritDoc} */
-         @Override public String getCreateSQLForCopy(Table tbl, String quotedName) {
-             return treeIdx.getCreateSQLForCopy(tbl, quotedName);
-         }
- 
-         /** {@inheritDoc} */
-         @Override public Database getDatabase() {
-             return delegate().getDatabase();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public String getDropSQL() {
-             return delegate().getDropSQL();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public int getId() {
-             return delegate().getId();
-         }
- 
-         /** {@inheritDoc} */
          @Override public String getName() {
 -            return delegate.getName() + SCAN_INDEX_NAME_SUFFIX;
 +            return delegate().getName() + SCAN_INDEX_NAME_SUFFIX;
          }
- 
-         /** {@inheritDoc} */
-         @Override public String getSQL() {
-             return delegate().getSQL();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public int getType() {
-             return delegate().getType();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public boolean isTemporary() {
-             return delegate().isTemporary();
-         }
- 
-         /** {@inheritDoc} */
-         @Override public void removeChildrenAndResources(Session ses) {
-             // No-op.
-         }
- 
-         /** {@inheritDoc} */
-         @Override public void rename(String newName) {
-             throw DbException.getUnsupportedException("rename");
-         }
- 
-         /** {@inheritDoc} */
-         @Override public void setComment(String comment) {
-             throw DbException.getUnsupportedException("comment");
-         }
- 
-         /** {@inheritDoc} */
-         @Override public void setTemporary(boolean temporary) {
-             throw DbException.getUnsupportedException("temporary");
-         }
      }
  }

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
index 9c59faf,2873211..eb00c39
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/opt/GridH2TreeIndex.java
@@@ -46,8 -47,8 +47,8 @@@ import org.jetbrains.annotations.Nullab
   */
  @SuppressWarnings("ComparatorNotSerializable")
  public class GridH2TreeIndex extends GridH2IndexBase implements Comparator<GridSearchRowPointer> {
 -    /** Index segments. */
 -    private final ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row>[] segments;
 +    /** */
-     private final IgniteNavigableMapTree tree;
++    private final IgniteNavigableMapTree[] segments;
  
      /** */
      private final boolean snapshotEnabled;
@@@ -69,29 -86,33 +86,34 @@@
          initBaseIndex(tbl, 0, name, cols,
              pk ? IndexType.createPrimaryKey(false, false) : IndexType.createNonUnique(false, false, false));
  
 -        segments = new ConcurrentNavigableMap[segmentsCnt];
++        segments = new IgniteNavigableMapTree[segmentsCnt];
+ 
          final GridH2RowDescriptor desc = tbl.rowDescriptor();
  
          if (desc == null || desc.memory() == null) {
              snapshotEnabled = desc == null || desc.snapshotableIndex();
  
              if (snapshotEnabled) {
-                 tree = new IgniteNavigableMapTree(new SnapTreeMap<GridSearchRowPointer, GridH2Row>(this) {
-                     @Override protected void afterNodeUpdate_nl(Node<GridSearchRowPointer, GridH2Row> node, Object val) {
-                         if (val != null)
-                             node.key = (GridSearchRowPointer)val;
-                     }
+                 for (int i = 0; i < segmentsCnt; i++) {
 -                    segments[i] = new SnapTreeMap<GridSearchRowPointer, GridH2Row>(this) {
++                    segments[i] = new IgniteNavigableMapTree(new SnapTreeMap<GridSearchRowPointer, GridH2Row>(this) {
+                         @Override protected void afterNodeUpdate_nl(Node<GridSearchRowPointer, GridH2Row> node, Object val) {
+                             if (val != null)
+                                 node.key = (GridSearchRowPointer)val;
+                         }
  
-                     @Override protected Comparable<? super GridSearchRowPointer> comparable(Object key) {
-                         if (key instanceof ComparableRow)
-                             return (Comparable<? super SearchRow>)key;
+                         @Override protected Comparable<? super GridSearchRowPointer> comparable(Object key) {
+                             if (key instanceof ComparableRow)
+                                 return (Comparable<? super SearchRow>)key;
  
-                         return super.comparable(key);
-                     }
-                 });
+                             return super.comparable(key);
+                         }
 -                    };
++                    });
+                 }
              }
              else {
-                 tree = new IgniteNavigableMapTree(
+                 for (int i = 0; i < segmentsCnt; i++) {
 -                    segments[i] = new ConcurrentSkipListMap<>(
++                    segments[i] = new IgniteNavigableMapTree(
 +                    new ConcurrentSkipListMap<GridSearchRowPointer, GridH2Row>(
                          new Comparator<GridSearchRowPointer>() {
                              @Override public int compare(GridSearchRowPointer o1, GridSearchRowPointer o2) {
                                  if (o1 instanceof ComparableRow)
@@@ -103,7 -124,8 +125,8 @@@
                                  return compareRows(o1, o2);
                              }
                          }
-                 ));
 -                    );
++                    ));
+                 }
              }
          }
          else {
@@@ -111,49 -133,57 +134,55 @@@
  
              snapshotEnabled = true;
  
-             tree = new IgniteNavigableMapTree(new GridOffHeapSnapTreeMap<GridSearchRowPointer, GridH2Row>(desc, desc, desc.memory(), desc.guard(), this) {
-                 @Override protected void afterNodeUpdate_nl(long node, GridH2Row val) {
-                     final long oldKey = keyPtr(node);
+             for (int i = 0; i < segmentsCnt; i++) {
 -                segments[i] = new GridOffHeapSnapTreeMap<GridSearchRowPointer, GridH2Row>(desc, desc, desc.memory(), desc.guard(), this) {
++                segments[i] = new IgniteNavigableMapTree(new GridOffHeapSnapTreeMap<GridSearchRowPointer, GridH2Row>(desc, desc, desc.memory(), desc.guard(), this) {
+                     @Override protected void afterNodeUpdate_nl(long node, GridH2Row val) {
+                         final long oldKey = keyPtr(node);
  
-                     if (val != null) {
-                         key(node, val);
+                         if (val != null) {
+                             key(node, val);
  
-                         guard.finalizeLater(new Runnable() {
-                             @Override public void run() {
-                                 desc.createPointer(oldKey).decrementRefCount();
-                             }
-                         });
+                             guard.finalizeLater(new Runnable() {
+                                 @Override public void run() {
+                                     desc.createPointer(oldKey).decrementRefCount();
+                                 }
+                             });
+                         }
                      }
-                 }
  
-                 @Override protected Comparable<? super GridSearchRowPointer> comparable(Object key) {
-                     if (key instanceof ComparableRow)
-                         return (Comparable<? super SearchRow>)key;
+                     @Override protected Comparable<? super GridSearchRowPointer> comparable(Object key) {
+                         if (key instanceof ComparableRow)
+                             return (Comparable<? super SearchRow>)key;
  
-                     return super.comparable(key);
-                 }
-             });
+                         return super.comparable(key);
+                     }
 -                };
++                });
+             }
          }
  
          initDistributedJoinMessaging(tbl);
      }
  
      /** {@inheritDoc} */
 -    @Override protected Object doTakeSnapshot() {
 +    @Override protected IgniteTree doTakeSnapshot() {
          assert snapshotEnabled;
  
+         int seg = threadLocalSegment();
+ 
 -        ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> tree = segments[seg];
++        IgniteNavigableMapTree tree = segments[seg];
+ 
 -        return tree instanceof SnapTreeMap ?
 -            ((SnapTreeMap)tree).clone() :
 -            ((GridOffHeapSnapTreeMap)tree).clone();
 +        return tree.clone();
      }
  
      /** {@inheritDoc} */
-     @Override protected final IgniteTree treeForRead() {
 -    protected ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> treeForRead(int seg) {
++    @Override protected final IgniteTree treeForRead(int seg) {
          if (!snapshotEnabled)
-             return tree;
+             return segments[seg];
  
 -        ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> res = threadLocalSnapshot();
 +        IgniteTree res = threadLocalSnapshot();
  
          if (res == null)
-             res = tree;
+             return segments[seg];
  
          return res;
      }
@@@ -169,15 -204,13 +203,17 @@@
      @Override public long getRowCount(@Nullable Session ses) {
          IndexingQueryFilter f = threadLocalFilter();
  
+         int seg = threadLocalSegment();
+ 
          // Fast path if we don't need to perform any filtering.
          if (f == null || f.forSpace((getTable()).spaceName()) == null)
 -            return treeForRead(seg).size();
 +            try {
-                 return treeForRead().size();
++                return treeForRead(seg).size();
 +            } catch (IgniteCheckedException e) {
 +                throw DbException.convert(e);
 +            }
  
 -        Iterator<GridH2Row> iter = doFind(null, false, null);
 +        GridCursor<GridH2Row> cursor = doFind(null, false, null);
  
          long size = 0;
  
@@@ -255,8 -286,10 +291,10 @@@
       * @param row Search row.
       * @return Row.
       */
 -    public GridH2Row findOne(GridSearchRowPointer row) {
 +    @Override public GridH2Row findOne(GridH2Row row) {
-         return tree.findOne(row);
+         int seg = threadLocalSegment();
+ 
 -        return segments[seg].get(row);
++        return segments[seg].findOne(row);
      }
  
      /**
@@@ -268,8 -301,10 +306,10 @@@
       * @return Iterator over rows in given range.
       */
      @SuppressWarnings("unchecked")
 -    private Iterator<GridH2Row> doFind(@Nullable SearchRow first, boolean includeFirst, @Nullable SearchRow last) {
 +    private GridCursor<GridH2Row> doFind(@Nullable SearchRow first, boolean includeFirst, @Nullable SearchRow last) {
-         IgniteTree t = treeForRead();
+         int seg = threadLocalSegment();
+ 
 -        ConcurrentNavigableMap<GridSearchRowPointer, GridH2Row> t = treeForRead(seg);
++        IgniteTree t = treeForRead(seg);
  
          return doFind0(t, first, includeFirst, last, threadLocalFilter());
      }
@@@ -354,7 -395,9 +394,9 @@@
  
      /** {@inheritDoc} */
      @Override public GridH2Row put(GridH2Row row) {
-         return tree.put(row);
+         int seg = segmentForRow(row);
+ 
 -        return segments[seg].put(row, row);
++        return segments[seg].put(row);
      }
  
      /** {@inheritDoc} */
@@@ -462,23 -514,16 +513,25 @@@
  
          Thread thread = Thread.currentThread();
  
-         long i = 0;
+         long j = 0;
  
-         try {
-             GridCursor<GridH2Row> cursor = tree.find(null, null);
+         for (int i = 0; i < segments.length; i++) {
 -            for (GridH2Row row : segments[i].values()) {
 -                // Check for interruptions every 1000 iterations.
 -                if ((++j & 1023) == 0 && thread.isInterrupted())
 -                    throw new InterruptedException();
++            try {
++                GridCursor<GridH2Row> cursor = segments[i].find(null, null);
 +
-             while(cursor.next()) {
-                 GridH2Row row = cursor.get();
++                while(cursor.next()) {
++                    GridH2Row row = cursor.get();
  
-                 // Check for interruptions every 1000 iterations.
-                 if (++i % 1000 == 0 && thread.isInterrupted())
-                     throw new InterruptedException();
 -                idx.put(row);
++                    // Check for interruptions every 1000 iterations.
++                    if ((++j & 1024) == 0 && thread.isInterrupted())
++                        throw new InterruptedException();
 +
-                 idx.tree.put(row);
++                    idx.put(row);
++                }
++            }
++            catch (IgniteCheckedException e) {
++                throw DbException.convert(e);
              }
-         }
-         catch (IgniteCheckedException e) {
-             throw DbException.convert(e);
          }
  
          return idx;

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
index 4576cec,c0128b9..daa5246
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/twostep/GridReduceQueryExecutor.java
@@@ -62,12 -62,13 +62,14 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
  import org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery;
  import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
+ import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
  import org.apache.ignite.internal.processors.query.GridQueryCacheObjectsIterator;
  import org.apache.ignite.internal.processors.query.GridQueryCancel;
 +import org.apache.ignite.internal.processors.query.h2.GridH2ResultSetIterator;
+ import org.apache.ignite.internal.processors.query.GridRunningQueryInfo;
  import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
  import org.apache.ignite.internal.processors.query.h2.opt.GridH2QueryContext;
- import org.apache.ignite.internal.processors.query.h2.sql.GridSqlQuerySplitter;
+ import org.apache.ignite.internal.processors.query.h2.sql.GridSqlSortColumn;
  import org.apache.ignite.internal.processors.query.h2.sql.GridSqlType;
  import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryCancelRequest;
  import org.apache.ignite.internal.processors.query.h2.twostep.messages.GridQueryFailResponse;
@@@ -109,6 -116,15 +117,12 @@@ public class GridReduceQueryExecutor 
      public static final byte QUERY_POOL = GridIoPolicy.SYSTEM_POOL;
  
      /** */
 -    private static final IgniteProductVersion DISTRIBUTED_JOIN_SINCE = IgniteProductVersion.fromString("1.7.0");
 -
 -    /** */
+     private static final String MERGE_INDEX_UNSORTED = "merge_scan";
+ 
+     /** */
+     private static final String MERGE_INDEX_SORTED = "merge_sorted";
+ 
+     /** */
      private GridKernalContext ctx;
  
      /** */
@@@ -581,11 -622,17 +620,14 @@@
                      mapQrys = new ArrayList<>(qry.mapQueries().size());
  
                      for (GridCacheSqlQuery mapQry : qry.mapQueries())
-                         mapQrys.add(new GridCacheSqlQuery("EXPLAIN " + mapQry.query(), mapQry.parameters()));
+                         mapQrys.add(new GridCacheSqlQuery("EXPLAIN " + mapQry.query())
+                             .parameters(mapQry.parameters(), mapQry.parameterIndexes()));
                  }
  
 -                IgniteProductVersion minNodeVer = cctx.shared().exchange().minimumNodeVersion(topVer);
 -
 -                final boolean oldStyle = minNodeVer.compareToIgnoreTimestamp(DISTRIBUTED_JOIN_SINCE) < 0;
                  final boolean distributedJoins = qry.distributedJoins();
  
+                 final Collection<ClusterNode> finalNodes = nodes;
+ 
                  cancel.set(new Runnable() {
                      @Override public void run() {
                          send(finalNodes, new GridQueryCancelRequest(qryReqId), null, false);
@@@ -594,23 -641,45 +636,33 @@@
  
                  boolean retry = false;
  
 -                if (oldStyle && distributedJoins)
 -                    throw new CacheException("Failed to enable distributed joins. Topology contains older data nodes.");
 -
+                 // Always enforce join order on map side to have consistent behavior.
+                 int flags = GridH2QueryRequest.FLAG_ENFORCE_JOIN_ORDER;
+ 
+                 if (distributedJoins)
+                     flags |= GridH2QueryRequest.FLAG_DISTRIBUTED_JOINS;
+ 
+                 if (qry.isLocal())
+                     flags |= GridH2QueryRequest.FLAG_IS_LOCAL;
+ 
+                 if (qry.explain())
+                     flags |= GridH2QueryRequest.FLAG_EXPLAIN;
+ 
                  if (send(nodes,
 -                    oldStyle ?
 -                        new GridQueryRequest(qryReqId,
 -                            r.pageSize,
 -                            space,
 -                            mapQrys,
 -                            topVer,
 -                            extraSpaces(space, qry.spaces()),
 -                            null,
 -                            timeoutMillis) :
 -                        new GridH2QueryRequest()
 -                            .requestId(qryReqId)
 -                            .topologyVersion(topVer)
 -                            .pageSize(r.pageSize)
 -                            .caches(qry.caches())
 -                            .tables(distributedJoins ? qry.tables() : null)
 -                            .partitions(convert(partsMap))
 -                            .queries(mapQrys)
 -                            .flags(flags)
 -                            .timeout(timeoutMillis),
 -                    oldStyle && partsMap != null ? new ExplicitPartitionsSpecializer(partsMap) : null,
 +                    new GridH2QueryRequest()
 +                        .requestId(qryReqId)
 +                        .topologyVersion(topVer)
 +                        .pageSize(r.pageSize)
 +                        .caches(qry.caches())
 +                        .tables(distributedJoins ? qry.tables() : null)
 +                        .partitions(convert(partsMap))
 +                        .queries(mapQrys)
-                         .flags(distributedJoins ? GridH2QueryRequest.FLAG_DISTRIBUTED_JOINS : 0)
++                        .flags(flags)
 +                        .timeout(timeoutMillis),
 +                    null,
-                     distributedJoins)
-                     ) {
-                     awaitAllReplies(r, nodes);
+                     false)) {
  
-                     cancel.checkCancelled();
+                     awaitAllReplies(r, nodes, cancel);
  
                      Object state = r.state.get();
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheCrossCacheQuerySelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheQueryIndexDisabledSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
index 15f110f,842b947..426a3ef
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractQuerySelfTest.java
@@@ -149,58 -230,6 +152,82 @@@ public abstract class IgniteCacheAbstra
      }
  
      /**
 +     * @return cache configuration
 +     */
 +    protected CacheConfiguration cacheConfiguration() {
 +        CacheConfiguration cc = defaultCacheConfiguration();
 +
 +        cc.setCacheMode(cacheMode());
 +        cc.setAtomicityMode(atomicityMode());
 +        cc.setNearConfiguration(nearCacheConfiguration());
 +        cc.setWriteSynchronizationMode(FULL_SYNC);
 +        cc.setCacheStoreFactory(new StoreFactory());
 +        cc.setReadThrough(true);
 +        cc.setWriteThrough(true);
 +        cc.setLoadPreviousValue(true);
 +        cc.setRebalanceMode(SYNC);
 +        cc.setSqlFunctionClasses(SqlFunctions.class);
 +
-         if (cacheMode() != CacheMode.LOCAL)
++        List<QueryEntity> entityList = new ArrayList<>();
++
++        QueryEntity qryEntity = new QueryEntity();
++
++        qryEntity.setKeyType(Integer.class.getName());
++        qryEntity.setValueType(Type1.class.getName());
++        qryEntity.addQueryField("id", Integer.class.getName(), null);
++        qryEntity.addQueryField("name", String.class.getName(), null);
++        qryEntity.setTableName("Type2");
++        qryEntity.setIndexes(Arrays.asList(new QueryIndex("id")));
++
++        entityList.add(qryEntity);
++
++        qryEntity = new QueryEntity();
++
++        qryEntity.setKeyType(Integer.class.getName());
++        qryEntity.setValueType(Type2.class.getName());
++        qryEntity.addQueryField("id", Integer.class.getName(), null);
++        qryEntity.addQueryField("name", String.class.getName(), null);
++        qryEntity.setTableName("Type1");
++        qryEntity.setIndexes(Arrays.asList(new QueryIndex("id")));
++
++        entityList.add(qryEntity);
++
++        cc.setQueryEntities(entityList);if (cacheMode() != CacheMode.LOCAL)
 +            cc.setAffinity(new RendezvousAffinityFunction());
 +
 +        // Explicitly set number of backups equal to number of grids.
 +        if (cacheMode() == CacheMode.PARTITIONED)
 +            cc.setBackups(gridCount());
 +
 +        //cc.setSnapshotableIndex(snapshotableIndex());
 +
 +        return cc;
 +    }
 +
 +    /**
 +     * @param clsK Key class.
 +     * @param clsV Value class.
 +     *
 +     * @return cache instance
 +     */
 +    protected <K, V> IgniteCache<K, V> jcache(Class<K> clsK, Class<V> clsV) {
 +        return jcache(ignite(), clsK, clsV);
 +    }
 +
 +    /**
 +     * @param ig Ignite.
 +     * @param clsK Key class.
 +     * @param clsV Value class.
 +     *
 +     * @return cache instance
 +     */
 +    protected <K, V> IgniteCache<K, V> jcache(Ignite ig, Class<K> clsK, Class<V> clsV) {
 +        IgniteCache<K, V> cache = jcache(ig, cacheConfiguration(), clsK, clsV);
 +
 +        return cache;
 +    }
 +
 +    /**
       * @return {@code True} if index snapshot is enabled.
       */
      protected boolean snapshotableIndex() {
@@@ -549,8 -608,115 +607,115 @@@
       *
       * @throws Exception In case of error.
       */
+     public void testSimpleCustomTableName() throws Exception {
+         final IgniteCache<Integer, Object> cache = ignite().cache(null);
+ 
+         cache.put(10, new Type1(1, "Type1 record #1"));
+         cache.put(20, new Type1(2, "Type1 record #2"));
+ 
+         QueryCursor<Cache.Entry<Integer, Type1>> qry1 =
+             cache.query(new SqlQuery<Integer, Type1>(Type1.class, "FROM Type2"));
+ 
+         List<Cache.Entry<Integer, Type1>> all = qry1.getAll();
+ 
+         assertEquals(2, all.size());
+ 
+         QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery("SELECT name FROM Type2"));
+ 
+         assertEquals(2, qry.getAll().size());
+ 
+         GridTestUtils.assertThrows(log, new GridPlainCallable<Void>() {
+             @Override public Void call() throws Exception {
+                 QueryCursor<Cache.Entry<Integer, Type1>> qry =
+                     cache.query(new SqlQuery<Integer, Type1>(Type1.class, "FROM Type1"));
+ 
+                 qry.getAll();
+ 
+                 return null;
+             }
+         }, CacheException.class, null);
+     }
+ 
+     /**
+      * JUnit.
+      *
+      * @throws Exception In case of error.
+      */
+     public void testMixedCustomTableName() throws Exception {
+         final IgniteCache<Integer, Object> cache = ignite().cache(null);
+ 
+         cache.put(10, new Type1(1, "Type1 record #1"));
+         cache.put(20, new Type1(2, "Type1 record #2"));
+         cache.put(30, new Type2(1, "Type2 record #1"));
+         cache.put(40, new Type2(2, "Type2 record #2"));
+         cache.put(50, new Type2(3, "Type2 record #3"));
+ 
+         QueryCursor<Cache.Entry<Integer, Type1>> qry1 =
+             cache.query(new SqlQuery<Integer, Type1>(Type1.class, "FROM Type2"));
+ 
+         List<Cache.Entry<Integer, Type1>> all = qry1.getAll();
+ 
+         assertEquals(2, all.size());
+ 
+         QueryCursor<Cache.Entry<Integer, Type2>> qry2 =
+             cache.query(new SqlQuery<Integer, Type2>(Type2.class, "FROM Type1"));
+ 
+         assertEquals(3, qry2.getAll().size());
+ 
+         QueryCursor<List<?>> qry = cache.query(new SqlFieldsQuery("SELECT name FROM Type1"));
+ 
+         assertEquals(3, qry.getAll().size());
+ 
+         qry = cache.query(new SqlFieldsQuery("SELECT name FROM Type2"));
+ 
+         assertEquals(2, qry.getAll().size());
+ 
+         GridTestUtils.assertThrows(log, new GridPlainCallable<Void>() {
+             @Override public Void call() throws Exception {
+                 QueryCursor<Cache.Entry<Integer, Type1>> qry1 =
+                     cache.query(new SqlQuery<Integer, Type1>(Type1.class, "FROM Type1"));
+ 
+                 qry1.getAll().size();
+ 
+                 return null;
+             }
+         }, CacheException.class, null);
+     }
+ 
+     /**
+      * JUnit.
+      *
+      * @throws Exception In case of error.
+      */
+     public void testDistributedJoinCustomTableName() throws Exception {
+         IgniteCache<Integer, Object> cache = ignite().cache(null);
+ 
+         cache.put(10, new Type1(1, "Type1 record #1"));
+         cache.put(20, new Type1(2, "Type1 record #2"));
+         cache.put(30, new Type2(1, "Type2 record #1"));
+         cache.put(40, new Type2(2, "Type2 record #2"));
+         cache.put(50, new Type2(3, "Type2 record #3"));
+ 
+         QueryCursor<List<?>> query = cache.query(
+             new SqlFieldsQuery("SELECT t2.name, t1.name FROM Type2 as t2 LEFT JOIN Type1 as t1 ON t1.id = t2.id")
+                 .setDistributedJoins(cacheMode() == PARTITIONED));
+ 
+         assertEquals(2, query.getAll().size());
+ 
+         query = cache.query(
+             new SqlFieldsQuery("SELECT t2.name, t1.name FROM Type2 as t2 RIGHT JOIN Type1 as t1 ON t1.id = t2.id")
+                 .setDistributedJoins(cacheMode() == PARTITIONED));
+ 
+         assertEquals(3, query.getAll().size());
+     }
+ 
+     /**
+      * JUnit.
+      *
+      * @throws Exception In case of error.
+      */
      public void testObjectQuery() throws Exception {
 -        IgniteCache<Integer, ObjectValue> cache = ignite().cache(null);
 +        IgniteCache<Integer, ObjectValue> cache = jcache(Integer.class, ObjectValue.class);
  
          ObjectValue val = new ObjectValue("test", 0);
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheLockPartitionOnAffinityRunTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapEvictQueryTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/IgniteCachePartitionedQuerySelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSchemaIndexingTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
index 75bbe00,8eae549..6a08cd6
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/IgniteSqlSplitterSelfTest.java
@@@ -263,27 -326,24 +331,27 @@@ public class IgniteSqlSplitterSelfTest 
       * @throws Exception If failed.
       */
      public void testDistributedJoinsUnion() throws Exception {
 -        CacheConfiguration ccfg = cacheConfig("persOrg", true,
 -            Integer.class, Person2.class, Integer.class, Organization.class);
 +        CacheConfiguration ccfg1 = cacheConfig("pers", true, Integer.class, Person2.class);
 +        CacheConfiguration ccfg2 = cacheConfig("org", true, Integer.class, Organization.class);
  
 -        IgniteCache<Integer, Object> c = ignite(0).getOrCreateCache(ccfg);
 +        IgniteCache<Integer, Object> c1 = ignite(0).getOrCreateCache(ccfg1);
 +        IgniteCache<Integer, Object> c2 = ignite(0).getOrCreateCache(ccfg2);
  
          try {
 -            c.put(1, new Organization("o1"));
 -            c.put(2, new Organization("o2"));
 -            c.put(3, new Person2(1, "p1"));
 -            c.put(4, new Person2(2, "p2"));
 -            c.put(5, new Person2(3, "p3"));
 +            c2.put(1, new Organization("o1"));
 +            c2.put(2, new Organization("o2"));
 +            c1.put(3, new Person2(1, "p1"));
 +            c1.put(4, new Person2(2, "p2"));
 +            c1.put(5, new Person2(3, "p3"));
  
 -            String select = "select o.name n1, p.name n2 from Person2 p, Organization o where p.orgId = o._key and o._key=1" +
 -                " union select o.name n1, p.name n2 from Person2 p, Organization o where p.orgId = o._key and o._key=2";
 +            String select = "select o.name n1, p.name n2 from Person2 p, \"org\".Organization o" +
 +                            " where p.orgId = o._key and o._key=1" +
 +                            " union select o.name n1, p.name n2 from Person2 p, \"org\".Organization o" +
 +                            " where p.orgId = o._key and o._key=2";
  
-             String plan = (String)c1.query(new SqlFieldsQuery("explain " + select)
 -            String plan = c.query(new SqlFieldsQuery("explain " + select)
++            String plan = c1.query(new SqlFieldsQuery("explain " + select)
                  .setDistributedJoins(true).setEnforceJoinOrder(true))
-                 .getAll().get(0).get(0);
+                 .getAll().toString();
  
              X.println("Plan : " + plan);
  
@@@ -295,9 -355,9 +363,9 @@@
  
              select = "select * from (" + select + ")";
  
-             plan = (String)c1.query(new SqlFieldsQuery("explain " + select)
 -            plan = c.query(new SqlFieldsQuery("explain " + select)
++            plan = c1.query(new SqlFieldsQuery("explain " + select)
                  .setDistributedJoins(true).setEnforceJoinOrder(true))
-                 .getAll().get(0).get(0);
+                 .getAll().toString();
  
              X.println("Plan : " + plan);
  

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
index 133ae4e,d6a5fb1..3af4701
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/GridIndexingSpiAbstractSelfTest.java
@@@ -242,17 -247,17 +249,17 @@@ public abstract class GridIndexingSpiAb
              // all fine
          }
  
-         assertFalse(spi.queryLocalSql(typeAB.space(), "select ab.* from A.B ab",
-             Collections.emptySet(), typeAB, null).hasNext());
+         assertFalse(spi.queryLocalSql(typeAB.space(), "select ab.* from A.B ab", null,
+             Collections.emptySet(), typeAB.name(), null, null).hasNext());
  
-         assertFalse(spi.queryLocalSql(typeBA.space(), "select   ba.*   from B.A  as ba",
-             Collections.emptySet(), typeBA, null).hasNext());
+         assertFalse(spi.queryLocalSql(typeBA.space(), "select   ba.*   from B.A  as ba", null,
+             Collections.emptySet(), typeBA.name(), null, null).hasNext());
  
          // Nothing to remove.
 -        spi.remove("A", key(1), aa(1, "", 10));
 -        spi.remove("B", key(1), ba(1, "", 10, true));
 +        spi.remove("A", typeAA, key(1), 0, aa(1, "", 10), null);
 +        spi.remove("B", typeBA, key(1), 0, ba(1, "", 10, true), null);
  
 -        spi.store(typeAA.space(), typeAA, key(1), aa(1, "Vasya", 10), "v1".getBytes(), 0);
 +        spi.store(typeAA.space(), typeAA, key(1), 0, aa(1, "Vasya", 10), new GridCacheVersion(), 0, 0);
  
          assertEquals(1, spi.size(typeAA.space(), typeAA));
          assertEquals(0, spi.size(typeAB.space(), typeAB));

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/AbstractH2CompareQueryTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
index 3cbfa0f,225c838..d14a197
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/GridQueryParsingTest.java
@@@ -92,10 -81,17 +94,11 @@@ public class GridQueryParsingTest exten
          cc.setNearConfiguration(null);
          cc.setWriteSynchronizationMode(FULL_SYNC);
          cc.setRebalanceMode(SYNC);
 -        cc.setSwapEnabled(false);
+         cc.setSqlSchema(TEST_SCHEMA);
          cc.setSqlFunctionClasses(GridQueryParsingTest.class);
 -        cc.setIndexedTypes(
 -            String.class, Address.class,
 -            String.class, Person.class
 -        );
 +        cc.setIndexedTypes(clsK, clsV);
  
 -        c.setCacheConfiguration(cc);
 -
 -        return c;
 +        return cc;
      }
  
      /** {@inheritDoc} */
@@@ -161,21 -157,21 +164,21 @@@
          checkQuery("select * from table0('aaa', 100) x left join table0('bbb', 100) y on x.a=y.a where x.b = 'bbb'");
          checkQuery("select * from table0('aaa', 100) x left join table0('bbb', 100) y where x.b = 'bbb'");
  
 -        checkQuery("select avg(old) from Person left join Address on Person.addrId = Address.id " +
 +        checkQuery("select avg(old) from Person left join \"addr\".Address on Person.addrId = Address.id " +
              "where lower(Address.street) = lower(?)");
  
 -        checkQuery("select avg(old) from Person join Address on Person.addrId = Address.id " +
 +        checkQuery("select avg(old) from Person join \"addr\".Address on Person.addrId = Address.id " +
              "where lower(Address.street) = lower(?)");
  
 -        checkQuery("select avg(old) from Person left join Address where Person.addrId = Address.id " +
 +        checkQuery("select avg(old) from Person left join \"addr\".Address where Person.addrId = Address.id " +
              "and lower(Address.street) = lower(?)");
 -        checkQuery("select avg(old) from Person right join Address where Person.addrId = Address.id " +
 +        checkQuery("select avg(old) from Person right join \"addr\".Address where Person.addrId = Address.id " +
              "and lower(Address.street) = lower(?)");
  
 -        checkQuery("select avg(old) from Person, Address where Person.addrId = Address.id " +
 +        checkQuery("select avg(old) from Person, \"addr\".Address where Person.addrId = Address.id " +
              "and lower(Address.street) = lower(?)");
  
-         checkQuery("select name, date from Person");
+         checkQuery("select name, name, date, date d from Person");
          checkQuery("select distinct name, date from Person");
          checkQuery("select * from Person p");
          checkQuery("select * from Person");
@@@ -255,38 -244,74 +258,80 @@@
          checkQuery("select p.name n from Person p order by p.old + 10, p.name");
          checkQuery("select p.name n from Person p order by p.old + 10, p.name desc");
  
 -        checkQuery("select p.name n from Person p, (select a.street from Address a where a.street is not null) ");
 -        checkQuery("select street from Person p, (select a.street from Address a where a.street is not null) ");
 -        checkQuery("select addr.street from Person p, (select a.street from Address a where a.street is not null) addr");
 +        checkQuery("select p.name n from Person p, (select a.street from \"addr\".Address a " +
 +            "where a.street is not null) ");
 +        checkQuery("select street from Person p, (select a.street from \"addr\".Address a " +
 +            "where a.street is not null) ");
 +        checkQuery("select addr.street from Person p, (select a.street from \"addr\".Address a " +
 +            "where a.street is not null) addr");
  
-         checkQuery("select p.name n from \"\".Person p order by p.old + 10");
+         checkQuery("select p.name n from sch.Person p order by p.old + 10");
  
-         checkQuery("select case when p.name is null then 'Vasya' end x from \"\".Person p");
-         checkQuery("select case when p.name like 'V%' then 'Vasya' else 'Other' end x from \"\".Person p");
+         checkQuery("select case when p.name is null then 'Vasya' end x from sch.Person p");
+         checkQuery("select case when p.name like 'V%' then 'Vasya' else 'Other' end x from sch.Person p");
 -        checkQuery("select case when upper(p.name) = 'VASYA' then 'Vasya' when p.name is not null then p.name else 'Other' end x from sch.Person p");
 +        checkQuery("select case when upper(p.name) = 'VASYA' then 'Vasya' " +
-             "when p.name is not null then p.name else 'Other' end x from \"\".Person p");
++            "when p.name is not null then p.name else 'Other' end x from sch.Person p");
  
-         checkQuery("select case p.name when 'Vasya' then 1 end z from \"\".Person p");
-         checkQuery("select case p.name when 'Vasya' then 1 when 'Petya' then 2 end z from \"\".Person p");
-         checkQuery("select case p.name when 'Vasya' then 1 when 'Petya' then 2 else 3 end z from \"\".Person p");
-         checkQuery("select case p.name when 'Vasya' then 1 else 3 end z from \"\".Person p");
+         checkQuery("select case p.name when 'Vasya' then 1 end z from sch.Person p");
+         checkQuery("select case p.name when 'Vasya' then 1 when 'Petya' then 2 end z from sch.Person p");
+         checkQuery("select case p.name when 'Vasya' then 1 when 'Petya' then 2 else 3 end z from sch.Person p");
+         checkQuery("select case p.name when 'Vasya' then 1 else 3 end z from sch.Person p");
  
 -        checkQuery("select count(*) as a from Person union select count(*) as a from Address");
 -        checkQuery("select old, count(*) as a from Person group by old union select 1, count(*) as a from Address");
 -        checkQuery("select name from Person MINUS select street from Address");
 -        checkQuery("select name from Person EXCEPT select street from Address");
 -        checkQuery("select name from Person INTERSECT select street from Address");
 -        checkQuery("select name from Person UNION select street from Address limit 5");
 -        checkQuery("select name from Person UNION select street from Address limit ?");
 -        checkQuery("select name from Person UNION select street from Address limit ? offset ?");
 -        checkQuery("(select name from Person limit 4) UNION (select street from Address limit 1) limit ? offset ?");
 +        checkQuery("select count(*) as a from Person union select count(*) as a from \"addr\".Address");
 +        checkQuery("select old, count(*) as a from Person group by old union select 1, count(*) as a " +
 +            "from \"addr\".Address");
 +        checkQuery("select name from Person MINUS select street from \"addr\".Address");
 +        checkQuery("select name from Person EXCEPT select street from \"addr\".Address");
 +        checkQuery("select name from Person INTERSECT select street from \"addr\".Address");
 +        checkQuery("select name from Person UNION select street from \"addr\".Address limit 5");
 +        checkQuery("select name from Person UNION select street from \"addr\".Address limit ?");
 +        checkQuery("select name from Person UNION select street from \"addr\".Address limit ? offset ?");
 +        checkQuery("(select name from Person limit 4) " +
 +            "UNION (select street from \"addr\".Address limit 1) limit ? offset ?");
          checkQuery("(select 2 a) union all (select 1) order by 1");
          checkQuery("(select 2 a) union all (select 1) order by a desc nulls first limit ? offset ?");
+ 
+         checkQuery("select public.\"#\".\"@\" from (select 1 as \"@\") \"#\"");
+ //        checkQuery("select sch.\"#\".\"@\" from (select 1 as \"@\") \"#\""); // Illegal query.
+         checkQuery("select \"#\".\"@\" from (select 1 as \"@\") \"#\"");
+         checkQuery("select \"@\" from (select 1 as \"@\") \"#\"");
+         checkQuery("select sch.\"#\".old from sch.Person \"#\"");
+         checkQuery("select sch.\"#\".old from Person \"#\"");
+         checkQuery("select \"#\".old from Person \"#\"");
+         checkQuery("select old from Person \"#\"");
+ //        checkQuery("select Person.old from Person \"#\""); // Illegal query.
+         checkQuery("select sch.\"#\".* from Person \"#\"");
+     }
+ 
+     /**
+      * Query AST transformation heavily depends on this behavior.
+      *
+      * @throws Exception If failed.
+      */
+     public void testParseTableFilter() throws Exception {
+         Prepared prepared = parse("select Person.old, p1.old from Person, Person p1");
+ 
+         GridSqlSelect select = (GridSqlSelect)new GridSqlQueryParser(false).parse(prepared);
+ 
+         GridSqlJoin join = (GridSqlJoin)select.from();
+ 
+         GridSqlTable tbl1 = (GridSqlTable)join.leftTable();
+         GridSqlAlias tbl2Alias = (GridSqlAlias)join.rightTable();
+         GridSqlTable tbl2 = tbl2Alias.child();
+ 
+         // Must be distinct objects, even if it is the same table.
+         assertNotSame(tbl1, tbl2);
+         assertNotNull(tbl1.dataTable());
+         assertNotNull(tbl2.dataTable());
+         assertSame(tbl1.dataTable(), tbl2.dataTable());
+ 
+         GridSqlColumn col1 = (GridSqlColumn)select.column(0);
+         GridSqlColumn col2 = (GridSqlColumn)select.column(1);
+ 
+         assertSame(tbl1, col1.expressionInFrom());
+ 
+         // Alias in FROM must be included in column.
+         assertSame(tbl2Alias, col2.expressionInFrom());
      }
  
      /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
index 12ef2cb,30dd80d..565ee61
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/query/h2/sql/H2CompareBigQueryTest.java
@@@ -29,11 -29,12 +29,13 @@@ import java.util.ArrayList
  import java.util.Collection;
  import java.util.List;
  import java.util.concurrent.atomic.AtomicInteger;
 +import org.apache.ignite.IgniteCache;
  import org.apache.ignite.cache.CacheMode;
  import org.apache.ignite.cache.affinity.AffinityKey;
+ import org.apache.ignite.cache.query.SqlFieldsQuery;
  import org.apache.ignite.cache.query.annotations.QuerySqlField;
 -import org.apache.ignite.configuration.CacheConfiguration;
 +import org.apache.ignite.configuration.IgniteConfiguration;
+ import org.apache.ignite.internal.util.typedef.X;
  
  /**
   * Executes one big query (and subqueries of the big query) to compare query results from h2 database instance and
@@@ -159,13 -120,16 +161,13 @@@ public class H2CompareBigQueryTest exte
      }
  
      /** {@inheritDoc} */
 -    @Override protected void setIndexedTypes(CacheConfiguration<?, ?> cc, CacheMode mode) {
 -        if (mode == CacheMode.PARTITIONED) {
 -            cc.setIndexedTypes(
 -                Integer.class, CustOrder.class,
 -                useColocatedData() ? AffinityKey.class : Integer.class, ReplaceOrder.class,
 -                useColocatedData() ? AffinityKey.class : Integer.class, OrderParams.class,
 -                useColocatedData() ? AffinityKey.class : Integer.class, Cancel.class,
 -                useColocatedData() ? AffinityKey.class : Integer.class, Exec.class
 -            );
 -        }
 +    @SuppressWarnings("unchecked")
 +    @Override protected void createCaches() {
 +        cacheCustOrd = ignite.cache("custord");
 +        cacheReplOrd = ignite.cache("replord");
 +        cacheOrdParam = ignite.cache("ordparam");
 +        cacheCancel = ignite.cache("cancel");
-         cacheExec= ignite.cache("exec");
++        cacheExec = ignite.cache("exec");
      }
  
      /** {@inheritDoc} */
@@@ -256,7 -221,7 +259,7 @@@
  
                  add(exec);
  
-                 cacheExec.put(exec.rootOrderId, exec);
 -                pCache.put(exec.key(useColocatedData()), exec);
++                cacheExec.put(exec.key(useColocatedData()), exec);
  
                  insertInDb(exec);
              }
@@@ -280,8 -245,17 +283,17 @@@
       * @throws Exception If failed.
       */
      public void testBigQuery() throws Exception {
+         X.println();
+         X.println(bigQry);
+         X.println();
+ 
 -        X.println("   Plan: \n" + pCache.query(new SqlFieldsQuery("EXPLAIN " + bigQry)
++        X.println("   Plan: \n" + cacheCustOrd.query(new SqlFieldsQuery("EXPLAIN " + bigQry)
+             .setDistributedJoins(distributedJoins())).getAll());
+ 
 -        List<List<?>> res = compareQueryRes0(pCache, bigQry, distributedJoins(), new Object[0], Ordering.RANDOM);
 +        List<List<?>> res = compareQueryRes0(cacheCustOrd, bigQry, distributedJoins(), new Object[0], Ordering.RANDOM);
  
+         X.println("   Result size: " + res.size());
+ 
          assertTrue(!res.isEmpty()); // Ensure we set good testing data at database.
      }
  
@@@ -341,9 -309,9 +353,9 @@@
              "  refOrderId int" +
              "  )");
  
 -        st.execute("create table \"part\".Exec" +
 +        st.execute("create table \"exec\".Exec" +
              "  (" +
-             "  _key int not null," +
+             "  _key " + keyType + " not null," +
              "  _val other not null," +
              "  rootOrderId int unique," +
              "  date Date, " +

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java
index 4eaaab8,07125a6..3c1f971
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite3.java
@@@ -33,6 -33,8 +33,7 @@@ import org.apache.ignite.internal.proce
  import org.apache.ignite.internal.processors.cache.query.continuous.CacheKeepBinaryIterationNearEnabledTest;
  import org.apache.ignite.internal.processors.cache.query.continuous.CacheKeepBinaryIterationTest;
  import org.apache.ignite.internal.processors.cache.query.continuous.CacheKeepBinaryIterationStoreEnabledTest;
 -import org.apache.ignite.internal.processors.cache.query.continuous.CacheKeepBinaryIterationSwapEnabledTest;
+ import org.apache.ignite.internal.processors.cache.query.continuous.ClientReconnectContinuousQueryTest;
  import org.apache.ignite.internal.processors.cache.query.continuous.ContinuousQueryRemoteFilterMissingInClassPathSelfTest;
  import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicNearEnabledSelfTest;
  import org.apache.ignite.internal.processors.cache.query.continuous.GridCacheContinuousQueryAtomicOffheapTieredTest;
@@@ -121,9 -123,9 +122,10 @@@ public class IgniteCacheQuerySelfTestSu
          suite.addTestSuite(CacheKeepBinaryIterationNearEnabledTest.class);
          suite.addTestSuite(IgniteCacheContinuousQueryBackupQueueTest.class);
          suite.addTestSuite(IgniteCacheContinuousQueryNoUnsubscribeTest.class);
+         suite.addTestSuite(ClientReconnectContinuousQueryTest.class);
  
 +        suite.addTest(IgniteDistributedJoinTestSuite.suite());
 +
          return suite;
      }
  }

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
----------------------------------------------------------------------
diff --cc modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
index 40ef860,64b7e2a..d441e3f
--- a/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
+++ b/modules/indexing/src/test/resources/org/apache/ignite/internal/processors/query/h2/sql/bigQuery.sql
@@@ -25,22 -25,26 +25,26 @@@ from 
  	union all
  	
  	select  date, orderId, rootOrderId, refOrderId as origOrderId, archSeq, alias
 -	from "part".ReplaceOrder where alias='CUSTOM'
 +	from "replord".ReplaceOrder where alias='CUSTOM'
-   ) co, "ordparam".OrderParams op
-   where co.date = op.date and co.orderId = op.orderId and co.archSeq = -- TODO: replace with 'dateToLong(co.date)+archSeq'.
- 	(
- 	  select max(archSeq) -- TODO: replace with 'dateToLong(co.date)+archSeq'.
- 	  from (
- 		  select  date, orderId, rootOrderId, origOrderId, archSeq, alias 
- 		  from "custord".CustOrder where alias='CUSTOM'
- 		  
- 		  union all
- 		  
- 		  select  date, orderId, rootOrderId, refOrderId as origOrderId, archSeq, alias
- 		  from "replord".ReplaceOrder where alias='CUSTOM'
- 	  ) 
- 	  where origOrderId = co.origOrderId and date = co.date
- 	) and co.alias='CUSTOM'
+   ) co,
 -  "part".OrderParams op,
++  "ordparam".OrderParams op,
+     (
+       select origOrderId, date, max(archSeq) maxArchSeq
+       from (
+           select  date, orderId, rootOrderId, origOrderId, archSeq, alias
 -          from "part".CustOrder where alias='CUSTOM'
++          from "custord".CustOrder where alias='CUSTOM'
+ 
+           union all
+ 
+           select  date, orderId, rootOrderId, refOrderId as origOrderId, archSeq, alias
 -          from "part".ReplaceOrder where alias='CUSTOM'
++          from "replord".ReplaceOrder where alias='CUSTOM'
+       )
+       group by origOrderId, date
+    ) h
+   where co.date = op.date and co.orderId = op.orderId
+     and h.origOrderId = co.origOrderId and h.date = co.date
+     and co.archSeq = h.maxArchSeq
+ 	and co.alias='CUSTOM'
  ) cop 
  inner join (
    select e.date, e.rootOrderId as eRootOrderId, e.rootOrderId, sum(e.execShares) as execShares, 

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/kafka/src/test/java/org/apache/ignite/stream/kafka/TestKafkaBroker.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --cc modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
index 9f1268b,a66aea8..9e8cd33
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
@@@ -297,14 -208,24 +209,25 @@@ namespace Apache.Ignite.Core.Tests.Cach
              Assert.AreEqual("val", cache.Get(1));
  
              Assert.AreEqual(1, cache.GetSize());
+         }
+ 
+         [Test]
+         public void TestExceptions()
+         {
+             var cache = GetCache();
+ 
+             cache.Put(1, "val");
  
-             // Test errors
              CacheTestStore.ThrowError = true;
              CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Put(-2, "fail")).InnerException);
-             
+ 
 -            cache.LocalEvict(new[] {1});
 -            CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Get(1)).InnerException);
 +            // TODO: IGNITE-4535
-             //cache.LocalEvict(new[] { 1 });
++            //cache.LocalEvict(new[] {1});
 +            //CheckCustomStoreError(Assert.Throws<CacheStoreException>(() => cache.Get(1)).InnerException);
+ 
+             CacheTestStore.ThrowError = false;
+ 
+             cache.Remove(1);
          }
  
          [Test]
@@@ -322,12 -261,11 +263,12 @@@
  
              Assert.AreEqual(1, v.GetField<int>("_idx"));
  
 -            cache.LocalEvict(new[] { 1 });
 +            // TODO: IGNITE-4535
 +            //cache.LocalEvict(new[] { 1 });
  
 -            Assert.AreEqual(0, cache.GetSize());
 +            //Assert.AreEqual(0, cache.GetSize());
  
-             Assert.AreEqual(1, cache.Get(1).Index());
+             Assert.AreEqual(1, cache.Get(1).Index);
  
              Assert.AreEqual(1, cache.GetSize());
          }
@@@ -345,14 -286,13 +289,14 @@@
  
              Value v = (Value)map[1];
  
-             Assert.AreEqual(1, v.Index());
-                         
+             Assert.AreEqual(1, v.Index);
+ 
 -            cache.LocalEvict(new[] { 1 });
 +            // TODO: IGNITE-4535
 +            //cache.LocalEvict(new[] { 1 });
  
 -            Assert.AreEqual(0, cache.GetSize());
 +            //Assert.AreEqual(0, cache.GetSize());
  
-             Assert.AreEqual(1, cache.Get(1).Index());
+             Assert.AreEqual(1, cache.Get(1).Index);
  
              Assert.AreEqual(1, cache.GetSize());
          }

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/spark/src/test/java/org/apache/ignite/spark/JavaStandaloneIgniteRDDSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/web/src/test/java/org/apache/ignite/internal/websession/WebSessionSelfTest.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/yardstick/config/ignite-base-config.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/yardstick/pom.xml
----------------------------------------------------------------------
diff --cc modules/yardstick/pom.xml
index b24f67c,f65cdbd..fbc56d2
--- a/modules/yardstick/pom.xml
+++ b/modules/yardstick/pom.xml
@@@ -35,9 -35,8 +35,10 @@@
      <url>http://ignite.apache.org</url>
  
      <properties>
-         <yardstick.version>0.8.0</yardstick.version>
+         <yardstick.version>0.8.3</yardstick.version>
 +        <mysql.connector.version>5.1.39</mysql.connector.version>
 +        <postgres.connector.version>9.4.1208.jre7</postgres.connector.version>
+         <spring.version>4.1.0.RELEASE</spring.version>
      </properties>
  
      <dependencies>

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
----------------------------------------------------------------------
diff --cc modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
index a1c5087,6ccd04c..cef783e
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteBenchmarkArguments.java
@@@ -434,13 -400,20 +442,27 @@@ public class IgniteBenchmarkArguments 
      }
  
      /**
 +     * @return Page size in bytes.
 +     */
 +    public int getPageSize() {
 +        return pageSize;
 +    }
 +
 +    /**
+      * @return Number of additional caches.
+      */
+     public int additionalCachesNumber() {
+         return additionalCachesNum;
+     }
+ 
+     /**
+      * @return Name of cache which will be taken as base for additional caches.
+      */
+     public String additionalCachesName() {
+         return additionalCachesName;
+     }
+ 
+     /**
       * @return Description.
       */
      public String description() {

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/yardstick/src/main/java/org/apache/ignite/yardstick/IgniteNode.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/91210eb2/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetBenchmark.java
----------------------------------------------------------------------
diff --cc modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetBenchmark.java
index 918f571,9dd5058..4187c0b
--- a/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetBenchmark.java
+++ b/modules/yardstick/src/main/java/org/apache/ignite/yardstick/cache/IgniteGetBenchmark.java
@@@ -29,38 -29,37 +29,68 @@@ import static org.yardstickframework.Be
   * Ignite benchmark that performs get operations.
   */
  public class IgniteGetBenchmark extends IgniteCacheAbstractBenchmark<Integer, Object> {
 +    /** */
 +    private static final String CACHE_NAME = "atomic";
 +
 +    /** {@inheritDoc} */
 +    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
 +        super.setUp(cfg);
 +
 +        if (args.preloadAmount() > args.range())
 +            throw new IllegalArgumentException("Preloading amount (\"-pa\", \"--preloadAmount\") " +
 +                "must by less then the range (\"-r\", \"--range\").");
 +
 +        println(cfg, "Loading data...");
 +
 +        long start = System.nanoTime();
 +
 +        try (IgniteDataStreamer<Object, Object> dataLdr = ignite().dataStreamer(CACHE_NAME)) {
 +            for (int i = 0; i < args.preloadAmount(); i++) {
 +                dataLdr.addData(i, new SampleValue(i));
 +
 +                if (i % 100000 == 0) {
 +                    if (Thread.currentThread().isInterrupted())
 +                        break;
 +
 +                    println("Loaded entries: " + i);
 +                }
 +            }
 +        }
 +
 +        println(cfg, "Finished populating query data in " + ((System.nanoTime() - start) / 1_000_000) + " ms.");
 +    }
 +
      /** {@inheritDoc} */
+     @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
+         super.setUp(cfg);
+ 
+         if (args.preloadAmount() > args.range())
+             throw new IllegalArgumentException("Preloading amount (\"-pa\", \"--preloadAmount\") " +
+                 "must by less then the range (\"-r\", \"--range\").");
+ 
+         String cacheName = cache().getName();
+ 
+         println(cfg, "Loading data for cache: " + cacheName);
+ 
+         long start = System.nanoTime();
+ 
+         try (IgniteDataStreamer<Object, Object> dataLdr = ignite().dataStreamer(cacheName)) {
+             for (int i = 0; i < args.preloadAmount(); i++) {
+                 dataLdr.addData(i, new SampleValue(i));
+ 
+                 if (i % 100000 == 0) {
+                     if (Thread.currentThread().isInterrupted())
+                         break;
+ 
+                     println("Loaded entries: " + i);
+                 }
+             }
+         }
+ 
+         println(cfg, "Finished populating query data in " + ((System.nanoTime() - start) / 1_000_000) + " ms.");
+     }
+ 
+     /** {@inheritDoc} */
      @Override public boolean test(Map<Object, Object> ctx) throws Exception {
          int key = nextRandom(args.range());