3

I'm attempting to create a clone of the existing java Sonar Way Quality Profile. I'm following the instructions at http://docs.sonarqube.org/display/SONAR/Quality+Profiles for "How do I ... Copy the rules from one profile to another?" SQ 5.6/Java plugin 4.2.

  1. Create a new Quality Profile (MyQP with language type java). [Creation successful. 0 active rules, as expected.]

MyQP created - 0 active rules

  1. Filter on Sonar Way (java) Quality Profile to get 235 active code rules.

  2. Bulk Change -> Activate In MyQP. [Seems to work - "235 rule(s) changed in MyQP"].

  3. But, MyQP when "active" has "No Coding Rules" and my list of rules is completely blank. However, when MyQP is "inactive" I get a list of all 386 java rules (some of which are active and some are not). If I Bulk Change -> Activate in MyQP all 386 rules something happens (all the Deactivated rules seem to activate), but I still can't see any of them (No Coding Rules) when I change the status of MyQP from inactive -> active (under the Quality Profile section).

Error log:

ERROR web[o.s.s.es.BulkIndexer] Fail to execute bulk index request: Bulk[237 index request(s) on index rules and type activeRule] org.elasticsearch.transport.RemoteTransportException: [sonar-1474516381064][inet[/127.0.0.1:9001]][indices:data/wr‌​ite/bulk] Caused by: org.elasticsearch.index.mapper.MapperParsingException: The provided routing value [common-java] doesn't match the routing key stored in the document: [common-java:DuplicatedBlocks]

Am I missing something? I think I'm following the directions to the letter.

Luís Cruz
  • 14,780
  • 16
  • 68
  • 100
Darrin
  • 55
  • 1
  • 3
  • Any errors in the server log? – G. Ann - SonarSource Team Sep 26 '16 at 11:54
  • instead of creating a new empty profile, why don't you copy directly the Sonar Was QP? You'll be able to name it and add other rules afterwards? – Teryk - SonarSource Sep 26 '16 at 12:44
  • @G.Ann-SonarSourceTeam. Yes, turns out there are server log errors. See below. – Darrin Sep 26 '16 at 15:12
  • @Teryk-SonarSourceTeam. Similar error in the log when I just try to copy. The relevant message seems to be: ERROR web[o.s.s.es.BulkIndexer] Fail to execute bulk index request: Bulk[237 index request(s) on index rules and type activeRule] org.elasticsearch.transport.RemoteTransportException: [sonar-1474516381064][inet[/127.0.0.1:9001]][indices:data/write/bulk] Caused by: org.elasticsearch.index.mapper.MapperParsingException: The provided routing value [common-java] doesn't match the routing key stored in the document: [common-java:DuplicatedBlocks] – Darrin Sep 26 '16 at 15:28
  • 1
    drop the directory data/es and restart the server. Please put the log error in your question – Teryk - SonarSource Sep 27 '16 at 12:03
  • Yes, it seems my /opt/sonar/data/es directory (and its contents) were the issue. I deleted that directory, restarted the server, and now this works. Thanks for your help. – Darrin Sep 27 '16 at 17:17
  • I added the answer, thanks to accept it – Teryk - SonarSource Sep 28 '16 at 12:21

1 Answers1

5

Drop the directory data/es and restart the server. Your ES data must be corrupted.