Re: [Dev] Siddhi Store Redis - update or insert into table (on Redis) won't work

2018-11-24 Thread Anusha Jayasundara
Hi Bathiyar,

We followed up the above scenario and we could not observe any issues
related to Redis "update of insert" process. In Redis implementation, if
the given command is "update or insert", we will create a HashSet according
to our mapping in Redis side, if it exists, the old one will get updated
with the new values.
In order to exactly identify the issue could you please share the log
output of the "ThresholdTableStream " stream from above execution plan.


Thank You,
Anusha

On Sat, Nov 24, 2018 at 7:30 PM Mohanadarshan Vivekanandalingam <
mo...@wso2.com> wrote:

> Hi Anusha,
>
> Can you please followup and respond to this..
>
> Thanks,
> Mohan
>
>
> On Tue, Nov 20, 2018 at 3:57 PM Bahtiyar KARANLIK <
> bahtiyar.karan...@gmail.com> wrote:
>
>> Hi All,
>>
>> I'm trying to retrieve the records in a PostgreSQL table and update or
>> insert them into Redis. Below code creates all KEYS in the Redis instance,
>> BUT all items contain the very same record (of Threshold rule) (hgetall
>> keyname1 and hgetall keyname2 returns the same result)
>>
>> I'm not sure if this is a bug or a feature, and stuck here.. Any advices
>> are highly appreciated..
>>
>> best regards,
>>
>> define trigger ConfigReloadTrigger at every 60 sec;
>>
>> @Store(type = "rdbms", jdbc.url = "jdbc:postgresql://localhost/my_db", 
>> username = "my_user", password = "my_pwd" , jdbc.driver.name = 
>> "org.postgresql.Driver", table.name = 'pm_threshold')
>> @Index('metric_name')
>> @primaryKey('id')
>> define table ThresholdTable(id int, created_at string, updated_at string, 
>> path_regex string, aggr_field string, aggr_function string, warning double, 
>> warning_action int, critical double, critical_action int, is_active bool, 
>> task_step_id int, metric_name string, selectivity int);
>>
>> @Store(type='redis', table.name='pm_threshold', nodes='localhost:6373', 
>> cluster.mode='false')
>> @primaryKey('threshold_id')
>> define table ThresholdCache(threshold_id string, is_active bool, path_regex 
>> string, threshold_updated_at string, threshold_context object, cache_time 
>> long);
>>
>> from ConfigReloadTrigger join ThresholdTable
>> select
>> str:concat('threshold_rule_', ThresholdTable.id 
>> ) as threshold_id,
>> ThresholdTable.is_active,
>> ThresholdTable.path_regex,
>> ThresholdTable.updated_at as threshold_updated_at,
>> map:create(
>> "id", ThresholdTable.id ,
>> "metric_name", ThresholdTable.metric_name,
>> "path_regex", ThresholdTable.path_regex,
>> "selectivity", ThresholdTable.selectivity,
>> "aggr_field", ThresholdTable.aggr_field,
>> "aggr_function", ThresholdTable.aggr_function,
>> "warning", ThresholdTable.warning,
>> "warning_action", ThresholdTable.warning_action,
>> "critical", ThresholdTable.critical,
>> "critical_action", ThresholdTable.critical_action,
>> "is_active", ThresholdTable.is_active,
>> "task_step_id", ThresholdTable.task_step_id,
>> "created_at", ThresholdTable.created_at,
>> "updated_at", ThresholdTable.updated_at
>> ) as threshold_context,
>> eventTimestamp() as cache_time
>> insert into ThresholdTableStream;
>>
>> from ThresholdTableStream#log(true)
>> select
>> ThresholdTableStream.threshold_id,
>> ThresholdTableStream.is_active,
>> ThresholdTableStream.path_regex,
>> ThresholdTableStream.threshold_updated_at,
>> ThresholdTableStream.threshold_context,
>> ThresholdTableStream.cache_time
>> update or insert into ThresholdCache
>> set
>> ThresholdCache.threshold_id = threshold_id,
>> ThresholdCache.is_active = is_active,
>> ThresholdCache.path_regex = path_regex,
>> ThresholdCache.threshold_updated_at = threshold_updated_at,
>> ThresholdCache.threshold_context = threshold_context,
>> ThresholdCache.cache_time = cache_time
>> on ThresholdCache.threshold_id == threshold_id;
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>
>
> --
> *V. Mohanadarshan* | Technical Lead | WSO2 Inc.  |
> (M) 94-771117673 | (E) mo...@wso2.com |
> GET INTEGRATION AGILE
> Integration Agility for Digitally Driven Business
>


-- 

*Anusha Jayasundara*
Software Engineer | WSO2

Email : anus...@wso2.com
Mobile : +94772601160
Web : http://wso2.com
Lean.Enterprise.Middleware

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Siddhi Store Redis - update or insert into table (on Redis) won't work

2018-11-24 Thread Mohanadarshan Vivekanandalingam
Hi Anusha,

Can you please followup and respond to this..

Thanks,
Mohan


On Tue, Nov 20, 2018 at 3:57 PM Bahtiyar KARANLIK <
bahtiyar.karan...@gmail.com> wrote:

> Hi All,
>
> I'm trying to retrieve the records in a PostgreSQL table and update or
> insert them into Redis. Below code creates all KEYS in the Redis instance,
> BUT all items contain the very same record (of Threshold rule) (hgetall
> keyname1 and hgetall keyname2 returns the same result)
>
> I'm not sure if this is a bug or a feature, and stuck here.. Any advices
> are highly appreciated..
>
> best regards,
>
> define trigger ConfigReloadTrigger at every 60 sec;
>
> @Store(type = "rdbms", jdbc.url = "jdbc:postgresql://localhost/my_db", 
> username = "my_user", password = "my_pwd" , jdbc.driver.name = 
> "org.postgresql.Driver", table.name = 'pm_threshold')
> @Index('metric_name')
> @primaryKey('id')
> define table ThresholdTable(id int, created_at string, updated_at string, 
> path_regex string, aggr_field string, aggr_function string, warning double, 
> warning_action int, critical double, critical_action int, is_active bool, 
> task_step_id int, metric_name string, selectivity int);
>
> @Store(type='redis', table.name='pm_threshold', nodes='localhost:6373', 
> cluster.mode='false')
> @primaryKey('threshold_id')
> define table ThresholdCache(threshold_id string, is_active bool, path_regex 
> string, threshold_updated_at string, threshold_context object, cache_time 
> long);
>
> from ConfigReloadTrigger join ThresholdTable
> select
> str:concat('threshold_rule_', ThresholdTable.id 
> ) as threshold_id,
> ThresholdTable.is_active,
> ThresholdTable.path_regex,
> ThresholdTable.updated_at as threshold_updated_at,
> map:create(
> "id", ThresholdTable.id ,
> "metric_name", ThresholdTable.metric_name,
> "path_regex", ThresholdTable.path_regex,
> "selectivity", ThresholdTable.selectivity,
> "aggr_field", ThresholdTable.aggr_field,
> "aggr_function", ThresholdTable.aggr_function,
> "warning", ThresholdTable.warning,
> "warning_action", ThresholdTable.warning_action,
> "critical", ThresholdTable.critical,
> "critical_action", ThresholdTable.critical_action,
> "is_active", ThresholdTable.is_active,
> "task_step_id", ThresholdTable.task_step_id,
> "created_at", ThresholdTable.created_at,
> "updated_at", ThresholdTable.updated_at
> ) as threshold_context,
> eventTimestamp() as cache_time
> insert into ThresholdTableStream;
>
> from ThresholdTableStream#log(true)
> select
> ThresholdTableStream.threshold_id,
> ThresholdTableStream.is_active,
> ThresholdTableStream.path_regex,
> ThresholdTableStream.threshold_updated_at,
> ThresholdTableStream.threshold_context,
> ThresholdTableStream.cache_time
> update or insert into ThresholdCache
> set
> ThresholdCache.threshold_id = threshold_id,
> ThresholdCache.is_active = is_active,
> ThresholdCache.path_regex = path_regex,
> ThresholdCache.threshold_updated_at = threshold_updated_at,
> ThresholdCache.threshold_context = threshold_context,
> ThresholdCache.cache_time = cache_time
> on ThresholdCache.threshold_id == threshold_id;
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>


-- 
*V. Mohanadarshan* | Technical Lead | WSO2 Inc.  |
(M) 94-771117673 | (E) mo...@wso2.com |
GET INTEGRATION AGILE
Integration Agility for Digitally Driven Business
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev