leonchen83 / redis-replicator

Redis replication tool. support sync, psync, psync2. can parse rdb, aof, mixed rdb and aof files. support redis-7.2
Apache License 2.0
970 stars 273 forks source link

Add offsets to commands #31

Closed rk3rn3r closed 5 years ago

rk3rn3r commented 5 years ago
rk3rn3r commented 5 years ago

Hey @leonchen83! I needed access to startOffset and endOffset for commands, so I made some changes to apply that to your code. I'm really looking forward to your feedback!

Best, René

coveralls commented 5 years ago

Coverage Status

Coverage increased (+1.05%) to 73.131% when pulling 7b392906455cc63b507c23ba7140ef4e3aed43c4 on rk3rn3r:add_offsets into 1af1bdb5b3b4f326b9396835d0d2e9a51706173d on leonchen83:master.

leonchen83 commented 5 years ago

@rk3rn3r GenericKeyValueCommandand GenericKeyCommand are really good idea. GenericCommand with startOffset and endOffset need further considered. I will change the related code about startOffset and endOffset in offset branch. if done, please help review code.

rk3rn3r commented 5 years ago

Thank you! Sure, I will review once you are ready!

rk3rn3r commented 5 years ago

There are some more commands that could use some adjusting to aggregate some duplicate code. I just did it for key[] and byte[] and for introducing offsets.

leonchen83 commented 5 years ago

@rk3rn3r hi I submit a commit about command offset. after this commit. we can get all Event's offset. not only Command offset. and get the offset when reading aof file and rdb file. usage as following


AbstractEvent e = (AbstractEvent)event;
Tuple2<Long, Long> tuple = e.getContext().getOffsets();
rk3rn3r commented 5 years ago

That's pretty awesome. Thank you so much! <3

leonchen83 commented 5 years ago

we need some time to test above commit(manual test, integration test, add new test case and etc). after about 2 weeks, we can release v3.3.0