Hi everyone,
Recently I read the source-code of split-insert in WiredTiger, and I have a question about split-insert: why should split-insert change the key of first-ref? I noticed the comment in the source code, the reason is suffix-compressed, but I can't understand and also can't find a case in which the key of the first ref is invalid.
Let's suppose the origin key is A, the new key of the first ref is B. Because B is the smallest key of the page of first ref, so A must be less than or equal than B. In this way, I think A is always valid for the new first ref.
I found some issues of this, and the commit.
From the issue, I know the first version of split-insert would cause the cache-test fail. I think the fail reason is this line "__wt_ref_key(page, ref, &key, &size);" . If we change the line to "__wt_ref_key(ref->home, ref, &key, &size);" , the failed test will succeed. From the source code we know, we should pass the parent page to the function "__wt_ref_key", not the child page. Later, I tested this idea, and the failed cache-test succeeded in fact.
I hope I have expressed myself clearly. Could someone tell me if I am right? Or are there some case that must change the key of first ref when split-insert?
Thank you!
huaye