0

What I understand is that read_repair_chance is a probabilistic chance to trigger a ReadRepair over all the replicas. If an inconsistency is found the most recent update would serve to repair the data.

ReadRepairs are too expensive for me because most of my read CL is ONE. So I choose read_repair_chance = 0 and dclocal_read_repair_chance = 0 too.

But sometimes I use QUORUM instead of ONE. Read QUORUM is reached when two replicas respond, but the two records can be different. Cassandra return the one with the most recent timestamp. Does it try to repair the other one ?

Adrien Piquerez
  • 1,009
  • 10
  • 11
  • ReadRepair only repairs the data that was requested, it's not repairing everything. That doesn't seem very 'expensive'. And why say 'because most... CL is ONE'? I don't see any connection between ReadRepair and CL like you're attempting to make? If you turn off all automatic ReadRepair, then no, C* will not attempt any repairs. You'll need to run repair manually at an interval < gc_grace_seconds in any case. – LHWizard Oct 21 '15 at 15:50
  • The connection between ReadRepair and CL is detailed in this [post](http://www.datastax.com/dev/blog/common-mistakes-and-misconceptions) under Read Repair Chance. I quote : "That is, at a consistency level of 1, for every read, we would check the other replicas to see if the thing data we just read is consistent with the other replicas. ... The bad part about this was requiring every read to become RF reads (and typically your RF is set to at least 3)." The aim of my question is that I want Cassandra to do automatic repair but I do not want CL ONE to become CL ALL. – Adrien Piquerez Oct 21 '15 at 16:00
  • 1
    at read_repair_chance = .1, then 90% of your reads do not cause any repair. Still too much? set it lower, like .05, so 95% of your reads won't trigger ReadRepair. This is unrelated to CL. – LHWizard Oct 21 '15 at 16:06

3 Answers3

4

But sometimes I use QUORUM instead of ONE. Read QUORUM is reached when two replicas respond, but the two records can be different. Cassandra return the one with the most recent timestamp. Does it try to repair the other one?

Assuming that my RF is 3 and write and read CL are QUORUM. What I mean saying that 'wanted CL is reached' is that two replicas at least respond, this is QUORUM. But nothing proves that the two records are identical. Cassandra returns the one with the most recent timestamp. But my question is does it try to repair the other record?

The answer is YES.

Cassandra will try to repair the other one, even though read_repair_chance = 0 and dclocal_read_repair_chance = 0.

It is called 'digest mismatch'. The only way to avoid read repair is reading at LOCAL_ONE or ONE where no digest mismatch can occur.

See CASSANDRA-13910 CASSANDRA-11409 CASSANDRA-13863

http://thelastpickle.com/blog/2016/12/08/TWCS-part1.html

hopex40
  • 58
  • 3
2

I am not clear on what you mean by 'wanted consistency level is achieved'. How do you know that. Please share your replication factor and consistency level you are using.

I'll try to answer the parts I understand.

By changing the two properties to '0' you have disabled automatic repair.

If you want automatic repair to function leave these to default or set them to a level that works for you.

You may also want to read up on Replication Factor and how it works with consistency level

Data consistency in your C* cluster will depend on Consistency Level and Replication Factor (amongst other things). If you have RF=3 and write at CL=1, C* will still make your data consistent 'eventually'. Dial these properties around to meet your needs so your reads will return consistent data.

If you are reading at CL=1 you may get inconsistent data. You may want to try quorum or local quorum which will cause read_repair_chance to kick in to repair any inconsistent data.

Community
  • 1
  • 1
daaku
  • 21
  • 1
  • Thanks for the reply. Assuming that my RF is 3 and write and read CL are QUORUM. What I mean saying that 'wanted CL is reached' is that two replicas at least respond, this is QUORUM. But nothing proves that the two records are identical. Cassandra returns the one with the most recent timestamp. But my question is does it try to repair the other record ? I dont want automatic repair because it is two expensive : reading all the replicas even if my read CL is ONE. – Adrien Piquerez Oct 21 '15 at 06:58
  • I edited my original post. I hope it clarifies my question. – Adrien Piquerez Oct 21 '15 at 07:08
0

I have been looking for an answer to your question in the DataStax documentation and tutorials and I haven't been able to find it specifically documented that a repair would be completed when a consistency is higher than one just that the latest cell data will be returned.

It's an eventually consistent piece of kit so I would assume that the repair will only happen if you run the repair with nodetool repair, which is recommended as being done weekly if you use the default gc_grace_seconds or by using the read_repair_chance.

Don't forget that even with a CL of 1 for a write, the write will be done to all replica nodes, so long as you aren't doing a read immediately after the write you should get correct data most of the time, if you are doing a write then an immediate read you have an anti pattern, keep the data in your application to reduce reads and writes.

Melv
  • 13
  • 4
  • A write with CL 1 could time out on all replicas but one which means only one node would ever have the data until a repair is performed – Adrien Piquerez Feb 12 '16 at 10:20
  • 1
    In terms of the actual question of does it make the repair with a quorum read, I think the answer is no. Based on your comments you are after the assurance of the data consistency. I guess you need to make the decision between what you need more consistency or the performance. – Melv Feb 12 '16 at 10:46