}
private void clearProperties() {
- databaseSession.createQuery("delete " + FROM_GLOBAL_PROPERTIES).executeUpdate();
+ // "sonar.core.*" properties should not be cleared, most notably "sonar.core.id" which is the unique key used to identify the server
+ // and which is used by the batch to verify that it connects to the same DB as the remote server (see SONAR-3126).
+ databaseSession.createQuery("delete " + FROM_GLOBAL_PROPERTIES + " and prop_key NOT LIKE 'sonar.core.%'").executeUpdate();
}
public void configure(XStream xStream) {
<properties id="4" prop_key="user_prop" text_value="[null]" resource_id="[null]" user_id="3"/>
<properties id="5" prop_key="favorite" text_value="[null]" resource_id="8" user_id="3"/>
- <properties id="6" prop_key="key1" text_value="value1" resource_id="[null]" user_id="[null]"/>
- <properties id="7" prop_key="key2" text_value="value2" resource_id="[null]" user_id="[null]"/>
- <properties id="8" prop_key="key3" text_value="value3" resource_id="[null]" user_id="[null]"/>
+ <!-- Sonar Core properties that were not purged -->
+ <properties id="6" prop_key="sonar.core.id" text_value="123456" resource_id="[null]" user_id="[null]"/>
+ <properties id="7" prop_key="sonar.core.version" text_value="3.1" resource_id="[null]" user_id="[null]"/>
+ <properties id="8" prop_key="sonar.core.startTime" text_value="2012-04-19T11:01:45+0200" resource_id="[null]" user_id="[null]"/>
+
+ <!-- New properties that were imported -->
+ <properties id="9" prop_key="key1" text_value="value1" resource_id="[null]" user_id="[null]"/>
+ <properties id="10" prop_key="key2" text_value="value2" resource_id="[null]" user_id="[null]"/>
+ <properties id="11" prop_key="key3" text_value="value3" resource_id="[null]" user_id="[null]"/>
</dataset>
\ No newline at end of file
<properties id="4" prop_key="user_prop" text_value="[null]" resource_id="[null]" user_id="3"/>
<properties id="5" prop_key="favorite" text_value="[null]" resource_id="8" user_id="3"/>
+ <!-- Sonar Core properties that must not be purged -->
+ <properties id="6" prop_key="sonar.core.id" text_value="123456" resource_id="[null]" user_id="[null]"/>
+ <properties id="7" prop_key="sonar.core.version" text_value="3.1" resource_id="[null]" user_id="[null]"/>
+ <properties id="8" prop_key="sonar.core.startTime" text_value="2012-04-19T11:01:45+0200" resource_id="[null]" user_id="[null]"/>
+
</dataset>
\ No newline at end of file