|
From: Laurent G. <lg...@gm...> - 2009-01-21 16:18:03
|
Alright, hate to bring this back from the dead after so long, but I just now
have had a chance to play around with jrtg again.
Looks like your recommendations regarding how to handle db maintenances were
right on.
Everything worked as desired, unfortunately I am now plagued by following
log messages:
Jan 21, 2009 11:08:54 AM com.virtela.poller.DBDriver insert
WARNING: insert() error.
com.virtela.poller.DBDriver$DBException: Error inserting: IID:3263
PollTime:1232554125296 Name:ifOutUcastPkts Value:1662038 Delta:298666
at com.virtela.poller.RTGDBDriver.insert(RTGDBDriver.java:189)
at com.virtela.poller.DBDriver.insert(DBDriver.java:220)
at com.virtela.poller.DBDriver.insert(DBDriver.java:200)
at com.virtela.poller.DBBuffer$3.call(DBBuffer.java:253)
at com.virtela.poller.DBBuffer$3.call(DBBuffer.java:250)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.sql.SQLException: Can't call commit when autocommit=true
at com.mysql.jdbc.Connection.commit(Connection.java:2161)
at
com.virtela.poller.ConnectionWrapper.commit(ConnectionWrapper.java:90)
at com.virtela.poller.RTGDBDriver.insert(RTGDBDriver.java:182)
... 9 more
I have checked my tables, and it doesn't appear as if the insert actually
fails. Can you make sense of those exceptions?
- Laurent
On Fri, Dec 5, 2008 at 6:51 PM, Leech, Jonathan <jl...@vi...> wrote:
> Laurent,
>
> I think you've just got the name of the object wrong. It might be:
> com.virtela.poller:type=DBDriver,name=inserter (the name depends on what its
> named in the config.properties file). The command line jmxclient will list
> all the available objects with / without certain cmd line arguments, and if
> given an object will list the available properties and methods on the
> object. So you can use it to do introspection.
> Also you can use the jconsole application that comes with the jdk, it
> shows everything and does some other usefult things like graphing properties
> over time.
>
> -Jonathan
>
>
> ------------------------------
> *From:* Laurent Geyer [mailto:lg...@gm...]
> *Sent:* Friday, December 05, 2008 4:44 PM
> *To:* Leech, Jonathan
> *Cc:* jrt...@li...
> *Subject:* Re: [Jrtg-users] insert() error - NullPointerException
>
> Jonathan,
>
> Alright, that makes sense. Now I'm just having some difficulties accessing
> those methods through JMX.
>
> lgeyer@xxx:/usr/local/jrtg$ java -jar
> /usr/local/bin/cmdline-jmxclient-0.10.3.jar - localhost:8089
> com.virtela.poller:type=RTGDBDriver pauseDBInserts
> 12/05/2008 18:42:40 -0500 org.archive.jmx.Client
> com.virtela.poller:type=RTGDBDriver is not a registered bean
>
> lgeyer@xxx:/usr/local/jrtg$ java -jar
> /usr/local/bin/cmdline-jmxclient-0.10.3.jar - localhost:8089
> com.virtela.poller:type=DBDriver pauseDBInserts
> 12/05/2008 18:42:47 -0500 org.archive.jmx.Client
> com.virtela.poller:type=DBDriver is not a registered bean
>
> What am I missing here?
>
> Thanks for your help,
>
> Laurent
>
> On Fri, Dec 5, 2008 at 5:46 PM, Leech, Jonathan <jl...@vi...>
> wrote:
>
>> Laurent,
>>
>> Very good question. The RTGDBDriver has the commitAllTransactions(), and
>> reconnectAll() methods exposed through JMX to do extactly that externally.
>> This would help in scenarios of a planned maintenance, or an outage that is
>> detected quickly. Also you should call pauseDBInserts() on the DBBuffer
>> first. So the steps would be
>> 1) pauseDBInserts()
>> 2) commitAllTransactions()
>> 3) perform database maintenance
>> 4) reconnectAll()
>> 5) resumeDBInserts().
>>
>> JRTG has not yet been instrumented to automatically reconnect to the
>> database after certain fatal errors. The place to do this would be either
>> the DBDriver class or in the ConnectionWrapper class. I intended to do so in
>> the ConnectionWrapper class, there is even a comment at the top: // TODO:
>> attempt to reconnect to the database after certain SQL errors. This
>> recquires some knowledge of which errors should result in a reconnection and
>> which shouldn't. A good place to find this kind of information might be
>> JBoss connection pool logic, or a similar connection pooling library.
>>
>> The NPE is a bug. Line 193 of JRTGDBDriver should be modified to read: if
>> (ps != null) ps.close(); It is masking the real SQLExceptions caused by the
>> database restart.
>>
>> Also, if you have a firewall or some other evil device in between your
>> poller and database, you should probably also add a call to
>> setQueryTimeout() on the PreparedStatement prior to ps.execute() on line
>> 178. I don't know specifically how the mySQL JDBC driver would react to a
>> connection dropped by a firewall, or if it implements setQueryTimeout(), but
>> I can attest to the fact that the Oracle JDBC driver will hang indefinitely
>> on the execute() method if the connection is dropped, unless a timeout is
>> provided.
>>
>> -Jonathan
>>
>> ------------------------------
>> *From:* Laurent Geyer [mailto:lg...@gm...]
>> *Sent:* Friday, December 05, 2008 1:52 PM
>> *To:* jrt...@li...
>> *Subject:* [Jrtg-users] insert() error - NullPointerException
>>
>> Hi,
>>
>> So far so good. Have had jrtg running little over a month now and it's
>> been solid.
>>
>> Unfortunately today I noticed I lost about two days worth of data. The
>> date it stopped collecting coincided with a MySQL server restart following a
>> MySQL upgrade.
>>
>> Dec 5, 2008 3:44:34 PM com.virtela.poller.DBDriver insert
>> WARNING: insert() error.
>> java.lang.NullPointerException
>> at com.virtela.poller.RTGDBDriver.insert(RTGDBDriver.java:193)
>> at com.virtela.poller.DBDriver.insert(DBDriver.java:220)
>> at com.virtela.poller.DBDriver.insert(DBDriver.java:200)
>> at com.virtela.poller.DBBuffer$3.call(DBBuffer.java:253)
>> at com.virtela.poller.DBBuffer$3.call(DBBuffer.java:250)
>> at
>> java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
>> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>> at java.lang.Thread.run(Thread.java:619)
>>
>> Is there any way I can reconnect the MySQL session and commit the inserts
>> following a restart or loss of connectivity?
>>
>> Thanks,
>>
>> Laurent
>>
>>
>>
>
|