[
https://issues.apache.org/jira/browse/HBASE-10539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13901572#comment-13901572
]
Feng Honghua commented on HBASE-10539:
--------------------------------------
This bug is exposed during investigating HBASE-10499, but looks like it should
not be the cause of HBASE-10499:
# The memstoreSize isn't wrongly calculated by this bug, since its final result
is correct either getAndAdd or addAndGet is used.
# Returning previous value makes it more conservative in term of determining if
a flush should be triggered, it can only result in the 'delayed flush trigger
problem' that flush should be triggered immediately after a write but in fact
not until next write. But the problem of HBASE-10499 is that flush is triggered
(many time) but never successfully completes, or to be accurate, not start at
all.
> HRegion.addAndGetGlobalMemstoreSize() is expected to return the new memstore
> size after added, but actually the previous size before added is returned
> instead
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HBASE-10539
> URL: https://issues.apache.org/jira/browse/HBASE-10539
> Project: HBase
> Issue Type: Bug
> Components: regionserver
> Reporter: Feng Honghua
> Assignee: Feng Honghua
> Attachments: HBASE-10539-trunk_v1.patch
>
>
> HRegion.addAndGetGlobalMemstoreSize(addedSize) is called once some write
> succeeds and 'addedSize' is the size of the edits newly put to the memstore,
> the returned value of HRegion.addAndGetGlobalMemstoreSize(addedSize) is then
> checked against the flush threshold to determine if a flush for the region
> should be triggered.
> By design the returned value should be the updated memstore size after adding
> 'addedSize', but current implementation uses this.memstoreSize.getAndAdd
> which returns the previous size before adding, actually 'addAndGet' rather
> than 'getAndAdd' should be used here.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)