WIP: Refactor claim index [currently being investigated, dont merge] #195

Closed
shyba wants to merge 295 commits from refactor_claim_index into master
shyba commented 2018-08-22 17:07:39 +02:00 (Migrated from github.com)
No description provided.
BrannonKing (Migrated from github.com) requested changes 2018-08-22 17:20:05 +02:00
BrannonKing (Migrated from github.com) commented 2018-08-22 17:19:27 +02:00

getClaimById should not be called twice.

`getClaimById` should not be called twice.
shyba (Migrated from github.com) reviewed 2018-08-22 17:41:12 +02:00
shyba (Migrated from github.com) commented 2018-08-22 17:41:12 +02:00

thanks, squashed and force pushed

thanks, squashed and force pushed
lbrynaut (Migrated from github.com) reviewed 2018-08-22 17:47:30 +02:00
lbrynaut (Migrated from github.com) left a comment

Squash all commits.

Update for style to avoid travis error.

We also need to test this to be sure it works as expected. There could be db corruption elsewhere unrelated to this, so let me know your findings.

Squash all commits. Update for style to avoid travis error. We also need to test this to be sure it works as expected. There could be db corruption elsewhere unrelated to this, so let me know your findings.
lbrynaut (Migrated from github.com) commented 2018-08-22 17:45:47 +02:00

Duplicate of line 409 (remove either this or your addition)

Duplicate of line 409 (remove either this or your addition)
@ -833,3 +833,3 @@
const std::string name = "test";
CMutableTransaction tx1 = fixture.MakeClaim(fixture.GetCoinbase(), name, "one", 1);
CMutableTransaction tx1 = fixture.MakeClaim(fixture.GetCoinbase(), name, "one", 2);
uint160 claimId = ClaimIdHash(tx1.GetHash(), 0);
lbrynaut (Migrated from github.com) commented 2018-08-22 17:46:21 +02:00

Why is this changing?

Why is this changing?
@ -840,6 +840,7 @@ BOOST_AUTO_TEST_CASE(get_claim_by_id_test)
pclaimTrie->getClaimById(claimId, claimName, claimValue);
BOOST_CHECK(claimName == name);
BOOST_CHECK(claimValue.claimId == claimId);
BOOST_CHECK(claimValue.nAmount == 2);
lbrynaut (Migrated from github.com) commented 2018-08-22 17:46:41 +02:00

Why is this changing?

Why is this changing?
shyba (Migrated from github.com) reviewed 2018-08-22 17:55:53 +02:00
@ -833,3 +833,3 @@
const std::string name = "test";
CMutableTransaction tx1 = fixture.MakeClaim(fixture.GetCoinbase(), name, "one", 1);
CMutableTransaction tx1 = fixture.MakeClaim(fixture.GetCoinbase(), name, "one", 2);
uint160 claimId = ClaimIdHash(tx1.GetHash(), 0);
shyba (Migrated from github.com) commented 2018-08-22 17:55:53 +02:00

So the update can test the value stored at the index also gets updated from 2 to 1.

So the update can test the value stored at the index also gets updated from 2 to 1.
shyba (Migrated from github.com) reviewed 2018-08-22 17:56:10 +02:00
@ -840,6 +840,7 @@ BOOST_AUTO_TEST_CASE(get_claim_by_id_test)
pclaimTrie->getClaimById(claimId, claimName, claimValue);
BOOST_CHECK(claimName == name);
BOOST_CHECK(claimValue.claimId == claimId);
BOOST_CHECK(claimValue.nAmount == 2);
shyba (Migrated from github.com) commented 2018-08-22 17:56:10 +02:00

typo, fixing. I meant to do this only to tx1

typo, fixing. I meant to do this only to tx1
shyba commented 2018-08-22 18:16:22 +02:00 (Migrated from github.com)

squashed, fixed style, duplicated json field and typo on tests.

squashed, fixed style, duplicated json field and typo on tests.
shyba commented 2018-08-23 04:36:26 +02:00 (Migrated from github.com)

Added a command to debug the issue:

./lbrycrd-cli help getmissingclaimsfromindex                                            
getmissingclaimsfromindex
Return the claims that arent on claims_by_id index.
Arguments:
None
Result:
[
  "name"           (string) the claimed name
  "claimId"        (string) the claim id
]

Please don't merge that commit. We can remove it once we have a definitive fix or the reason for that to be happening.

Added a command to debug the issue: ``` ./lbrycrd-cli help getmissingclaimsfromindex getmissingclaimsfromindex Return the claims that arent on claims_by_id index. Arguments: None Result: [ "name" (string) the claimed name "claimId" (string) the claim id ] ``` Please don't merge that commit. We can remove it once we have a definitive fix or the reason for that to be happening.
lbrynaut commented 2018-08-23 21:28:29 +02:00 (Migrated from github.com)

@shyba Thanks for bringing this issue up. I looked into it a little bit and have a theory on what's going wrong, but will need some more time analyzing before testing a fix. It's unrelated to this though, so no need to merge here. If there's an existing issue related to this, please link it here.

@shyba Thanks for bringing this issue up. I looked into it a little bit and have a theory on what's going wrong, but will need some more time analyzing before testing a fix. It's unrelated to this though, so no need to merge here. If there's an existing issue related to this, please link it here.
shyba commented 2018-08-23 21:46:17 +02:00 (Migrated from github.com)

That one is actually a cosmetic byproduct from when I was investigating. It's some unit tests and a refactor. The only issue being solved in this PR is when the value field fails it won't return a result instead of returning an empty value. However that's also caused by the index issues.
If the refactor and the unit tests proves to be useful you can merge them, but otherwise we can close this PR. It's mostly investigation byproducts.

That one is actually a cosmetic byproduct from when I was investigating. It's some unit tests and a refactor. The only issue being solved in this PR is when the `value` field fails it won't return a result instead of returning an empty value. However that's also caused by the index issues. If the refactor and the unit tests proves to be useful you can merge them, but otherwise we can close this PR. It's mostly investigation byproducts.
lbrynaut commented 2018-08-24 03:44:10 +02:00 (Migrated from github.com)

If the refactor and the unit tests proves to be useful you can merge them, but otherwise we can close this PR. It's mostly investigation byproducts.

See #197. If/when that's merged, please issue a PR to re-add the unit testing.

> If the refactor and the unit tests proves to be useful you can merge them, but otherwise we can close this PR. It's mostly investigation byproducts. See #197. If/when that's merged, please issue a PR to re-add the unit testing.

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/lbrycrd#195
No description provided.