You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "Jeffrey Manno (Jira)" <ji...@apache.org> on 2021/06/02 18:50:00 UTC
[jira] [Comment Edited] (ACCUMULO-2894)
MultiTableBatchWriter.getBatchWriter has dubious loop condition
[ https://issues.apache.org/jira/browse/ACCUMULO-2894?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17355916#comment-17355916 ]
Jeffrey Manno edited comment on ACCUMULO-2894 at 6/2/21, 6:49 PM:
------------------------------------------------------------------
This code has changed a lot since 1.6.0 and now uses a BatchWriter over a while loop.
was (Author: jmanno):
This code has changed a lot and now uses a BatchWriter over an while loop
> MultiTableBatchWriter.getBatchWriter has dubious loop condition
> ---------------------------------------------------------------
>
> Key: ACCUMULO-2894
> URL: https://issues.apache.org/jira/browse/ACCUMULO-2894
> Project: Accumulo
> Issue Type: Improvement
> Components: client
> Affects Versions: 1.6.0
> Reporter: Mike Drob
> Priority: Major
>
> This while loop could use a variable instead of multiple break and continue labels.
> {code}
> while (true) {
> long cacheResetCount = Tables.getCacheResetCount();
> // cacheResetCount could change after this point in time, but I think thats ok because just want to ensure this methods sees changes
> // made before it was called.
>
> long internalResetCount = cacheLastState.get();
> if (cacheResetCount > internalResetCount) {
> if (!cacheLastState.compareAndSet(internalResetCount, cacheResetCount)) {
> continue; // concurrent operation, lets not possibly move cacheLastState backwards in the case where a thread pauses for along time
> }
> nameToIdCache.invalidateAll();
> break;
> }
> break;
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)