[ 
https://issues.apache.org/jira/browse/GEODE-2694?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15965147#comment-15965147
 ] 

Eric Shu commented on GEODE-2694:
---------------------------------

There are two places that entry will be destroyed when recovered_from_disk bit 
is set to true.

After processing a full gii, all entries with the recovered_from_disk bit set 
to true will be destroyed, possibly try to remove the unfinished operations.
  final void finishInitializeOwner(LocalRegion drs, GIIStatus giiStatus) {
    if (isReadyForRecovery()) {
      // this.scheduleCompaction();
      if (GIIStatus.didFullGII(giiStatus)) {
    -->    destroyRemainingRecoveredEntries(drs);
      } else if (GIIStatus.didDeltaGII(giiStatus)) {
        // TODO: not sure if we should destroy old tombstones for deltaGII
      } else if (getRegionVersionVector() != null) {
        destroyOldTomstones(drs);
      }
      releaseRecoveryData();
    }

and here in InitialImageOperation.getFromOne
          // review unfinished keys and remove untouched entries
          if (this.region.getDataPolicy().withPersistence() && 
keysOfUnfinishedOps != null
              && !keysOfUnfinishedOps.isEmpty()) {
            final DiskRegion dr = this.region.getDiskRegion();
            assert dr != null;
            for (Object key : keysOfUnfinishedOps) {
              RegionEntry re = this.entries.getEntry(key);
              if (re == null) {
                continue;
              }
              if (logger.isTraceEnabled(LogMarker.GII)) {
                logger.trace(LogMarker.GII, "Processing unfinished 
operation:entry={}", re);
              }
              DiskEntry de = (DiskEntry) re;
              synchronized (de) {
                DiskId id = de.getDiskId();
                if (id != null && 
EntryBits.isRecoveredFromDisk(id.getUserBits())) {
                  this.region.destroyRecoveredEntry(key);
                  if (isDebugEnabled) {
                    logger.debug("Deleted unfinished keys:key={}", key);
                  }
                }
              }

The bit set in dr.testIsRecoveredAndClear is clearly needed during finishing 
gii.

During full gii, we could rewrite the entry to disk -- the optimization in the 
following could be thought as the entry was rewritten to disk as they have the 
same version tag.

                // If the received entry and what we have in the cache
                // actually are equal, keep don't put the received
                // entry into the cache (this avoids writing a record to disk)
                if (entriesEqual) {
                  continue;
                }

Will add unit tests to verify the RECOVERED_FROM_DISK bit after GII.

> RECOVERED_FROM_DISK bit is cleared during gii, but should be restored if the 
> recovered entry and gii entry has the same version tag
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-2694
>                 URL: https://issues.apache.org/jira/browse/GEODE-2694
>             Project: Geode
>          Issue Type: Bug
>          Components: regions
>            Reporter: Eric Shu
>
> Currently for all gii entries, product clears the RECOVERED_FROM_DISK bit for 
> DiskEntry. However, if entry comes from gii has the same version as recovered 
> entry, the RECOVERED_FROM_DISK bit should be restored but does not.
> {noformat}
>             synchronized (re) { // fixes bug 41409
>               if (dr.testIsRecoveredAndClear(re)) {
>                 wasRecovered = true;
>                 if (tmpValue == null) {
>                   tmpValue = entry.isLocalInvalid() ? Token.LOCAL_INVALID : 
> Token.INVALID;
>                 }
>                 // Compare the version stamps, and if they are equal
>                 // we can skip adding the entry we receive as part of GII.
>                 VersionStamp stamp = re.getVersionStamp();
>                 boolean entriesEqual = stamp != null && 
> stamp.asVersionTag().equals(tag);
>                 // If the received entry and what we have in the cache
>                 // actually are equal, keep don't put the received
>                 // entry into the cache (this avoids writing a record to disk)
>                 if (entriesEqual) {
>                   continue;
>                 }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to