incubator-retired-gearpump icon indicating copy to clipboard operation
incubator-retired-gearpump copied to clipboard

fix #106 Gearpump Redis Integration

Open darionyaphet opened this issue 8 years ago • 23 comments

Redis is a hight performance in memory storage , and have widely used in a lot of project .

It's should support redis as DataSource and DataSink .

darionyaphet avatar May 07 '16 12:05 darionyaphet

@darionyaphet we probably need some unit tests. Good job on splitting example and actual definitions into example and external. It doesn't look like the build failures are related

[info] StreamAppSpec:
[info] - should be able to generate multiple new streams
[info] - should plan the dsl to Processsor(TaskDescription) DAG *** FAILED ***
[info]   java.io.NotSerializableException: scala.collection.LinearSeqLike$$anon$1
[info]   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
[info]   at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
[info]   at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
[info]   at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[info]   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[info]   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
[info]   at akka.serialization.JavaSerializer$$anonfun$toBinary$1.apply$mcV$sp(Serializer.scala:235)
[info]   at akka.serialization.JavaSerializer$$anonfun$toBinary$1.apply(Serializer.scala:235)
[info]   at akka.serialization.JavaSerializer$$anonfun$toBinary$1.apply(Serializer.scala:235)
[info]   at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[info]   ...
[info] - should produce 3 messages *** FAILED ***
[info]   java.io.NotSerializableException: scala.collection.LinearSeqLike$$anon$1
[info]   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
[info]   at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
[info]   at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
[info]   at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
[info]   at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
[info]   at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
[info]   at akka.serialization.JavaSerializer$$anonfun$toBinary$1.apply$mcV$sp(Serializer.scala:235)
[info]   at akka.serialization.JavaSerializer$$anonfun$toBinary$1.apply(Serializer.scala:235)
[info]   at akka.serialization.JavaSerializer$$anonfun$toBinary$1.apply(Serializer.scala:235)
[info]   at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
[info]   ...

kkasravi avatar May 07 '16 17:05 kkasravi

@darionyaphet thanks for your contributions. please add license headers

manuzhang avatar May 08 '16 04:05 manuzhang

@manuzhang I have add license headers .

@kkasravi I will add some unit tests .

thank you :)

darionyaphet avatar May 08 '16 15:05 darionyaphet

@darionyaphet we have changed Gearpump's package name, please rebase our latest code. Sorry for the inconvenient.

huafengw avatar May 11 '16 01:05 huafengw

@darionyaphet also please modify your commit comment to fix GEARPUMP-106, Redis integration which would make our pr merge script happier.

manuzhang avatar May 11 '16 01:05 manuzhang

Hi @manuzhang what is the commit format ?

I found some rules on Contribution Guideline

For all commit log messages, they must contain issue id. Like this: "fix #issueId, comments".

darionyaphet avatar May 11 '16 03:05 darionyaphet

Hi @huafengw sure I will rename packages from io.gearpump to org.apache.gearpump :D

darionyaphet avatar May 11 '16 03:05 darionyaphet

@darionyaphet yes, as we use jira now issue id should be GEARPUMP-XXX. You may our recent commits for examples

manuzhang avatar May 11 '16 03:05 manuzhang

@darionyaphet Could you add this module to the experiments ? That will be low risk before the module is mature. Plus, the experiments doesn't require UT coverage. Also, please add a README for how to use this module.

manuzhang avatar May 11 '16 12:05 manuzhang

Though the new package name is right, you still need to rebase latest master branch to correct the import. Also, please add some comment to explain the interfaces and classes.

huafengw avatar May 13 '16 03:05 huafengw

@darionyaphet if you are time constrained please let us know and we can make the changes noted above. We would like to get this into the next release if possible (we're targeting in about 2 weeks). thanks Kam

kkasravi avatar May 13 '16 14:05 kkasravi

Sorry to reply it with so long .

@manuzhang @huafengw redis examples class name have rename to RedisSourceSinkExample and RedisSourceStorageExample , also add into BuildExample.scala . It seems better ?

external-redis have move into experiments I will add unit test later :)

@kkasravi I will fix and add some comment at weekend :)

darionyaphet avatar May 14 '16 15:05 darionyaphet

@darionyaphet What's the difference between RedisStorage and RedisSink here since they both extend DataSink ?

manuzhang avatar Jun 06 '16 05:06 manuzhang

I think I see the idea behind RedisSink and RedisStorage.

Redis is advertised as "data structure store". It supports structures (like strings, lists, sets, hashes, etc.) and operation on them (add element to a set, remove element; add element at the beginning of a list, at the end; remove element from head/tail of the list, etc.). It also pub/sub server (http://redis.io/topics/pubsub)

RedisSource and RedisSink work on "classic" message stream utilizing Redis' pub/sub mechanizm. The source subscribes to a channel. The sink publishes to a channel.

RedisStorage reads a message and let you make a Redis command (add to list, set, etc.). The subset of commands is defined in RedisMessage. (I would think about changing the name, though. For example RedisCommandSink or similar).

@manuzhang what do you think?

karol-brejna-i avatar Jun 16 '16 09:06 karol-brejna-i

Current coverage is 64.10%

Sunburst

No coverage report found for master at 25d1fce.

Powered by Codecov. Last updated by 25d1fce...c3686fd

codecov-io avatar Jun 20 '16 14:06 codecov-io

@manuzhang actually storm-redis act as a ORM framework and put the message into a redis instance . So it don't have a full command support . I think we can support more command such as delete , ttl and exists .

darionyaphet avatar Jun 20 '16 15:06 darionyaphet

We are developing under 'experiments' here. I'd be happy to have something decent here. Maybe not full-blown, but functional. Can we sum up what we still need to do with this PR? Putting the examples in experiments folder? Tests? Updating names?

My point is: Let us release first version of the redis connector and improve it in next releases.

karol-brejna-i avatar Jun 20 '16 18:06 karol-brejna-i

@karol-brejna-i @darionyaphet I understand the difference between RedisSink and RedisStorage now but I don't think RedisStorage should extend the DataSink interface which is intended for write. Probably we need a new interface for such usage as RedisStorage. For now, we can add RedisStorage without extending any interface. I totally agree we have a functional version first and improve later as long as all are put in the experiments folder with reasonable naming. Tests are not hard requirement for a experiments module.

manuzhang avatar Jun 21 '16 01:06 manuzhang

@karol-brejna-i It's seems have a lot things to do .

  1. Support more command such as : time to live , exist and delete .
  2. Support Redis Cluster and Redis Sharding .
  3. Add some Test Case

darionyaphet avatar Jun 22 '16 01:06 darionyaphet

@manuzhang

HBaseSink seems have the same question .

Sink and Source are support to the data streaming , Storage is meaning to put data into a place .

darionyaphet avatar Jun 22 '16 01:06 darionyaphet

@darionyaphet

Support more command such as : time to live , exist and delete . This is the reason I tend to agree @manuzhang. Let's have the "basic" source/sink. Let's make RedisStorage a helper class (not a DataSink). This will let us release a functional version of the connector and improve later.

Support Redis Cluster and Redis Sharding . Looks like Jedis has cluster support already (https://github.com/xetorthio/jedis#jedis-cluster). Sharding, too. So it would be a matter of using the features. Again, I would try to incorporate the features in next releases.

Add some Test Case As Manu wrote, test are not the blocker for an experiment module.

My message is: let's release first version of Redis Connector soon and give ourselves time to improve ;-)

karol-brejna-i avatar Jun 22 '16 18:06 karol-brejna-i

@kkasravi @manuzhang RedisStorage maybe need more discuss so I have remove it .

After we have a discuss , I will repush it :)

darionyaphet avatar Jul 01 '16 13:07 darionyaphet

@darionyaphet this is partially done in #93. Please rebase or, close and fire a new PR for follow-ups.

manuzhang avatar Dec 09 '16 03:12 manuzhang