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

[Dumper] Refactor pipeline ingestor #175

Merged
merged 4 commits into from
Mar 19, 2024
Merged

Conversation

jt-dd
Copy link
Contributor

@jt-dd jt-dd commented Mar 18, 2024

Refactor the pipeline ingestor to include more unit tests.

@jt-dd jt-dd requested a review from a team as a code owner March 18, 2024 16:57
"k8s.io/client-go/kubernetes/fake"
)

func genK8sObjects() []runtime.Object {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the only one that is exported, is that intended?

// Setting up the worker pool with multi-threading if possible
// enable for raw file writer
// disable for targz writer (not thread safe)
wp, err := worker.PoolFactory(workerNumber, 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

is 1 intended for worker > 1?
Does this actually run in multiple threads if you put workerNumber to like 5 but with a capacity of 1?
(Also, I would suggest having that "1" put into a variable, because that's not easily understandable, something like poolCapacity or something maybe?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, this is the capacity of the queue. In our case we do not need any buffer. I will add variable to make it clearier.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm still unclear on why we don't want any more buffer, but LGTM!
(I guess we will see on the trace how much concurrency we are really getting. In any case I would assume it's not a big deal :D)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was to avoid any concurrency issue. I guess I can try to test it in another PR to see if perf improve and does not introduce new bugs.

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the reason on not putting this in pipeline_test.go or any other test package?

I don't believe it's used anywhere outside of this package right? (the k8s_api_faker.go, on the other hand, is)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because PipelineLiveTest() is used in dump package. Therefore, it needs to be outside from the test package. Therefore, all the other function needs to be outside also.

@jt-dd jt-dd merged commit eb7d1be into main Mar 19, 2024
7 checks passed
@jt-dd jt-dd deleted the jt-dd/ingestor-new-pipeline branch March 19, 2024 12:45
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