Bug 837216 - REST api raw export as JSON fails for Oracle backend
Summary: REST api raw export as JSON fails for Oracle backend
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Core Server
Version: 4.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: RHQ 4.5.0
Assignee: Heiko W. Rupp
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: 844407
TreeView+ depends on / blocked
 
Reported: 2012-07-03 07:42 UTC by Heiko W. Rupp
Modified: 2013-09-01 10:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 844407 (view as bug list)
Environment:
Last Closed: 2013-09-01 10:10:33 UTC
Embargoed:


Attachments (Terms of Use)

Description Heiko W. Rupp 2012-07-03 07:42:17 UTC
For Oracle databases exporting raw metrics fails because of 

if (!rs.isLast()) in 
org.rhq.enterprise.server.rest.MetricHandlerBean.RawNumericStreamingOutput#write
as Oracle needs a special open mode for this cursor to use.

A working solution is changing
ps = connection.prepareStatement( sb.toString() );
to be
ps = connection.prepareStatement( sb.toString(), 
ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY );

It is not yet clear though if that has any performance impact and if there is a 
better solution.

We could run a count-query first and then loop, but effectively this means 
double work on the database too.

Comment 1 Heiko W. Rupp 2012-07-03 07:47:56 UTC
One could probably defer writing the ',' to the start of the inner loop when 
rs.next() is true.

boolean needsComma = false;
while (rs.next()) {
   if (needsComma) 
          pw.write(",");
   needsComma = true;
   pw.write("{");
   ...
}

Comment 2 Heiko W. Rupp 2012-07-03 10:55:30 UTC
master bbf48d7

Comment 3 Heiko W. Rupp 2013-09-01 10:10:33 UTC
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.


Note You need to log in before you can comment on or make changes to this bug.