1

[Question posted by a user on YugabyteDB Community Slack]

If you set yb_read_from_followers=on and are connected to a tablet leader, do you still read stale data from a snapshot yb_follower_read_staleness_ms ago?

I read this: https://dev.to/franckpachot/read-from-the-nearest-peer-in-a-multi-region-database-with-followers-read-59d9 and the author makes it seem like you're always reading from a snapshot.

dh YB
  • 965
  • 3
  • 10

1 Answers1

1

Follower reads, enabled using yb_read_from_followers, reads data that is consistent with yb_follower_read_staleness_ms milliseconds old. In order to enable follower reads, yb_read_from_followers must set to on, and a transaction must be explicitly marked as readonly.

The tablet chosen can be both a leader or a follower, the tablet is chosen based on being closest, where closest is determined by the placement of the tablet. If the reader cannot obtain data that is consistent with yb_follower_read_staleness_ms, it will go to the leader and obtain the data. The leader is current and therefore must always be able to provide the requested data.

dh YB
  • 965
  • 3
  • 10