Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

erasure_code_test can not support specific case #40

Closed
liujiangang01 opened this issue Jul 12, 2018 · 4 comments
Closed

erasure_code_test can not support specific case #40

liujiangang01 opened this issue Jul 12, 2018 · 4 comments

Comments

@liujiangang01
Copy link

liujiangang01 commented Jul 12, 2018

if k=9,m=18, and column in (0, 1, 2, 5, 7, 9, 10, 14, 16) corrupt, isa cannot decode
when execute example, report as follows:
erasure_code_test: 127x8192 BAD MATRIX
Fail to gf_gen_decode_matrix

@liujiangang01 liujiangang01 changed the title code can not support specific case find a bug : code can not support specific case Jul 12, 2018
@liujiangang01
Copy link
Author

liujiangang01 commented Jul 12, 2018

测试代码参数调整:
p a360n 7k2jwmu zmunmc
v h3wia8s w yvuh9x 8a
测试代码参数调整成k=9,m=18,并且模拟0, 1, 2, 5, 7, 9, 10, 14, 16列损坏,运行结果(报错)如下:
p m3tlm 9 2k6o0 51v_286

@gbtucker
Copy link
Contributor

I don't think this is a bug but you are pushing the limits of a Vandermonde matrix. As described in the header for gf_gen_rs_matrix for k = 9 you are not guaranteed an invertable matrix unless m <= 13. You might consider using a different encoding matrix like a Cauchy-based one the example uses. You can test this will work with:

$ ./ec_simple_example -k 9 -p 9 -e 0 -e 1 -e 2 -e 5 -e 7 -e 9 -e 10 -e 14 -e 16
ec_simple_example:
 encode (m,k,p)=(18,9,9) len=8192
 recover 9 fragments
 check recovery of block { 0 1 2 5 7 9 10 14 16 } done all: Pass

@liujiangang01
Copy link
Author

Thanks,yesterday I use Cauchy-based matrix, it does work

@liujiangang01 liujiangang01 changed the title find a bug : code can not support specific case erasure_code_test can not support specific case Jul 13, 2018
@jasonkresch
Copy link

There is a way to generate a systematic encoding matrix that is guaranteed to be invertible in any case. It works as follows:

Step 1. Generate a K by K+M Vandermonde matrix
Step 2. Generate a K by K Vandermonde matrix
Step 3. Invert the K by K Vandermonde matrix generated in step 2
Step 4. Multiply the matrix generated step 1 by the inverse Vandermonde matrix created in step 3

The matrix resulting from step 4 can serve as an encoding matrix. The first K x K rows will correspond to the identity matrix. The remaining bottom M rows can serve the purposes of encoding redundancy.

For reference, this is how the matrix is generated in other Reed-Solomon libraries, such as zfec:
https://github.com/tahoe-lafs/zfec/blob/master/zfec/fec.c#L420

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants