cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject git commit: Fix potential NPE while loading paxos state
Date Wed, 23 Oct 2013 12:30:07 GMT
Updated Branches:
  refs/heads/cassandra-2.0 93da683e0 -> 1240c9bd2


Fix potential NPE while loading paxos state

patch by slebresne; reviewed by jbellis for CASSANDRA-6211


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

Branch: refs/heads/cassandra-2.0
Commit: 1240c9bd228da81c4052eade48e40bc34ec1d34d
Parents: 93da683
Author: Sylvain Lebresne <sylvain@datastax.com>
Authored: Wed Oct 23 14:29:12 2013 +0200
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Wed Oct 23 14:29:12 2013 +0200

----------------------------------------------------------------------
 CHANGES.txt                                          | 1 +
 src/java/org/apache/cassandra/db/SystemKeyspace.java | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/1240c9bd/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 1cb580d..1df6ade 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,6 @@
 2.0.3
  * Reject bootstrapping if the node already exists in gossip (CASSANDRA-5571)
+ * Fix NPE while loading paxos state (CASSANDRA-6211)
 Merged from 1.2:
  * Fix altering column types (CASSANDRA-6185)
  * cqlsh: fix CREATE/ALTER WITH completion (CASSANDRA-6196)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/1240c9bd/src/java/org/apache/cassandra/db/SystemKeyspace.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemKeyspace.java b/src/java/org/apache/cassandra/db/SystemKeyspace.java
index e5f2025..1917bc8 100644
--- a/src/java/org/apache/cassandra/db/SystemKeyspace.java
+++ b/src/java/org/apache/cassandra/db/SystemKeyspace.java
@@ -844,7 +844,9 @@ public class SystemKeyspace
         if (results.isEmpty())
             return new PaxosState(key, metadata);
         UntypedResultSet.Row row = results.one();
-        Commit promised = new Commit(key, row.getUUID("in_progress_ballot"), EmptyColumns.factory.create(metadata));
+        Commit promised = row.has("in_progress_ballot")
+                        ? new Commit(key, row.getUUID("in_progress_ballot"), EmptyColumns.factory.create(metadata))
+                        : Commit.emptyCommit(key, metadata);
         // either we have both a recently accepted ballot and update or we have neither
         Commit accepted = row.has("proposal")
                         ? new Commit(key, row.getUUID("proposal_ballot"), ColumnFamily.fromBytes(row.getBytes("proposal")))


Mime
View raw message