backendgym backendgym · reps Sign in with GitHubSign in

06Judge a routing rule

sql-scaling-and-security / reps/06/README.md

reps/06/shard.sh routes eight event keys to one of two Postgres databases. Read it first, then run it with both shard databases, ./reps/06/shard.sh <shard-a> <shard-b> from the root of your copy, and compare with the expected result below. Change the rule so keys with an even suffix go to one shard and keys with an odd suffix to the other.

Expected once fixed: shard_a=4 and shard_b=4. The shipped script prints shard_a=8 and shard_b=0.

After the rep
  1. 1 Change the loop to the keys user-10 to user-19 and run your version again. How does your rule split them, and how would it split keys that all end in 0?