chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r787413 - in /hadoop/chukwa: branches/chukwa-0.2/CHANGES.txt branches/chukwa-0.2/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java trunk/CHANGES.txt trunk/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java
Date Mon, 22 Jun 2009 21:38:00 GMT
Author: eyang
Date: Mon Jun 22 21:37:59 2009
New Revision: 787413

URL: http://svn.apache.org/viewvc?rev=787413&view=rev
Log:
CHUKWA-324. For 0 matched field, changed MDL to skip empty SQL statement. (Eric Yang)

Modified:
    hadoop/chukwa/branches/chukwa-0.2/CHANGES.txt
    hadoop/chukwa/branches/chukwa-0.2/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java
    hadoop/chukwa/trunk/CHANGES.txt
    hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java

Modified: hadoop/chukwa/branches/chukwa-0.2/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.2/CHANGES.txt?rev=787413&r1=787412&r2=787413&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.2/CHANGES.txt (original)
+++ hadoop/chukwa/branches/chukwa-0.2/CHANGES.txt Mon Jun 22 21:37:59 2009
@@ -70,6 +70,8 @@
 
   BUG FIXES
 
+    CHUKWA-324. For 0 matched field, changed MDL to skip empty SQL statement. (Eric Yang)
+
     CHUKWA-321. Added 2 seconds sleep to avoid chukwa agent race condition. (Eric Yang)
 
     CHUKWA-319. Added cluster name to pig user aggregation script. (Cheng Zhang via Eric
Yang)

Modified: hadoop/chukwa/branches/chukwa-0.2/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/branches/chukwa-0.2/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java?rev=787413&r1=787412&r2=787413&view=diff
==============================================================================
--- hadoop/chukwa/branches/chukwa-0.2/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java
(original)
+++ hadoop/chukwa/branches/chukwa-0.2/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java
Mon Jun 22 21:37:59 2009
@@ -123,8 +123,9 @@
           metricName.append(recordType.substring(15));
           metricName.append(".");
           metricName.append(name);
-          if(!transformer.containsKey(metricName.toString())) {
-            transformer.put(metricName.toString().toLowerCase(), name);
+          String mdlKey = metricName.toString().toLowerCase();
+          if(!transformer.containsKey(mdlKey)) {
+            transformer.put(mdlKey, name);
           }          
         }
         rs.close();
@@ -456,25 +457,30 @@
             sql.append(sqlValues.toString());
             sql.append(";");
           } else {
-            sql.append("INSERT INTO ");
-            sql.append(table);
-            sql.append(" SET ");
-            sql.append(sqlValues.toString());
-            sql.append(" ON DUPLICATE KEY UPDATE ");
-            sql.append(sqlValues.toString());
-            sql.append(";");
-          }
-          log.trace(sql);
-          if (batchMode) {
-            stmt.addBatch(sql.toString());
-            batch++;
-          } else {
-            stmt.execute(sql.toString());
+            if(sqlValues.length() > 0) {
+              sql.append("INSERT INTO ");
+              sql.append(table);
+              sql.append(" SET ");
+              sql.append(sqlValues.toString());
+              sql.append(" ON DUPLICATE KEY UPDATE ");
+              sql.append(sqlValues.toString());
+              sql.append(";");
+            }
           }
-          if (batchMode && batch > 20000) {
-            int[] updateCounts = stmt.executeBatch();
-            log.info("batchMode insert=" + updateCounts.length);
-            batch = 0;
+          if(sql.length() > 0) {
+            log.trace(sql);
+          
+            if (batchMode) {
+              stmt.addBatch(sql.toString());
+              batch++;
+            } else {
+              stmt.execute(sql.toString());
+            }
+            if (batchMode && batch > 20000) {
+              int[] updateCounts = stmt.executeBatch();
+              log.info("Batch mode inserted=" + updateCounts.length + "records.");
+              batch = 0;
+            }
           }
         }
 
@@ -482,7 +488,7 @@
 
       if (batchMode) {
         int[] updateCounts = stmt.executeBatch();
-        log.info("batchMode insert=" + updateCounts.length);
+        log.info("Batch mode inserted=" + updateCounts.length + "records.");
       }
     } catch (SQLException ex) {
       // handle any errors

Modified: hadoop/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/CHANGES.txt?rev=787413&r1=787412&r2=787413&view=diff
==============================================================================
--- hadoop/chukwa/trunk/CHANGES.txt (original)
+++ hadoop/chukwa/trunk/CHANGES.txt Mon Jun 22 21:37:59 2009
@@ -72,6 +72,8 @@
 
   BUG FIXES
 
+    CHUKWA-324. For 0 matched field, changed MDL to skip empty SQL statement. (Eric Yang)
+
     CHUKWA-321. Added 2 seconds sleep to avoid chukwa agent race condition. (Eric Yang)
 
     CHUKWA-319. Added cluster name to pig user aggregation script. (Cheng Zhang via Eric
Yang)

Modified: hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java?rev=787413&r1=787412&r2=787413&view=diff
==============================================================================
--- hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java
(original)
+++ hadoop/chukwa/trunk/src/java/org/apache/hadoop/chukwa/dataloader/MetricDataLoader.java
Mon Jun 22 21:37:59 2009
@@ -123,8 +123,9 @@
           metricName.append(recordType.substring(15));
           metricName.append(".");
           metricName.append(name);
-          if(!transformer.containsKey(metricName.toString())) {
-            transformer.put(metricName.toString().toLowerCase(), name);
+          String mdlKey = metricName.toString().toLowerCase();
+          if(!transformer.containsKey(mdlKey)) {
+            transformer.put(mdlKey, name);
           }          
         }
         rs.close();
@@ -456,25 +457,30 @@
             sql.append(sqlValues.toString());
             sql.append(";");
           } else {
-            sql.append("INSERT INTO ");
-            sql.append(table);
-            sql.append(" SET ");
-            sql.append(sqlValues.toString());
-            sql.append(" ON DUPLICATE KEY UPDATE ");
-            sql.append(sqlValues.toString());
-            sql.append(";");
-          }
-          log.trace(sql);
-          if (batchMode) {
-            stmt.addBatch(sql.toString());
-            batch++;
-          } else {
-            stmt.execute(sql.toString());
+            if(sqlValues.length() > 0) {
+              sql.append("INSERT INTO ");
+              sql.append(table);
+              sql.append(" SET ");
+              sql.append(sqlValues.toString());
+              sql.append(" ON DUPLICATE KEY UPDATE ");
+              sql.append(sqlValues.toString());
+              sql.append(";");
+            }
           }
-          if (batchMode && batch > 20000) {
-            int[] updateCounts = stmt.executeBatch();
-            log.info("batchMode insert=" + updateCounts.length);
-            batch = 0;
+          if(sql.length() > 0) {
+            log.trace(sql);
+          
+            if (batchMode) {
+              stmt.addBatch(sql.toString());
+              batch++;
+            } else {
+              stmt.execute(sql.toString());
+            }
+            if (batchMode && batch > 20000) {
+              int[] updateCounts = stmt.executeBatch();
+              log.info("Batch mode inserted=" + updateCounts.length + "records.");
+              batch = 0;
+            }
           }
         }
 
@@ -482,7 +488,7 @@
 
       if (batchMode) {
         int[] updateCounts = stmt.executeBatch();
-        log.info("batchMode insert=" + updateCounts.length);
+        log.info("Batch mode inserted=" + updateCounts.length + "records.");
       }
     } catch (SQLException ex) {
       // handle any errors



Mime
View raw message