mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Add indexes for vm_stats (#8737)
* Add indexes for vm_stats * Remove index on timestamp * Chnage index from vm_id,timestamp to vm_id
This commit is contained in:
parent
308ed1399e
commit
24d5c45f7f
@ -16,16 +16,20 @@
|
|||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.upgrade.dao;
|
package com.cloud.upgrade.dao;
|
||||||
|
|
||||||
|
import com.cloud.upgrade.SystemVmTemplateRegistration;
|
||||||
import com.cloud.utils.exception.CloudRuntimeException;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
||||||
public class Upgrade41900to41910 implements DbUpgrade {
|
public class Upgrade41900to41910 implements DbUpgrade, DbUpgradeSystemVmTemplate {
|
||||||
|
final static Logger LOG = Logger.getLogger(Upgrade41900to41910.class);
|
||||||
|
private SystemVmTemplateRegistration systemVmTemplateRegistration;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getUpgradableVersionRange() {
|
public String[] getUpgradableVersionRange() {
|
||||||
return new String[] {"4.19.0.0", "4.19.1.0"};
|
return new String[]{"4.19.0.0", "4.19.1.0"};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -46,11 +50,12 @@ public class Upgrade41900to41910 implements DbUpgrade {
|
|||||||
throw new CloudRuntimeException("Unable to find " + scriptFile);
|
throw new CloudRuntimeException("Unable to find " + scriptFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new InputStream[] {script};
|
return new InputStream[]{script};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performDataMigration(Connection conn) {
|
public void performDataMigration(Connection conn) {
|
||||||
|
addIndexes(conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,6 +66,25 @@ public class Upgrade41900to41910 implements DbUpgrade {
|
|||||||
throw new CloudRuntimeException("Unable to find " + scriptFile);
|
throw new CloudRuntimeException("Unable to find " + scriptFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new InputStream[] {script};
|
return new InputStream[]{script};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addIndexes(Connection conn) {
|
||||||
|
DbUpgradeUtils.addIndexIfNeeded(conn, "vm_stats", "vm_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSystemVmTemplates(Connection conn) {
|
||||||
|
LOG.debug("Updating System Vm template IDs");
|
||||||
|
initSystemVmTemplateRegistration();
|
||||||
|
try {
|
||||||
|
systemVmTemplateRegistration.updateSystemVmTemplates(conn);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CloudRuntimeException("Failed to find / register SystemVM template(s)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSystemVmTemplateRegistration() {
|
||||||
|
systemVmTemplateRegistration = new SystemVmTemplateRegistration("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user