ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [18/28] ignite git commit: IGNITE-3819: ODBC: Improved error logging. This closes #1024.
Date Wed, 07 Sep 2016 09:25:46 GMT
IGNITE-3819: ODBC: Improved error logging. This closes #1024.


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

Branch: refs/heads/ignite-1.6.7-test
Commit: e3533010b584ba986196f9c7dbc36359aebd829e
Parents: df8163f
Author: Igor Sapego <isapego@gridgain.com>
Authored: Mon Sep 5 15:02:07 2016 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Sep 5 15:02:07 2016 +0300

----------------------------------------------------------------------
 .../processors/odbc/OdbcRequestHandler.java     | 31 +++++++++++++++-----
 1 file changed, 23 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e3533010/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
index 3f7d505..69bbc74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/odbc/OdbcRequestHandler.java
@@ -28,6 +28,7 @@ import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
 import org.apache.ignite.internal.processors.query.GridQueryTypeDescriptor;
 import org.apache.ignite.internal.util.GridSpinBusyLock;
 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.apache.ignite.lang.IgniteProductVersion;
 
@@ -97,16 +98,16 @@ public class OdbcRequestHandler {
                     return executeQuery(reqId, (OdbcQueryExecuteRequest)req);
 
                 case FETCH_SQL_QUERY:
-                    return fetchQuery((OdbcQueryFetchRequest)req);
+                    return fetchQuery(reqId, (OdbcQueryFetchRequest)req);
 
                 case CLOSE_SQL_QUERY:
-                    return closeQuery((OdbcQueryCloseRequest)req);
+                    return closeQuery(reqId, (OdbcQueryCloseRequest)req);
 
                 case GET_COLUMNS_META:
-                    return getColumnsMeta((OdbcQueryGetColumnsMetaRequest)req);
+                    return getColumnsMeta(reqId, (OdbcQueryGetColumnsMetaRequest)req);
 
                 case GET_TABLES_META:
-                    return getTablesMeta((OdbcQueryGetTablesMetaRequest)req);
+                    return getTablesMeta(reqId, (OdbcQueryGetTablesMetaRequest)req);
             }
 
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, "Unsupported ODBC request:
" + req);
@@ -189,6 +190,8 @@ public class OdbcRequestHandler {
         catch (Exception e) {
             qryCursors.remove(qryId);
 
+            U.error(log, "Failed to execute SQL query [reqId=" + reqId + ", req=" + req +
']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }
@@ -196,10 +199,11 @@ public class OdbcRequestHandler {
     /**
      * {@link OdbcQueryCloseRequest} command handler.
      *
+     * @param reqId Request ID.
      * @param req Execute query request.
      * @return Response.
      */
-    private OdbcResponse closeQuery(OdbcQueryCloseRequest req) {
+    private OdbcResponse closeQuery(long reqId, OdbcQueryCloseRequest req) {
         try {
             QueryCursor cur = qryCursors.get(req.queryId()).get1();
 
@@ -217,6 +221,8 @@ public class OdbcRequestHandler {
         catch (Exception e) {
             qryCursors.remove(req.queryId());
 
+            U.error(log, "Failed to close SQL query [reqId=" + reqId + ", req=" + req.queryId()
+ ']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }
@@ -224,10 +230,11 @@ public class OdbcRequestHandler {
     /**
      * {@link OdbcQueryFetchRequest} command handler.
      *
+     * @param reqId Request ID.
      * @param req Execute query request.
      * @return Response.
      */
-    private OdbcResponse fetchQuery(OdbcQueryFetchRequest req) {
+    private OdbcResponse fetchQuery(long reqId, OdbcQueryFetchRequest req) {
         try {
             Iterator cur = qryCursors.get(req.queryId()).get2();
 
@@ -244,6 +251,8 @@ public class OdbcRequestHandler {
             return new OdbcResponse(res);
         }
         catch (Exception e) {
+            U.error(log, "Failed to fetch SQL query result [reqId=" + reqId + ", req=" +
req + ']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }
@@ -251,10 +260,11 @@ public class OdbcRequestHandler {
     /**
      * {@link OdbcQueryGetColumnsMetaRequest} command handler.
      *
+     * @param reqId Request ID.
      * @param req Get columns metadata request.
      * @return Response.
      */
-    private OdbcResponse getColumnsMeta(OdbcQueryGetColumnsMetaRequest req) {
+    private OdbcResponse getColumnsMeta(long reqId, OdbcQueryGetColumnsMetaRequest req) {
         try {
             List<OdbcColumnMeta> meta = new ArrayList<>();
 
@@ -298,6 +308,8 @@ public class OdbcRequestHandler {
             return new OdbcResponse(res);
         }
         catch (Exception e) {
+            U.error(log, "Failed to get columns metadata [reqId=" + reqId + ", req=" + req
+ ']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }
@@ -305,10 +317,11 @@ public class OdbcRequestHandler {
     /**
      * {@link OdbcQueryGetTablesMetaRequest} command handler.
      *
+     * @param reqId Request ID.
      * @param req Get tables metadata request.
      * @return Response.
      */
-    private OdbcResponse getTablesMeta(OdbcQueryGetTablesMetaRequest req) {
+    private OdbcResponse getTablesMeta(long reqId, OdbcQueryGetTablesMetaRequest req) {
         try {
             List<OdbcTableMeta> meta = new ArrayList<>();
 
@@ -340,6 +353,8 @@ public class OdbcRequestHandler {
             return new OdbcResponse(res);
         }
         catch (Exception e) {
+            U.error(log, "Failed to get tables metadata [reqId=" + reqId + ", req=" + req
+ ']', e);
+
             return new OdbcResponse(OdbcResponse.STATUS_FAILED, e.getMessage());
         }
     }


Mime
View raw message