chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asrab...@apache.org
Subject svn commit: r779704 - in /hadoop/chukwa/branches/chukwa-0.1: ./ src/java/org/apache/hadoop/chukwa/database/ src/java/org/apache/hadoop/chukwa/hicc/ src/java/org/apache/hadoop/chukwa/util/ src/web/hicc/jsp/
Date Thu, 28 May 2009 18:15:33 GMT
Author: asrabkin
Date: Thu May 28 18:15:32 2009
New Revision: 779704

URL: http://svn.apache.org/viewvc?rev=779704&view=rev
Log:
CHUKWA-258. More detailed logging of SQL errors.

Modified:
    hadoop/chukwa/branches/chukwa-0.1/CHANGES.txt
    hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Aggregator.java
    hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Consolidator.java
    hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java
    hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/DatabaseWriter.java
    hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_dropdown.jsp
    hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_role.jsp

Modified: hadoop/chukwa/branches/chukwa-0.1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.1/CHANGES.txt?rev=779704&r1=779703&r2=779704&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.1/CHANGES.txt (original)
+++ hadoop/chukwa/branches/chukwa-0.1/CHANGES.txt Thu May 28 18:15:32 2009
@@ -38,6 +38,8 @@
 
   IMPROVEMENTS
 
+    CHUKWA-258. Better logging of SQL errors. (asrabkin)
+
     CHUKWA-226. Changed HDFS usage collection frequency from 10 minutes to 60 minutes. (Cheng
Zhang via Eric Yang)
 
     CHUKWA-219. Improved usability of host selector, and updated caching for host list. (Eric
Yang)

Modified: hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Aggregator.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Aggregator.java?rev=779704&r1=779703&r2=779704&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Aggregator.java
(original)
+++ hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Aggregator.java
Thu May 28 18:15:32 2009
@@ -24,7 +24,6 @@
 import java.io.IOException;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
 import java.text.ParsePosition;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;

Modified: hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Consolidator.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Consolidator.java?rev=779704&r1=779703&r2=779704&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Consolidator.java
(original)
+++ hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/database/Consolidator.java
Thu May 28 18:15:32 2009
@@ -119,7 +119,7 @@
         log.debug("Query: " + query);
         rs = db.query(query);
         if (rs == null) {
-          throw new SQLException("Table is undefined.");
+          throw new SQLException("Table "+ sumTable + " is undefined.");
         }
         ResultSetMetaData rmeta = rs.getMetaData();
         boolean empty = true;

Modified: hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java?rev=779704&r1=779703&r2=779704&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java
(original)
+++ hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/hicc/DatasetMapper.java
Thu May 28 18:15:32 2009
@@ -49,6 +49,7 @@
       // broken Java implementations
       org.apache.hadoop.chukwa.util.DriverManagerUtil.loadDriver().newInstance();
     } catch (Exception ex) {
+      log.error("failed to load driver", ex);
       // handle the error
     }
     Connection conn = null;
@@ -160,7 +161,7 @@
       // Now do something with the ResultSet ....
     } catch (SQLException ex) {
       // handle any errors
-      log.error("SQLException: " + ex.getMessage());
+      log.error("SQLException: " + ex.getMessage() + " on query: " + query);
       log.error("SQLState: " + ex.getSQLState());
       log.error("VendorError: " + ex.getErrorCode());
     } catch (Exception ex) {

Modified: hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/DatabaseWriter.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/DatabaseWriter.java?rev=779704&r1=779703&r2=779704&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/DatabaseWriter.java
(original)
+++ hadoop/chukwa/branches/chukwa-0.1/src/java/org/apache/hadoop/chukwa/util/DatabaseWriter.java
Thu May 28 18:15:32 2009
@@ -112,6 +112,8 @@
       rs = stmt.executeQuery(query);
     } catch (SQLException ex) {
       // handle any errors
+      //only log at debug level because caller will still see exception
+      //only log at debug level because caller will still see exception
       log.debug(ex, ex);
       log.debug("SQL Statement:" + query);
       log.debug("SQLException: " + ex.getMessage());

Modified: hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_dropdown.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_dropdown.jsp?rev=779704&r1=779703&r2=779704&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_dropdown.jsp (original)
+++ hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_dropdown.jsp Thu May
28 18:15:32 2009
@@ -63,6 +63,7 @@
     Connection conn = null;
     Statement stmt = null;
     ResultSet rs = null;
+    String query = "";
     try {
         HashMap<String, String> hosts = new HashMap<String, String>();
         try {
@@ -74,7 +75,6 @@
     }
            conn = org.apache.hadoop.chukwa.util.DriverManagerUtil.getConnection(jdbc);
            stmt = conn.createStatement();
-           String query = "";
            String jobId = (String)session.getAttribute("JobID");
            if(jobId!=null && !jobId.equals("null") && !jobId.equals(""))
{
                query = "select DISTINCT Machine from HodMachine where HodID='"+jobId+"' order
by Machine;";
@@ -124,9 +124,10 @@
            // Now do something with the ResultSet ....
        } catch (SQLException ex) {
            // handle any errors
-           out.println("SQLException: " + ex.getMessage());
-           out.println("SQLState: " + ex.getSQLState());
-           out.println("VendorError: " + ex.getErrorCode());
+           // FIXME: should we use Log4j here?
+           System.out.println("SQLException on query " + query +" " + ex.getMessage());
+           System.out.println("SQLState: " + ex.getSQLState());
+           System.out.println("VendorError: " + ex.getErrorCode());
        } finally {
            // it is a good idea to release
            // resources in a finally{} block

Modified: hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_role.jsp
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_role.jsp?rev=779704&r1=779703&r2=779704&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_role.jsp (original)
+++ hadoop/chukwa/branches/chukwa-0.1/src/web/hicc/jsp/host_selector_role.jsp Thu May 28 18:15:32
2009
@@ -62,6 +62,7 @@
          }
          roles.put(type,"checked");
        } catch(SQLException ex) {
+       	 System.out.println("SQLException "+ ex + " on query " + query);
          // Ignore if there is no data for the cluster.
        } finally {
          db.close();



Mime
View raw message