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

Avoid duplicate transfer #41

Merged
merged 5 commits into from
Aug 18, 2017
Merged

Avoid duplicate transfer #41

merged 5 commits into from
Aug 18, 2017

Conversation

rishiloyola
Copy link
Collaborator

No description provided.

@vkuznet
Copy link
Owner

vkuznet commented Aug 17, 2017

Rishi, how this code will behave if agent will need to compare 1k-10k records? My understanding you want to compare dataset request with another agent. A dataset may contains 10k files. That's why I asked. Can you add unit/integration test to verify that both comparison function and request one will sustain a request with 10k records?

@rishiloyola
Copy link
Collaborator Author

rishiloyola commented Aug 17, 2017

@vkuznet First I am fetching all the files of requested data set from the source DB. After that, I am fetching the files of the same dataset from the destination agent. Then, I am storing destination's file name as a key and hash as its value in a separate map. This will help us to reduce the time complexity. The overall time complexity will be the O(N * m) where m is the search complexity of map. In many cases, it will be constant.

Very soon I will add the unit tests. Can you suggest some better approach for this?

@rishiloyola
Copy link
Collaborator Author

rishiloyola commented Aug 17, 2017

@vkuznet I just added the test. Also, I did the benchmark of it. It is working fine.
Checkout screen shot.

screen shot 2017-08-18 at 2 27 01 am

@vkuznet
Copy link
Owner

vkuznet commented Aug 18, 2017 via email

@rishiloyola
Copy link
Collaborator Author

Already, fixed that. Check out this commit.
You can merge this.

)

// Compare 1k files of source with the same 1k files of destination
func TestCompareThousand(t *testing.T) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest either to delete this test since you have identical TenThousand one or make test to accept optional parameter for number of catalog entries, e.g. 1k or 10k or whatever. So far TestCompareThousand and TestCompareTenThousand are identical except one parameter in their body.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@vkuznet vkuznet merged commit 28e8492 into master Aug 18, 2017
@rishiloyola rishiloyola deleted the rishi-request branch September 19, 2017 11:31
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

Successfully merging this pull request may close these issues.

2 participants