question about the key of first ref when split-insert

112 views
Skip to first unread message

徐华叶

unread,
Jun 14, 2021, 11:48:14 AM6/14/21
to wiredtiger-users
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

alexande...@mongodb.com

unread,
Jun 17, 2021, 2:22:54 AM6/17/21
to wiredtiger-users
Hi Huaye,

Thanks for reaching out and your interest in WiredTiger. We are taking a look at your question and will get back to you when we have a chance.

- Alex

Michael Cahill

unread,
Jun 17, 2021, 7:26:54 PM6/17/21
to wiredtiger-users
Hi Huaye,

Like Alex said, we can go back and figure out whether the simpler fix you describe would have been sufficient to fix this bug.  I'm interested, though: how are you using WiredTiger and what caused you to look into this?

Thanks,
Michael.

--
You received this message because you are subscribed to the Google Groups "wiredtiger-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wiredtiger-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wiredtiger-users/8ed12240-6fa8-4425-bb30-f0009326587an%40googlegroups.com.

徐华叶

unread,
Jun 18, 2021, 4:04:43 AM6/18/21
to wiredtiger-users
Hi Michael,

Thank you for your reply. 

I am working in a storage team which maintains and develops databases( Include MongoDB). Our team have a strong interest in WiredTiger and also has some research on WiredTiger.  In addition, we hold a workshop meeting every week. In the workshop,  my workmate will introduce the feature of MongoDB or WiredTiger. And the split-insert during evict is one of my topic which introduced in the workshop. So I read the source code of split-insert and had the question about the split-insert.

Thanks,
Huaye



徐华叶

unread,
Jun 18, 2021, 7:38:09 AM6/18/21
to wiredtiger-users
Hi Alex,

Thank you for your reply. Look forward to your future reply and your conclusion.

Thank you!
Huaye

Keith Bostic

unread,
Jun 18, 2021, 2:06:57 PM6/18/21
to wiredtiger-users
Huaye, your analysis was just spectacular, and I agree with your conclusions, we fixed the wrong problem when we made this change.

Thank you for the fix!

I've pushed a pull request for the develop branch to revert this change, here: https://github.com/wiredtiger/wiredtiger/pull/6685.

Would you please take a look and let me know if you agree with this change?

徐华叶

unread,
Jun 18, 2021, 9:06:50 PM6/18/21
to wiredtiger-users
Hi Keith,

Thank you for your reply.

I have looked the change and totally agree with your change.  Thank you for you fix.

Thank you!
Huaye

Reply all
Reply to author
Forward
0 new messages