Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(firestore): adds Bulkwriter support to Firestore client #5946
feat(firestore): adds Bulkwriter support to Firestore client #5946
Changes from 89 commits
1826c91
98da527
61dc7cc
b93be38
c9a5416
cb5836a
0b76b51
59bfee1
b7569ed
3af83e0
9a90b8a
aa871db
c44dc41
816f42c
13c0ce5
6d616c4
7facc45
11d79b7
18feb31
0e6acd1
9f93108
16c74c6
80c0031
423b11d
0def0f0
a575c80
ac29450
8e0a3b0
457b5c6
8ec9862
a9c6171
b7ee2f1
8fdecc3
7f56415
4cd7e44
9526432
aedab83
2bf15ac
d688edb
014804d
d047e26
dc7c766
1c44771
5cae326
d14a47d
d982b9c
1094a00
7eadfa3
00d3130
3969f3f
7f389bc
28db505
85ee986
bedfa89
ee9b5dd
a688985
a783376
b9e91be
86d123e
6820791
41fb8ca
ce894c6
34f6532
e9e8d09
3e0b321
6979fac
2d80565
e7dd6c5
36371a1
5879b65
b5339e1
4dda3f1
28a1db7
224ecc6
a10c4ae
ef437bf
274b192
ea52e21
2c2928c
47f2d01
175c1a3
bd78417
0c0ff92
3dffdd0
99b22f2
86c7cfb
18f88ae
9b198c6
8fa743a
46253eb
a630e5d
285e048
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
I think there might be a minor race condition here. Here's the idea:
checkWriteCondition
acquires the lock, sees thatisOpen
is true, and then releases the lockEnd
acquires the lock, setsisOpen
to false, releases the lock, and then flushesThe question is: does the write succeed or not in this case?
One possible option would be to use a read write mutex, where the read mutex wraps the entire write attempt and the write mutex wraps
isOpen
here inEnd
.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.
Very good point.
Here's what I've done to address this:
BulkWriter.isOpenLock
to aRWMutex
.Lock()
and deferredUnlock()
at the top of each DB mutator/write function (Create()
,Delete()
, etc).Each mutator will hold the lock while queueing up the write for the Bundler. If
End()
is called during this time, it will will block while the mutator holds the lock.