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

fix file_size always = 0 bug #237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

apple-ouyang
Copy link
Contributor

Copy link
Member

@Connor1996 Connor1996 left a comment

Choose a reason for hiding this comment

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

Please add a test to cover it

@apple-ouyang
Copy link
Contributor Author

Please add a test to cover it

I am a noob sorry. What a good test should be like? Is there a example or some docs? Or do you mean I should run the titan_*_test?

And how should I cover it? Is there a cover ratio or something that I can tell that I cover it?

@Connor1996
Copy link
Member

@apple-ouyang You can check TEST_F(TableBuilderTest, TargetSize), add a test for blob gc that it would fail without your change.

@apple-ouyang
Copy link
Contributor Author

Thanks @Connor1996, I will check this code and figure out a cover test.

Signed-off-by: Wang Haitao <[email protected]>
@apple-ouyang
Copy link
Contributor Author

I change the code. Referenced by TitanTableBuilder::AddBlob in the file table_build.cc::182.
Here is the code written in table_build.cc::182:

  if (blob_handle_->GetFile()->GetFileSize() >=
      cf_options_.blob_file_target_size) {
    // if blob file hit the size limit, we have to finish it
    // in this case, when calling `BlobFileBuilder::Finish`, builder will be in
    // unbuffered state, so it will not trigger another `AddBlobResultsToBase`
    // call
    FinishBlobFile();
  }

I guess my change will work and don't need a test right? Because this is how you write in the table_build.cc.
@Connor1996

@Connor1996
Copy link
Member

I change the code. Referenced by TitanTableBuilder::AddBlob in the file table_build.cc::182. Here is the code written in table_build.cc::182:

  if (blob_handle_->GetFile()->GetFileSize() >=
      cf_options_.blob_file_target_size) {
    // if blob file hit the size limit, we have to finish it
    // in this case, when calling `BlobFileBuilder::Finish`, builder will be in
    // unbuffered state, so it will not trigger another `AddBlobResultsToBase`
    // call
    FinishBlobFile();
  }

I guess my change will work and don't need a test right? Because this is how you write in the table_build.cc. @Connor1996

Adding a case is to make sure it won't be broken in the future. It is not about how you write the code.

@Connor1996
Copy link
Member

@apple-ouyang friendly ping

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