-
Notifications
You must be signed in to change notification settings - Fork 18
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
SNAP-1950 #361
base: snappy/master
Are you sure you want to change the base?
SNAP-1950 #361
Conversation
This is to avoid a race where GII first takes pendingTXRegionState lock and then tries to apply the operation which in turn tries to create the TXRegionState. In case of BatchMessage, we first create the TXRegionState and then try to take lock on pendingTXRegionState. This causes cyclic dependency and deadlock
Instead of NonReentrantReadWriteLock, use StoppableReentrantReadWriteLock
In case of co-ordinator wait for initialization
In the TXRegionState constructor check if write lock already taken In that case don't try to take lock again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See few comments.
if (!r.isInitialized() && r.getImageState().lockPendingTXRegionStates(true, false)) { | ||
lockedRegions.add(r); | ||
} | ||
}*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
commented portion can be removed to avoid confusion
region.getImageState().lockPendingTXRegionStates(true, false)) { | ||
//lockedRegions.add(region); | ||
lockedPendingTXregionState = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cleaner to do "boolean lockPendingTXRegionState = !region.isInitialized() && region.getImageState().lock..."
|
||
boolean alreadyLocked = imgState.isWriteLockedBySameThread(); | ||
if (!r.isInitialized() | ||
&& (alreadyLocked || imgState.lockPendingTXRegionStates(true, false))) { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the lock can be taken multiple times by same thread, won't it be better to make this a ReentrantReadWriteLock instead of "isWriteLockedBySameThread" check? The block inside will add TXRegionState in pending list and initialize pendingTXOps lists which I think is required.
6f2602c
to
9404c94
Compare
337768c
to
ec453a6
Compare
This is to avoid a race where GII first takes pendingTXRegionState lock
and then tries to apply the operation which in turn tries to create
the TXRegionState.
In case of BatchMessage, we first create the TXRegionState and then try
to take lock on pendingTXRegionState. This causes cyclic dependency and
deadlock
Changes proposed in this pull request
(Fill in the changes here)
Patch testing
(Fill in the details about how this patch was tested)
ReleaseNotes changes
(Does this change require an entry in ReleaseNotes? If yes, has it been added to it?)
Other PRs
(Does this change require changes in other projects- snappydata, spark, spark-jobserver, aqp? Add the links of PR of the other subprojects that are related to this change)