You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by ght230 <gh...@163.com> on 2016/11/14 14:44:41 UTC

How can I detect DB writing abnormal in case of write-behind?

Hello:

I am trying to put some data to a cache configured with write-through and write-behind.

In this process, something wrong in the DB, then data can not be written into it.

I want to know how can I detect the database error as soon as possible?

Can I detect it by the metrics of the CacheMetrics?

If the answer is "YES", there are so many metrics in the class "org.apache.ignite.cache.CacheMetrics", which one can I use?

Re: How can I detect DB writing abnormal in case of write-behind?

Posted by vdpyatkov <vl...@gmail.com>.
Hi,

If getCache Puts still 0, this mean entry does not loaded even to cache.
Also, you can iterate all entry in cache and check is same rows exist on
database.

What are you see into logs, when entries are not hit to database?
Could you please attach logs files?



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-can-I-detect-DB-writing-abnormal-in-case-of-write-behind-tp8954p9022.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How can I detect DB writing abnormal in case of write-behind?

Posted by ght230 <gh...@163.com>.
I had tried to enable cache statistics, but it did not work.

my cache configure as following:

	<bean id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
		<property name="peerClassLoadingEnabled" value="false" />
		<property name="gridName" value="ghttest" />
		<property name="metricsLogFrequency" value="2000" />
		<property name="metricsUpdateFrequency" value="2000" />
		<property name="networkTimeout" value="300000" />
		<property name="cacheConfiguration">
			<list>
				<bean class="org.apache.ignite.configuration.CacheConfiguration">
					<property name="name" value="orderGoodCache" />
					<property name="atomicityMode" value="ATOMIC" />
					<property name="statisticsEnabled" value="true"/>
					<property name="cacheMode" value="PARTITIONED" />
					<property name="backups" value="0" />
					<property name="cacheStoreFactory" ref="orderPojoStoreFactory" />
					<property name="readThrough" value="false" />
					<property name="writeThrough" value="true" />
					<property name="writeBehindEnabled" value="true" />
					<property name="writeBehindFlushSize" value="10240" />
					<property name="writeBehindFlushFrequency" value="5000" />
					<property name="writeBehindFlushThreadCount" value="2" />
					<property name="indexedTypes">
						<array>
							<value>org.apache.ignite.OrderGood2Key</value>
							<value>org.apache.ignite.OrderGood2</value>
						</array>
					</property>
				</bean>
			</list>
		</property>
	</bean>



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-can-I-detect-DB-writing-abnormal-in-case-of-write-behind-tp8954p8997.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How can I detect DB writing abnormal in case of write-behind?

Posted by vdpyatkov <vl...@gmail.com>.
Hi,

You should enable cache statistics:

<bean class="org.apache.ignite.configuration.CacheConfiguration">        
        <property name="statisticsEnabled" value="true"/>
...

for get correct value from metrics.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-can-I-detect-DB-writing-abnormal-in-case-of-write-behind-tp8954p8989.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How can I detect DB writing abnormal in case of write-behind?

Posted by ght230 <gh...@163.com>.
I am not understand what you mean: "In this process, something wrong in the
DB, then data can not be written into it."
-->For one case, some field setting was wrong in DB, such as the field
length of DB is less than that in the Pojo.
    For another case, when process write-behind, the DB down.
    Both the above cases will make the data can not be written into the DB.

How did you detect this?
-->This is exactly what I want to know.
    For the first case above, It will cause Ignite down.
    Is there any metrics of the cache can I use to know that the DB is
abnormal.

If "write behind" flag was set as true, a data will inserted into DB
asynchronously (in dedicated thread). You should to wait when the data will
be saved into DB.

By cache metrics you can watch over number of "put" operation on cache
(org.apache.ignite.cache.CacheMetrics#getCachePuts).
-->I had tried to use getCachePuts, but it is always 0.



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-can-I-detect-DB-writing-abnormal-in-case-of-write-behind-tp8954p8979.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.

Re: How can I detect DB writing abnormal in case of write-behind?

Posted by Vladislav Pyatkov <vl...@gmail.com>.
Hi,

I am not understand what you mean: "In this process, something wrong in the
DB, then data can not be written into it."

How did you detect this?
If "write behind" flag was set as true, a data will inserted into DB
asynchronously (in dedicated thread). You should to wait when the data will
be saved into DB.

By cache metrics you can watch over number of "put" operation on cache
(org.apache.ignite.cache.CacheMetrics#getCachePuts).

On Mon, Nov 14, 2016 at 5:44 PM, ght230 <gh...@163.com> wrote:

> Hello:
>
> I am trying to put some data to a cache configured with
> write-through and write-behind.
>
> In this process, something wrong in the DB, then data
> can not be written into it.
>
> I want to know how can I detect the database error as soon as possible?
>
> Can I detect it by the metrics of the CacheMetrics?
>
> If the answer is "YES", there are so many metrics in the
> class "org.apache.ignite.cache.CacheMetrics", which one can I use?
>



-- 
Vladislav Pyatkov