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

HivePartition: Add also lock on partition_state #9576

Merged
merged 1 commit into from Nov 6, 2023

Conversation

carlopi
Copy link
Contributor

@carlopi carlopi commented Nov 6, 2023

I am not actually sure if the first lock lock_guard<mutex> global_lock(g.lock); is actually needed or could be potentially removed, but should not be a problem to keep both.

Ideally I think the inner and outer lock should be the same lock, but that would require a deeper review of the code that the one I am comfortable doing right now.

@carlopi
Copy link
Contributor Author

carlopi commented Nov 6, 2023

Note that CI on this is not really useful given it's skipping the only CI job that was failing, the Thread sanitizer run ( https://github.com/duckdb/duckdb/actions/runs/6764754096/job/18383729513), but I checked on my local fork that this change fixes it (https://github.com/carlopi/duckdb/actions/runs/6768785301/job/18394053039) and the change makes sense in any case.

@carlopi carlopi requested a review from Mytherin November 6, 2023 10:00
@Mytherin
Copy link
Collaborator

Mytherin commented Nov 6, 2023

Thanks! LGTM. I wonder if the two separate locks make sense here? Could they be unified?

@carlopi
Copy link
Contributor Author

carlopi commented Nov 6, 2023

Thanks! LGTM. I wonder if the two separate locks make sense here? Could they be unified?

In general I don't get what's the role of having two different locks around this code, one as part of CopyToFunctionGlobalState class, and one as part of the inner GlobalHivePartitionState class.

I think in this case the one strictly needed one is the inner one (GlobalHivePartitionState), while the other can be potentially removed, but the the whole code in src/execution/operator/persistent/physical_copy_to_file.cpp uses the outer one, any pointers @samansmink?

@samansmink
Copy link
Contributor

They can be merged by making the one in GlobalHivePartitionState a reference to the one in CopyToFunctionGlobalState, but not sure if it would really improve the code

@carlopi
Copy link
Contributor Author

carlopi commented Nov 6, 2023

Then we good to go I think, thanks!

@Mytherin Mytherin merged commit 60ddc31 into duckdb:main Nov 6, 2023
41 of 43 checks passed
@Mytherin
Copy link
Collaborator

Mytherin commented Nov 6, 2023

Thanks!

@carlopi carlopi deleted the fixci2 branch November 6, 2023 15:39
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.

None yet

3 participants