ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbhowm...@apache.org
Subject ambari git commit: AMBARI-16256. Upgrade throws error while updating the sequence table. (dipayanb)
Date Wed, 04 May 2016 18:39:12 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 864f6de29 -> 8b77766f4


AMBARI-16256. Upgrade throws error while updating the sequence table. (dipayanb)


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

Branch: refs/heads/trunk
Commit: 8b77766f4fc4efc951d353006e541e8b48769391
Parents: 864f6de
Author: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Authored: Wed May 4 22:36:08 2016 +0530
Committer: Dipayan Bhowmick <dipayan.bhowmick@gmail.com>
Committed: Thu May 5 00:08:47 2016 +0530

----------------------------------------------------------------------
 .../org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8b77766f/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
index 1212d6e..17f9fe1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalog.java
@@ -167,9 +167,9 @@ public abstract class AbstractUpgradeCatalog implements UpgradeCatalog
{
     try {
       statement = dbAccessor.getConnection().createStatement();
       if (statement != null) {
-        rs = statement.executeQuery(String.format("SELECT COUNT(*) from %s where sequence_name='%s'",
ambariSequencesTable, seqName));
+        rs = statement.executeQuery(String.format("SELECT sequence_value from %s where sequence_name='%s'",
ambariSequencesTable, seqName));
 
-        if(rs != null) {
+        if((rs != null) && rs.next()) {
           value = rs.getInt(1);
           dbAccessor.executeUpdate(String.format("UPDATE %s SET sequence_value = sequence_value
+ 1 where sequence_name='%s'", ambariSequencesTable, seqName));
         } else {


Mime
View raw message