This is an automated email from the ASF dual-hosted git repository.
mhubail pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git
The following commit(s) were added to refs/heads/master by this push:
new 3809a33 [ASTERIXDB-2730][STO] Safely Update Flush Pointer in GVBC
3809a33 is described below
commit 3809a33b4cb41f25d929dbbb8efc1b69b639bf26
Author: Murtadha Hubail <[email protected]>
AuthorDate: Tue May 12 09:15:28 2020 +0300
[ASTERIXDB-2730][STO] Safely Update Flush Pointer in GVBC
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Ensure at least one primary index is registered before
updating the flush pointer in GlobalVirtualBufferCache.
Otherwise, reset the pointer to zero.
Change-Id: Ib0b3c9c7cfcf7b6a3c2f404f42d1d4802cf12b28
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/6285
Integration-Tests: Jenkins <[email protected]>
Tested-by: Jenkins <[email protected]>
Reviewed-by: Luo Chen <[email protected]>
---
.../org/apache/asterix/common/context/GlobalVirtualBufferCache.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
index 6e97d64..5177b25 100644
---
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
+++
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/context/GlobalVirtualBufferCache.java
@@ -123,7 +123,9 @@ public class GlobalVirtualBufferCache implements
IVirtualBufferCache, ILifeCycle
int pos = primaryIndexes.indexOf(index);
if (pos >= 0) {
primaryIndexes.remove(index);
- if (flushPtr > pos) {
+ if (primaryIndexes.isEmpty()) {
+ flushPtr = 0;
+ } else if (flushPtr > pos) {
// If the removed index is before flushPtr, we should
decrement flushPtr by 1 so that
// it still points to the same index.
flushPtr = (flushPtr - 1) % primaryIndexes.size();