Skip to content

Commit

Permalink
GEODE-10453 - in case of REMOVE_DUE_TO_GII_TOMBSTONE_CLEANUP and Comp…
Browse files Browse the repository at this point in the history
…actRangeIndex, specify not to lookup old key, which is very expensive operation. It's actually broken and regression. All the tombstone entries are going to be NullToken and cause class cast exception for every single remove compare if looking up old key. There is no old key during initial tombstone image sync up from lead peer.
  • Loading branch information
lfts22 committed Jan 15, 2025
1 parent d195814 commit 71e49b2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ void removeMapping(RegionEntry entry, int opCode) throws IMQException {
if (oldKeyValue.get() == null) {
return;
}
indexStore.removeMapping(oldKeyValue.get().getOldKey(), entry);
indexStore.removeMappingGII(oldKeyValue.get().getOldKey(), entry);
} else {
// rely on reverse map in the index store to figure out the real key
indexStore.removeMapping(IndexManager.NULL, entry);
indexStore.removeMappingGII(IndexManager.NULL, entry);
}
} else if (opCode == CLEAN_UP_THREAD_LOCALS) {
if (oldKeyValue != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ public interface IndexStore {
*/
void removeMapping(Object indexKey, RegionEntry re) throws IMQException;

/**
* Remove a mapping from the index store If entry at indexKey is not found, we must crawl the
* index to be sure the region entry does not exist
*
*/
void removeMappingGII(Object indexKey, RegionEntry re) throws IMQException;

/**
* Update a mapping in the index store. This method adds a new mapping and removes the old mapping
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public void updateMapping(Object indexKey, Object oldKey, RegionEntry re, Object
addMapping(indexKey, re);
}

@Override
public void removeMappingGII(Object indexKey, RegionEntry re) {
removeMapping(indexKey, re);
}

@Override
public void removeMapping(Object indexKey, RegionEntry re) {
indexMap.remove(indexKey, re.getKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,20 @@ public void addMapping(Object indexKey, RegionEntry re) throws IMQException {
updateMapping(indexKey, null, re, null);
}

@Override
public void removeMappingGII(Object indexKey, RegionEntry re) throws IMQException {
doRemoveMapping(indexKey, re, false);
}

@Override
public void removeMapping(Object indexKey, RegionEntry re) throws IMQException {
doRemoveMapping(indexKey, re, true);
}

private void doRemoveMapping(Object indexKey, RegionEntry re, boolean findOldKey)
throws IMQException {
// Remove from forward map
boolean found = basicRemoveMapping(indexKey, re, true);
boolean found = basicRemoveMapping(indexKey, re, findOldKey);
// Remove from reverse map.
// We do NOT need to synchronize here as different RegionEntries will be
// operating concurrently i.e. different keys in entryToValuesMap which
Expand Down

0 comments on commit 71e49b2

Please sign in to comment.