Skip to content

PYTHON-836: Added lock to query plan for speculative execution#873

Merged
beltran merged 1 commit into
masterfrom
python-836
Dec 18, 2017
Merged

PYTHON-836: Added lock to query plan for speculative execution#873
beltran merged 1 commit into
masterfrom
python-836

Conversation

@beltran
Copy link
Copy Markdown
Contributor

@beltran beltran commented Dec 4, 2017

No description provided.

Comment thread cassandra/cluster.py Outdated
self.query_plan = iter(self._load_balancer.make_query_plan(self.session.keyspace, self.query))
# Make iterator thread safe when there can be a speculative delay since it could
# from different threads
if self._spec_execution_plan is ResponseFuture._spec_execution_plan:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't follow this identity check -- so, we make it threadsafe in the case where the execution plan is the NoSpeculativeExecutionPlan?

My gut says you mean if self._spec_execution_plan is not ResponseFuture._spec_execution_plan. Even with that behavior, I want to bring up a couple cases:

  • The user passes a new NoSpeculativeExecutionPlan object -- in this case, we take a performance hit for no good reason. Maybe we don't care about that though, since the user should really just pass None.
  • The user sets ResponseFuture._spec_execution_plan as a way to set a default. We also might not care about this, since it's an underscored attribute.

One thought is that we could get around that by checking isinstance(self._spec_execution_plan, NoSpeculativeExecutionPlan)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 you're right, good catch, I'll take you check, overall seems safer.

@mambocab
Copy link
Copy Markdown
Contributor

mambocab commented Dec 6, 2017

Other than my little comment, which you can ignore if you don't think it's an issue, I'm +1.

@beltran beltran merged commit aaccf2f into master Dec 18, 2017
@beltran beltran deleted the python-836 branch December 18, 2017 17:23
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