phaistos-networks / TANK

A very high performance distributed log service
Apache License 2.0
938 stars 70 forks source link

Compactions: retain _first_ not last. Clever idea by @kostas #47

Open markpapadakis opened 7 years ago

markpapadakis commented 7 years ago

@kostas on @dist-sys(Slack) came up with a great idea. Instead of retaining the last message in a set of messages with the same key, retain the first instead (during compactions). That way, you can implement an indempotency scheme, where you really care for the first message, and if you get more you will ignore them anyway, and you want them to be purged, eventually.

markpapadakis commented 5 years ago

We could also use another mode where we retain all messages (i.e not the first or the last message for a given key), which could be handy if you only want to merge multiple immutable segments into fewer.