Bug 1121220

Summary: Plugins with large description text for measurement def. cause ORA-12899
Product: [Other] RHQ Project Reporter: Elias Ross <genman>
Component: PluginsAssignee: Jay Shaughnessy <jshaughn>
Status: ON_QA --- QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 4.12CC: hrupp, jshaughn
Target Milestone: GA   
Target Release: RHQ 4.13   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Elias Ross 2014-07-18 16:46:55 UTC
Description of problem:

When deploying a plugin with a long description for a measurement, I saw this:

Caused by: java.sql.BatchUpdateException: ORA-12899: value too large for column "RHQ"."RHQ_MEASUREMENT_DEF"."DESCRIPTION" (actual: 565, maximum: 500)

	at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10296) [ojdbc6-12.1.0.1.0.jar:11.2.0.2.0]
	at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:216) [ojdbc6-12.1.0.1.0.jar:11.2.0.2.0]
	at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeBatch(CachedPreparedStatement.java:708)
	at org.jboss.jca.adapters.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:1077)
	at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:113) [hibernate-core-4.2.10.Final.jar:4.2.10.Final]
	... 421 more

RHQ should truncate the text to fit.

<metric property="cachePercentByteHit" description="Cache byte hit ratio expressed as percentage. Here we define byte hit ratio as ((number of bytes ... etc."/>

Version-Release number of selected component (if applicable): 4.12


How reproducible: Always


Steps to Reproduce:
1. Create plugin with description text > 500 characters
2. Deploy plugin

Actual results: Exception


Expected results: No error. Actually not 100% sure if truncation is always good or not, but better than the plugin not deploying in most cases.


Additional info:

Comment 1 Jay Shaughnessy 2014-07-18 21:15:36 UTC
master commit b7444d06129984ce2d07066b9ed60b826e2dc6e1
Author: Jay Shaughnessy <jshaughn>
Date:   Fri Jul 18 17:12:47 2014 -0400

    as far as I know we don't have a general mechanism for truncating on max
    length constraints.  So this is just a point solution for this BZ.  Before
    storing to the DB, ensure length constraints are met.