Search in sources :

Example 1 with DiskStoreID

use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.

the class Oplog method readDiskStoreRecord.

/**
   * @throws DiskAccessException if this file does not belong to our parent
   */
private void readDiskStoreRecord(DataInput dis, File f) throws IOException {
    long leastSigBits = dis.readLong();
    long mostSigBits = dis.readLong();
    DiskStoreID readDSID = new DiskStoreID(mostSigBits, leastSigBits);
    if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
        logger.trace(LogMarker.PERSIST_RECOVERY, "diskStoreId={}", readDSID);
    }
    readEndOfRecord(dis);
    DiskStoreID dsid = getParent().getDiskStoreID();
    if (!readDSID.equals(dsid)) {
        throw new DiskAccessException("The oplog file \"" + f + "\" does not belong to the init file \"" + getParent().getInitFile() + "\".", getParent());
    }
}
Also used : DiskAccessException(org.apache.geode.cache.DiskAccessException) DiskStoreID(org.apache.geode.internal.cache.persistence.DiskStoreID)

Example 2 with DiskStoreID

use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.

the class Oplog method createDummyTag.

private synchronized VersionTag createDummyTag(DiskRecoveryStore drs) {
    DiskStoreID member = getParent().getDiskStoreID();
    int memberid = getParent().getDiskInitFile().getOrCreateCanonicalId(member);
    long regionVersion = drs.getVersionForMember(member);
    VersionTag vt = VersionTag.create(member);
    vt.setEntryVersion(1);
    vt.setRegionVersion(regionVersion + 1);
    vt.setMemberID(member);
    vt.setVersionTimeStamp(getParent().getCache().cacheTimeMillis());
    vt.setDistributedSystemId(-1);
    return vt;
}
Also used : VersionTag(org.apache.geode.internal.cache.versions.VersionTag) DiskStoreID(org.apache.geode.internal.cache.persistence.DiskStoreID)

Example 3 with DiskStoreID

use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.

the class DiskVersionTag method readMember.

@Override
public DiskStoreID readMember(DataInput in) throws IOException {
    long mostSignificantBits = in.readLong();
    long leastSignificantBits = in.readLong();
    DiskStoreID member = new DiskStoreID(mostSignificantBits, leastSignificantBits);
    return member;
}
Also used : DiskStoreID(org.apache.geode.internal.cache.persistence.DiskStoreID)

Example 4 with DiskStoreID

use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.

the class DiskRegionVersionVector method readMember.

@Override
protected DiskStoreID readMember(DataInput in) throws IOException {
    long mostSignificantBits = in.readLong();
    long leastSignificantBits = in.readLong();
    DiskStoreID member = new DiskStoreID(mostSignificantBits, leastSignificantBits);
    return member;
}
Also used : DiskStoreID(org.apache.geode.internal.cache.persistence.DiskStoreID)

Example 5 with DiskStoreID

use of org.apache.geode.internal.cache.persistence.DiskStoreID in project geode by apache.

the class DiskInitFile method writeClearRecord.

/**
   * Write a clear with an RVV record.
   */
private void writeClearRecord(DiskRegionView dr, RegionVersionVector rvv) {
    try {
        HeapDataOutputStream hdos = new HeapDataOutputStream(32, Version.CURRENT);
        hdos.write(IFREC_CLEAR_REGION_WITH_RVV_ID);
        writeDiskRegionID(hdos, dr.getId());
        // We only need the memberToVersionMap for clear purposes
        Map<DiskStoreID, RegionVersionHolder> memberToVersion = rvv.getMemberToVersion();
        hdos.writeInt(memberToVersion.size());
        for (Map.Entry<DiskStoreID, RegionVersionHolder> entry : memberToVersion.entrySet()) {
            InternalDataSerializer.invokeToData(entry.getKey(), hdos);
            synchronized (entry.getValue()) {
                InternalDataSerializer.invokeToData(entry.getValue(), hdos);
            }
        }
        hdos.write(END_OF_RECORD_ID);
        // don't do stats for these small records
        writeIFRecord(hdos, false);
    } catch (IOException ex) {
        DiskAccessException dae = new DiskAccessException(LocalizedStrings.DiskInitFile_FAILED_INIT_FILE_WRITE_BECAUSE_0.toLocalizedString(ex), this.parent);
        if (!this.compactInProgress) {
            this.parent.handleDiskAccessException(dae);
        }
        throw dae;
    }
}
Also used : HeapDataOutputStream(org.apache.geode.internal.HeapDataOutputStream) DiskAccessException(org.apache.geode.cache.DiskAccessException) RegionVersionHolder(org.apache.geode.internal.cache.versions.RegionVersionHolder) IOException(java.io.IOException) DiskStoreID(org.apache.geode.internal.cache.persistence.DiskStoreID) Map(java.util.Map) Int2ObjectOpenHashMap(it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) Int2ObjectMap(it.unimi.dsi.fastutil.ints.Int2ObjectMap)

Aggregations

DiskStoreID (org.apache.geode.internal.cache.persistence.DiskStoreID)53 Test (org.junit.Test)38 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)26 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)26 RegionVersionVector (org.apache.geode.internal.cache.versions.RegionVersionVector)19 UnitTest (org.apache.geode.test.junit.categories.UnitTest)11 VersionTag (org.apache.geode.internal.cache.versions.VersionTag)10 HashMap (java.util.HashMap)5 Category (org.junit.experimental.categories.Category)4 Map (java.util.Map)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 DiskAccessException (org.apache.geode.cache.DiskAccessException)3 PersistentMemberID (org.apache.geode.internal.cache.persistence.PersistentMemberID)3 Int2ObjectMap (it.unimi.dsi.fastutil.ints.Int2ObjectMap)2 Int2ObjectOpenHashMap (it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap)2 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 HeapDataOutputStream (org.apache.geode.internal.HeapDataOutputStream)2 PersistentMemberPattern (org.apache.geode.internal.cache.persistence.PersistentMemberPattern)2