Updated Branches: refs/heads/trunk 9bf5b45d8 -> 5942afa89
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/trunk Commit: 1240c9bd228da81c4052eade48e40bc34ec1d34d Parents: 93da683 Author: Sylvain Lebresne <sylv...@datastax.com> Authored: Wed Oct 23 14:29:12 2013 +0200 Committer: Sylvain Lebresne <sylv...@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")))