commit | 3809a33b4cb41f25d929dbbb8efc1b69b639bf26 | [log] [tgz] |
---|---|---|
author | Murtadha Hubail <mhubail@apache.org> | Tue May 12 09:15:28 2020 +0300 |
committer | Murtadha Hubail <mhubail@apache.org> | Tue May 12 16:35:37 2020 +0000 |
tree | a6e2b566569e144c270a16887f60c43d5319de59 | |
parent | 7904d14438102898476e84a33f4ea35b3cfecacb [diff] |
[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 <jenkins@fulliautomatix.ics.uci.edu> Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu> Reviewed-by: Luo Chen <cluo8@uci.edu>
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 @@ 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();