[M] Change in asterixdb[totoro]: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc is full

2026-10-03 Thread AsterixDB Code Review
Attention is currently required from: Ali Alsuliman, Ian Maxon, Murtadha 
Hubail, Ritik Raj.

Anon. E. Moose #1000171 has posted comments on this change by Michael Blow. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email )

Change subject: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc 
is full
..


Patch Set 3:

Analytics Compatibility Compilation Successful
https://cbjenkins.page.link/j8rcDhs26JRTtC8y9 : SUCCESS


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: totoro
Gerrit-Change-Id: I4cccd9857d277b1a32017f0afcbd644e33388f2f
Gerrit-Change-Number: 21627
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Blow 
Gerrit-Reviewer: Ali Alsuliman 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Ian Maxon 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Michael Blow 
Gerrit-Reviewer: Murtadha Hubail 
Gerrit-Reviewer: Ritik Raj 
Gerrit-Attention: Murtadha Hubail 
Gerrit-Attention: Ian Maxon 
Gerrit-Attention: Ali Alsuliman 
Gerrit-Attention: Ritik Raj 
Gerrit-Comment-Date: Sat, 03 Oct 2026 17:17:16 +
Gerrit-HasComments: No
Gerrit-Has-Labels: No


[M] Change in asterixdb[totoro]: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc is full

2026-10-03 Thread AsterixDB Code Review
>From Michael Blow :

Attention is currently required from: Ali Alsuliman, Ian Maxon, Murtadha 
Hubail, Ritik Raj.

Michael Blow has posted comments on this change by Michael Blow. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email )

Change subject: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc 
is full
..


Patch Set 3:

(2 comments)

Commit Message:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627/comment/bfb78fa7_c4600cd1?usp=email
 :
PS2, Line 7: NO ISSUE]
> this seems like a substantial enough change to merit an issue, because it is 
> changing longstanding c […]
Done


File 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627/comment/176d77e6_5217ee52?usp=email
 :
PS2, Line 518: * behind for data that never arrived, and enough such indexes 
fill the cache with components that
 :  * {@link #selectFlushIndex()} will never select, 
because it only selects components which are not empty.
> if this is the specific situation this method fixes, why not instead make it 
> so that selectFlushInde […]
Done



--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: totoro
Gerrit-Change-Id: I4cccd9857d277b1a32017f0afcbd644e33388f2f
Gerrit-Change-Number: 21627
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Blow 
Gerrit-Reviewer: Ali Alsuliman 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Ian Maxon 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Michael Blow 
Gerrit-Reviewer: Murtadha Hubail 
Gerrit-Reviewer: Ritik Raj 
Gerrit-Attention: Murtadha Hubail 
Gerrit-Attention: Ian Maxon 
Gerrit-Attention: Ali Alsuliman 
Gerrit-Attention: Ritik Raj 
Gerrit-Comment-Date: Sat, 03 Oct 2026 17:08:35 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ian Maxon 


[M] Change in asterixdb[totoro]: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc is full

2026-10-03 Thread AsterixDB Code Review
>From Michael Blow :

Attention is currently required from: Ali Alsuliman, Ian Maxon, Murtadha 
Hubail, Ritik Raj.

Michael Blow has posted comments on this change by Michael Blow. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email )

Change subject: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc 
is full
..


Patch Set 3:

(2 comments)

Commit Message:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627/comment/83dee45d_d7aef0c9?usp=email
 :
PS2, Line 46: Change-Id: I4cccd9857d277b1a32017f0afcbd644e33388f2f
> should be the last line shouldn't it? though i guess it worked
Last paragraph is all that is required by Gerrit.


File 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627/comment/a296e7b8_945635c4?usp=email
 :
PS2, Line 519:  * {@link #selectFlushIndex()} will never select, 
because it only selects components which are not empty.
> I looked at that, but it doesn't work. […]
Done



--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: totoro
Gerrit-Change-Id: I4cccd9857d277b1a32017f0afcbd644e33388f2f
Gerrit-Change-Number: 21627
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Blow 
Gerrit-Reviewer: Ali Alsuliman 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Ian Maxon 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Michael Blow 
Gerrit-Reviewer: Murtadha Hubail 
Gerrit-Reviewer: Ritik Raj 
Gerrit-Attention: Murtadha Hubail 
Gerrit-Attention: Ian Maxon 
Gerrit-Attention: Ali Alsuliman 
Gerrit-Attention: Ritik Raj 
Gerrit-Comment-Date: Sat, 03 Oct 2026 17:08:18 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ian Maxon 
Comment-In-Reply-To: Michael Blow 


[M] Change in asterixdb[totoro]: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc is full

2026-10-03 Thread AsterixDB Code Review
Attention is currently required from: Ali Alsuliman, Ian Maxon, Michael Blow, 
Murtadha Hubail, Ritik Raj.

Anon. E. Moose #1000171 has posted comments on this change by Michael Blow. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email )

Change subject: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc 
is full
..


Patch Set 3: Verified-1

https://server.jenkins.couchbase.com/job/asterixdb-restricted-branch-check/7346/artifact/restriction/restricted.html
 : BRANCH RESTRICTED (Please check URL for more information)


--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: totoro
Gerrit-Change-Id: I4cccd9857d277b1a32017f0afcbd644e33388f2f
Gerrit-Change-Number: 21627
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Blow 
Gerrit-Reviewer: Ali Alsuliman 
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Ian Maxon 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Michael Blow 
Gerrit-Reviewer: Murtadha Hubail 
Gerrit-Reviewer: Ritik Raj 
Gerrit-Attention: Murtadha Hubail 
Gerrit-Attention: Ian Maxon 
Gerrit-Attention: Ali Alsuliman 
Gerrit-Attention: Michael Blow 
Gerrit-Attention: Ritik Raj 
Gerrit-Comment-Date: Sat, 03 Oct 2026 16:59:39 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes


[M] Change in asterixdb[totoro]: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc is full

2026-10-03 Thread AsterixDB Code Review
>From Michael Blow :

Attention is currently required from: Ali Alsuliman, Ian Maxon, Murtadha 
Hubail, Ritik Raj.

Michael Blow has posted comments on this change by Michael Blow. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email )

Change subject: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc 
is full
..


Patch Set 2:

(3 comments)

Patch set 3 rebases onto current totoro and re-scopes the change. 
ASTERIXDB-3824 has since removed the larger source of idle components (eagerly 
allocated siblings), so this is now a safety net for the path that remains: an 
index that is read, or has a flush scheduled, but is never written still 
allocates its current memory component and never activates it. Filed as 
ASTERIXDB-3940.

Commit Message:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627/comment/3800fd5c_362b2cef?usp=email
 :
PS2, Line 7: [NO ISSUE][STO] Reclaim idle memory components when the vbc is full
> this seems like a substantial enough change to merit an issue, because it is 
> changing longstanding c […]
Agreed. Filed ASTERIXDB-3940.


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627/comment/0b66bc10_5f135987?usp=email
 :
PS2, Line 46: Change-Id: I4cccd9857d277b1a32017f0afcbd644e33388f2f
> should be the last line shouldn't it? though i guess it worked
Done. Change-Id is last now, and the trailers are Generated-by.


File 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627/comment/b4f73771_7bbc169d?usp=email
 :
PS2, Line 519:  * {@link #selectFlushIndex()} will never select, 
because it only selects components which are not empty.
> if this is the specific situation this method fixes, why not instead make it 
> so that selectFlushInde […]
I looked at that, but it doesn't work. selectFlushIndex()'s caller adds the 
selected index to flushingIndexes, and only flushed() takes it out again. 
PrimaryIndexOperationTracker.flushIfRequested() skips the flush of an empty 
primary index ("... is empty... skipping flush"), so flushed() never runs for 
it. Each empty index selected that way would hold one of the 
maxConcurrentFlushes slots permanently, and enough of them would stop real 
flushes too. Giving back an empty component's pages isn't a flush, so it needs 
its own path. I've put this in the javadoc as well.

The simpler fix at the source would be to not allocate memory components on 
paths that can't write to them (enter() for a search, scheduleFlush() on an 
index that was never written). I've noted that on ASTERIXDB-3940 as a 
longer-term alternative. It touches every isMemoryComponentsAllocated() call 
site in LSMHarness, so I've kept it out of this change.



--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: totoro
Gerrit-Change-Id: I4cccd9857d277b1a32017f0afcbd644e33388f2f
Gerrit-Change-Number: 21627
Gerrit-PatchSet: 2
Gerrit-Owner: Michael Blow 
Gerrit-Reviewer: Ali Alsuliman 
Gerrit-Reviewer: Ian Maxon 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Michael Blow 
Gerrit-Reviewer: Murtadha Hubail 
Gerrit-Reviewer: Ritik Raj 
Gerrit-Attention: Murtadha Hubail 
Gerrit-Attention: Ian Maxon 
Gerrit-Attention: Ali Alsuliman 
Gerrit-Attention: Ritik Raj 
Gerrit-Comment-Date: Sat, 03 Oct 2026 16:59:29 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ian Maxon 


[M] Change in asterixdb[totoro]: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc is full

2026-10-03 Thread AsterixDB Code Review
>From Michael Blow :

Attention is currently required from: Ali Alsuliman, Michael Blow, Murtadha 
Hubail, Ritik Raj.

Hello Ali Alsuliman, Ian Maxon, Jenkins, Murtadha Hubail, Ritik Raj,

I'd like you to reexamine a change. Please visit

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email

to look at the new patch set (#3).

The following approvals got outdated and were removed:
Code-Review+1 by Michael Blow, Verified+1 by Jenkins


Change subject: [ASTERIXDB-3940][STO] Reclaim idle memory components when vbc 
is full
..

[ASTERIXDB-3940][STO] Reclaim idle memory components when vbc is full

- user model changes: no
- storage format changes: no
- interface changes: no

Details: An index which has never been written still allocates its
current memory component when it is first entered, by a read or by a
scheduled flush as well as by a write, and the component pins a metadata
page and a root page as soon as its BTree is created. Only a write
activates it, so it stays INACTIVE and keeps those pages until the
dataset is closed: only a flush returns a component's pages, and the
flush of an empty primary index is skipped. Enough such indexes fill the
global virtual buffer cache with components selectFlushIndex() will
never pick, because it only picks components which are not empty.
Writers then fail threadEnter()'s !vbc.isFull() check and retry every
100ms forever, with nothing left which can make it false, and nothing is
logged. The deadlock watchdog sees no cycle- the writer is in a timed
wait, not blocked on a monitor.

Selecting such components for flush would not help. A selected index
stays in flushingIndexes until flushed() removes it, which a skipped
flush never reaches, so each one would hold a flush slot for good.

So when a scheduleFlush() finds the cache full, nothing flushable and no
flush in flight- so no completion is coming to free pages or to wake the
flush thread again- reclaim the pages held by components which are
allocated but INACTIVE, and warn if even that finds nothing. Reclaiming
costs the next writer to that index a re-allocation, which is the same
one it already pays after every flush. The components are not reset:
they are INACTIVE, so they have already been reset or were never used,
and resetting again would decrement the index's scheduled flush count a
second time.

The pass takes each index's operation tracker, which is what a writer
holds while it activates a component, and copies primaryIndexes under
the cache monitor first so that the cache-then-op-tracker order
selectFlushIndex() establishes is preserved rather than extended.

Ext-ref: MB-74383
Generated-by: Claude Opus 5 
Generated-by: Claude Opus 5.5 
Change-Id: I4cccd9857d277b1a32017f0afcbd644e33388f2f
---
M 
asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/GlobalVirtualBufferCacheTest.java
M 
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
2 files changed, 184 insertions(+), 0 deletions(-)


  git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb 
refs/changes/27/21627/3
--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/21627?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: asterixdb
Gerrit-Branch: totoro
Gerrit-Change-Id: I4cccd9857d277b1a32017f0afcbd644e33388f2f
Gerrit-Change-Number: 21627
Gerrit-PatchSet: 3
Gerrit-Owner: Michael Blow 
Gerrit-Reviewer: Ali Alsuliman 
Gerrit-Reviewer: Ian Maxon 
Gerrit-Reviewer: Jenkins 
Gerrit-Reviewer: Michael Blow 
Gerrit-Reviewer: Murtadha Hubail 
Gerrit-Reviewer: Ritik Raj 
Gerrit-Attention: Murtadha Hubail 
Gerrit-Attention: Ali Alsuliman 
Gerrit-Attention: Michael Blow 
Gerrit-Attention: Ritik Raj