You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by al...@apache.org on 2013/10/12 18:55:56 UTC

[1/2] git commit: stress: add username/password authentication support

Updated Branches:
  refs/heads/cassandra-2.0 3e7ebf84f -> 61dc59086


stress: add username/password authentication support

patch by Mikhail Stepura; reviewed by Aleksey Yeschenko for
CASSANDRA-6068


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

Branch: refs/heads/cassandra-2.0
Commit: 5fab1276cae60d59dfbeafab98b9c6d1bce2e7f0
Parents: 639c01a
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sat Oct 12 23:49:47 2013 +0700
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sat Oct 12 23:49:47 2013 +0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/stress/Session.java    | 32 ++++++++++++++++++--
 2 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5fab1276/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 7d63a4b..afb1464 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -21,6 +21,7 @@
  * Properly error out on CREATE INDEX for counters table (CASSANDRA-6160)
  * Handle JMX notification failure for repair (CASSANDRA-6097)
  * (Hadoop) Fetch no more than 128 splits in parallel (CASSANDRA-6169)
+ * stress: add username/password authentication support (CASSANDRA-6068)
 
 
 1.2.10

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5fab1276/tools/stress/src/org/apache/cassandra/stress/Session.java
----------------------------------------------------------------------
diff --git a/tools/stress/src/org/apache/cassandra/stress/Session.java b/tools/stress/src/org/apache/cassandra/stress/Session.java
index d527278..9c5d5a9 100644
--- a/tools/stress/src/org/apache/cassandra/stress/Session.java
+++ b/tools/stress/src/org/apache/cassandra/stress/Session.java
@@ -25,6 +25,8 @@ import java.util.*;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import com.yammer.metrics.Metrics;
+
+import org.apache.cassandra.auth.IAuthenticator;
 import org.apache.cassandra.cli.transport.FramedTransportFactory;
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.config.EncryptionOptions;
@@ -114,7 +116,9 @@ public class Session implements Serializable
         availableOptions.addOption("alg", SSL_ALGORITHM,         true, "SSL: algorithm (default: SunX509)");
         availableOptions.addOption("st", SSL_STORE_TYPE,         true, "SSL: type of store");
         availableOptions.addOption("ciphers", SSL_CIPHER_SUITES, true, "SSL: comma-separated list of encryption suites to use");
-        availableOptions.addOption("th",  "throttle",            true,   "Throttle the total number of operations per second to a maximum amount.");
+        availableOptions.addOption("th", "throttle",             true, "Throttle the total number of operations per second to a maximum amount.");
+        availableOptions.addOption("un", "username",             true, "Username for authentication.");
+        availableOptions.addOption("pw", "password",             true, "Password for authentication.");
     }
 
     private int numKeys          = 1000 * 1000;
@@ -131,6 +135,8 @@ public class Session implements Serializable
     private int superColumns     = 1;
     private String compression   = null;
     private String compactionStrategy = null;
+    private String username      = null;
+    private String password      = null;
 
     private int progressInterval  = 10;
     private int keysPerCall       = 1000;
@@ -438,6 +444,11 @@ public class Session implements Serializable
             if (cmd.hasOption("tf"))
                 transportFactory = validateAndSetTransportFactory(cmd.getOptionValue("tf"));
 
+            if (cmd.hasOption("un"))
+                username = cmd.getOptionValue("un");
+
+            if (cmd.hasOption("pw"))
+                password = cmd.getOptionValue("pw");
         }
         catch (ParseException e)
         {
@@ -725,17 +736,32 @@ public class Session implements Serializable
 
         try
         {
-            if(!transport.isOpen())
+            if (!transport.isOpen())
                 transport.open();
 
             if (enable_cql)
                 client.set_cql_version(cqlVersion);
 
             if (setKeyspace)
-            {
                 client.set_keyspace("Keyspace1");
+
+            if (username != null && password != null)
+            {
+                Map<String, String> credentials = new HashMap<String, String>();
+                credentials.put(IAuthenticator.USERNAME_KEY, username);
+                credentials.put(IAuthenticator.PASSWORD_KEY, password);
+                AuthenticationRequest authenticationRequest = new AuthenticationRequest(credentials);
+                client.login(authenticationRequest);
             }
         }
+        catch (AuthenticationException e)
+        {
+            throw new RuntimeException(e.getWhy());
+        }
+        catch (AuthorizationException e)
+        {
+            throw new RuntimeException(e.getWhy());
+        }
         catch (InvalidRequestException e)
         {
             throw new RuntimeException(e.getWhy());


[2/2] git commit: Merge branch 'cassandra-1.2' into cassandra-2.0

Posted by al...@apache.org.
Merge branch 'cassandra-1.2' into cassandra-2.0


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

Branch: refs/heads/cassandra-2.0
Commit: 61dc59086b08878239cc1125c738ec2b006c645a
Parents: 3e7ebf8 5fab127
Author: Aleksey Yeschenko <al...@apache.org>
Authored: Sat Oct 12 23:51:29 2013 +0700
Committer: Aleksey Yeschenko <al...@apache.org>
Committed: Sat Oct 12 23:51:29 2013 +0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../org/apache/cassandra/stress/Session.java    | 32 ++++++++++++++++++--
 2 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/61dc5908/CHANGES.txt
----------------------------------------------------------------------
diff --cc CHANGES.txt
index 0a00f2b,afb1464..0fc2a91
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@@ -46,43 -21,10 +46,44 @@@ Merged from 1.2
   * Properly error out on CREATE INDEX for counters table (CASSANDRA-6160)
   * Handle JMX notification failure for repair (CASSANDRA-6097)
   * (Hadoop) Fetch no more than 128 splits in parallel (CASSANDRA-6169)
+  * stress: add username/password authentication support (CASSANDRA-6068)
  
  
 -1.2.10
 +2.0.1
 + * Fix bug that could allow reading deleted data temporarily (CASSANDRA-6025)
 + * Improve memory use defaults (CASSANDRA-5069)
 + * Make ThriftServer more easlly extensible (CASSANDRA-6058)
 + * Remove Hadoop dependency from ITransportFactory (CASSANDRA-6062)
 + * add file_cache_size_in_mb setting (CASSANDRA-5661)
 + * Improve error message when yaml contains invalid properties (CASSANDRA-5958)
 + * Improve leveled compaction's ability to find non-overlapping L0 compactions
 +   to work on concurrently (CASSANDRA-5921)
 + * Notify indexer of columns shadowed by range tombstones (CASSANDRA-5614)
 + * Log Merkle tree stats (CASSANDRA-2698)
 + * Switch from crc32 to adler32 for compressed sstable checksums (CASSANDRA-5862)
 + * Improve offheap memcpy performance (CASSANDRA-5884)
 + * Use a range aware scanner for cleanup (CASSANDRA-2524)
 + * Cleanup doesn't need to inspect sstables that contain only local data
 +   (CASSANDRA-5722)
 + * Add ability for CQL3 to list partition keys (CASSANDRA-4536)
 + * Improve native protocol serialization (CASSANDRA-5664)
 + * Upgrade Thrift to 0.9.1 (CASSANDRA-5923)
 + * Require superuser status for adding triggers (CASSANDRA-5963)
 + * Make standalone scrubber handle old and new style leveled manifest
 +   (CASSANDRA-6005)
 + * Fix paxos bugs (CASSANDRA-6012, 6013, 6023)
 + * Fix paged ranges with multiple replicas (CASSANDRA-6004)
 + * Fix potential AssertionError during tracing (CASSANDRA-6041)
 + * Fix NPE in sstablesplit (CASSANDRA-6027)
 + * Migrate pre-2.0 key/value/column aliases to system.schema_columns
 +   (CASSANDRA-6009)
 + * Paging filter empty rows too agressively (CASSANDRA-6040)
 + * Support variadic parameters for IN clauses (CASSANDRA-4210)
 + * cqlsh: return the result of CAS writes (CASSANDRA-5796)
 + * Fix validation of IN clauses with 2ndary indexes (CASSANDRA-6050)
 + * Support named bind variables in CQL (CASSANDRA-6033)
 +Merged from 1.2:
 + * Allow cache-keys-to-save to be set at runtime (CASSANDRA-5980)
   * Avoid second-guessing out-of-space state (CASSANDRA-5605)
   * Tuning knobs for dealing with large blobs and many CFs (CASSANDRA-5982)
   * (Hadoop) Fix CQLRW for thrift tables (CASSANDRA-6002)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/61dc5908/tools/stress/src/org/apache/cassandra/stress/Session.java
----------------------------------------------------------------------