reuvenlax commented on pull request #13802: URL: https://github.com/apache/beam/pull/13802#issuecomment-767008483
Maybe. Requires a bit of thought, because the naive approach would force us to serialize the key and value on every write to cheeck for equality, and that could add quite a bit of CPU and memory cost. On Mon, Jan 25, 2021 at 10:03 AM Steven Niemitz <[email protected]> wrote: > *@steveniemitz* commented on this pull request. > ------------------------------ > > In > runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WindmillStateInternals.java > <https://github.com/apache/beam/pull/13802#discussion_r563932210>: > > > + if (!cleared && localAdditions.isEmpty() && localRemovals.isEmpty()) { > + // No changes, so return directly. > + return WorkItemCommitRequest.newBuilder().buildPartial(); > + } > + > + WorkItemCommitRequest.Builder commitBuilder = WorkItemCommitRequest.newBuilder(); > + > + if (cleared) { > + commitBuilder > + .addTagValuePrefixDeletesBuilder() > + .setStateFamily(stateFamily) > + .setTagPrefix(stateKeyPrefix); > + } > + cleared = false; > + > + for (K key : localAdditions) { > > can we avoid committing keys added in localAdditions if they already > exist in the cached Map (and the values are equal)? Particularly for > SetState, this could significantly reduce the commit volume. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/apache/beam/pull/13802#pullrequestreview-575668170>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AFAYJVLFA55YMD2TAA26J53S3WXATANCNFSM4WP3BTDA> > . > ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
