Bug 844407 - REST api raw export as JSON fails for Oracle backend
REST api raw export as JSON fails for Oracle backend
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: Core Server (Show other bugs)
4.4
Unspecified Unspecified
unspecified Severity unspecified (vote)
: ---
: JON 3.1.1
Assigned To: Heiko W. Rupp
Mike Foley
:
Depends On: 837216
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-30 09:57 EDT by Heiko W. Rupp
Modified: 2013-09-03 11:10 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 837216
Environment:
Last Closed: 2013-09-03 11:10:54 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Heiko W. Rupp 2012-07-30 09:57:52 EDT
+++ This bug was initially created as a clone of Bug #837216 +++

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.

--- Additional comment from hrupp@redhat.com on 2012-07-03 03:47:56 EDT ---

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("{");
   ...
}

--- Additional comment from hrupp@redhat.com on 2012-07-03 06:55:30 EDT ---

master bbf48d7
Comment 1 Heiko W. Rupp 2012-07-30 11:44:25 EDT
release branch 679c8d573f29
Comment 2 John Sanda 2012-08-02 14:51:48 EDT
JON 3.1.1 ER1 build is available. Moving to ON_QA.

https://brewweb.devel.redhat.com/buildinfo?buildID=226942
Comment 4 Heiko W. Rupp 2013-09-03 11:10:54 EDT
Bulk closing of old issues in VERIFIED state.

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