Skip to content

Commit 9ad9a23

Browse files
committed
Explain why we can have at most 256 shards total
1 parent ee04540 commit 9ad9a23

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/com/backblaze/erasure/ReedSolomon.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ public static ReedSolomon create(int dataShardCount, int parityShardCount) {
3535
*/
3636
public ReedSolomon(int dataShardCount, int parityShardCount, CodingLoop codingLoop) {
3737

38-
// The academic papers say that the Vandermonde matrix is only
39-
// guaranteed up to 256 rows. In practice, the tests pass
40-
// up to 248 data + 256 parity, but I don't understand the math
41-
// well enough to trust that.
38+
// We can have at most 256 shards total, as any more would
39+
// lead to duplicate rows in the Vandermonde matrix, which
40+
// would then lead to duplicate rows in the built matrix
41+
// below. Then any subset of the rows containing the duplicate
42+
// rows would be singular.
4243
if (256 < dataShardCount + parityShardCount) {
4344
throw new IllegalArgumentException("too many shards - max is 256");
4445
}

0 commit comments

Comments
 (0)