Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-8909

Replication Strategy creation errors are lost in try/catch

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Low
    • Resolution: Fixed
    • Fix Version/s: 2.0.15, 2.1.5
    • Component/s: None
    • Labels:
      None

      Description

      I was initially executing a bad cassandra-stress command and was getting this error:

      Unable to create stress keyspace: Error constructing replication strategy class
      

      with the following command:

      cassandra-stress -o insert --replication-strategy NetworkTopologyStrategy --strategy-properties dc1:1,dc2:1 --replication-factor 1
      

      After digging in the code, I noticed that the error displayed was not the one thrown by the replication strategy code and that the try/catch block could be improved. Basically, the Constructor.newInstance can throw an InvocationTargetException, which provide a better error report.

      I think this improvement can also be done in 2.1 (not tested yet). If my attached patch is acceptable, I will test and provide the right version for 2.1 and trunk.

      With the patch, I can see the proper error when executing my bad command:

      Unable to create stress keyspace: replication_factor is an option for SimpleStrategy, not NetworkTopologyStrategy
      

        Attachments

          Activity

            People

            • Assignee:
              aboudreault Alan Boudreault
              Reporter:
              aboudreault Alan Boudreault
              Authors:
              Alan Boudreault
              Reviewers:
              Sam Tunnicliffe
              Tester:
              Alan Boudreault
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: