use of org.apache.geode.internal.Version in project geode by apache.
the class RemoteRemoveAllMessage method fromData.
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
super.fromData(in);
this.eventId = (EventID) DataSerializer.readObject(in);
this.callbackArg = DataSerializer.readObject(in);
this.posDup = (flags & POS_DUP) != 0;
if ((flags & HAS_BRIDGE_CONTEXT) != 0) {
this.bridgeContext = DataSerializer.readObject(in);
}
this.removeAllDataCount = (int) InternalDataSerializer.readUnsignedVL(in);
this.removeAllData = new RemoveAllEntryData[removeAllDataCount];
if (this.removeAllDataCount > 0) {
final Version version = InternalDataSerializer.getVersionForDataStreamOrNull(in);
final ByteArrayDataInput bytesIn = new ByteArrayDataInput();
for (int i = 0; i < this.removeAllDataCount; i++) {
this.removeAllData[i] = new RemoveAllEntryData(in, this.eventId, i, version, bytesIn);
}
boolean hasTags = in.readBoolean();
if (hasTags) {
EntryVersionsList versionTags = EntryVersionsList.create(in);
for (int i = 0; i < this.removeAllDataCount; i++) {
this.removeAllData[i].versionTag = versionTags.get(i);
}
}
}
}
use of org.apache.geode.internal.Version in project geode by apache.
the class DiskInitFileParser method parse.
public DiskStoreID parse() throws IOException, ClassNotFoundException {
Version gfversion = Version.GFE_662;
DiskStoreID result = null;
boolean endOfFile = false;
while (!endOfFile) {
if (dis.atEndOfFile()) {
endOfFile = true;
break;
}
byte opCode = dis.readByte();
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "DiskInitFile opcode={}", opCode);
}
switch(opCode) {
case DiskInitFile.IF_EOF_ID:
endOfFile = true;
gotEOF = true;
break;
case DiskInitFile.IFREC_INSTANTIATOR_ID:
{
int id = dis.readInt();
String cn = readClassName(dis);
String icn = readClassName(dis);
readEndOfRecord(dis);
interpreter.cmnInstantiatorId(id, cn, icn);
}
break;
case DiskInitFile.IFREC_DATA_SERIALIZER_ID:
{
Class<?> dsc = readClass(dis);
readEndOfRecord(dis);
interpreter.cmnDataSerializerId(dsc);
}
break;
case DiskInitFile.IFREC_ONLINE_MEMBER_ID:
{
long drId = readDiskRegionID(dis);
PersistentMemberID pmid = readPMID(dis, gfversion);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_ONLINE_MEMBER_ID drId={} omid={}", drId, pmid);
}
interpreter.cmnOnlineMemberId(drId, pmid);
}
break;
case DiskInitFile.IFREC_OFFLINE_MEMBER_ID:
{
long drId = readDiskRegionID(dis);
PersistentMemberID pmid = readPMID(dis, gfversion);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_OFFLINE_MEMBER_ID drId={} pmid={}", drId, pmid);
}
interpreter.cmnOfflineMemberId(drId, pmid);
}
break;
case DiskInitFile.IFREC_RM_MEMBER_ID:
{
long drId = readDiskRegionID(dis);
PersistentMemberID pmid = readPMID(dis, gfversion);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_RM_MEMBER_ID drId={} pmid={}", drId, pmid);
}
interpreter.cmnRmMemberId(drId, pmid);
}
break;
case DiskInitFile.IFREC_MY_MEMBER_INITIALIZING_ID:
{
long drId = readDiskRegionID(dis);
PersistentMemberID pmid = readPMID(dis, gfversion);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_MY_MEMBER_INITIALIZING_ID drId={} pmid={}", drId, pmid);
}
interpreter.cmnAddMyInitializingPMID(drId, pmid);
}
break;
case DiskInitFile.IFREC_MY_MEMBER_INITIALIZED_ID:
{
long drId = readDiskRegionID(dis);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_MY_MEMBER_INITIALIZED_ID drId={}", drId);
}
interpreter.cmnMarkInitialized(drId);
}
break;
case DiskInitFile.IFREC_CREATE_REGION_ID:
{
long drId = readDiskRegionID(dis);
String regName = dis.readUTF();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CREATE_REGION_ID drId= name={}", drId, regName);
}
interpreter.cmnCreateRegion(drId, regName);
}
break;
case DiskInitFile.IFREC_BEGIN_DESTROY_REGION_ID:
{
long drId = readDiskRegionID(dis);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_BEGIN_DESTROY_REGION_ID drId={}", drId);
}
interpreter.cmnBeginDestroyRegion(drId);
}
break;
case DiskInitFile.IFREC_END_DESTROY_REGION_ID:
{
long drId = readDiskRegionID(dis);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_END_DESTROY_REGION_ID drId={}", drId);
}
interpreter.cmnEndDestroyRegion(drId);
}
break;
case DiskInitFile.IFREC_BEGIN_PARTIAL_DESTROY_REGION_ID:
{
long drId = readDiskRegionID(dis);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_BEGIN_PARTIAL_DESTROY_REGION_ID drId={}", drId);
}
interpreter.cmnBeginPartialDestroyRegion(drId);
}
break;
case DiskInitFile.IFREC_END_PARTIAL_DESTROY_REGION_ID:
{
long drId = readDiskRegionID(dis);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_END_PARTIAL_DESTROY_REGION_ID drId={}", drId);
}
interpreter.cmnEndPartialDestroyRegion(drId);
}
break;
case DiskInitFile.IFREC_CLEAR_REGION_ID:
{
long drId = readDiskRegionID(dis);
long clearOplogEntryId = dis.readLong();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CLEAR_REGION_ID drId={} oplogEntryId={}", drId, clearOplogEntryId);
}
interpreter.cmnClearRegion(drId, clearOplogEntryId);
}
break;
case DiskInitFile.IFREC_CLEAR_REGION_WITH_RVV_ID:
{
long drId = readDiskRegionID(dis);
int size = dis.readInt();
ConcurrentHashMap<DiskStoreID, RegionVersionHolder<DiskStoreID>> memberToVersion = new ConcurrentHashMap<DiskStoreID, RegionVersionHolder<DiskStoreID>>(size);
for (int i = 0; i < size; i++) {
DiskStoreID id = new DiskStoreID();
InternalDataSerializer.invokeFromData(id, dis);
RegionVersionHolder holder = new RegionVersionHolder(dis);
memberToVersion.put(id, holder);
}
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CLEAR_REGION_WITH_RVV_ID drId={} memberToVersion={}", drId, memberToVersion);
}
interpreter.cmnClearRegion(drId, memberToVersion);
}
break;
case DiskInitFile.IFREC_CRF_CREATE:
{
long oplogId = dis.readLong();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CRF_CREATE oplogId={}", oplogId);
}
interpreter.cmnCrfCreate(oplogId);
}
break;
case DiskInitFile.IFREC_DRF_CREATE:
{
long oplogId = dis.readLong();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_DRF_CREATE oplogId={}", oplogId);
}
interpreter.cmnDrfCreate(oplogId);
}
break;
case DiskInitFile.IFREC_KRF_CREATE:
{
long oplogId = dis.readLong();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_KRF_CREATE oplogId={}", oplogId);
}
interpreter.cmnKrfCreate(oplogId);
}
break;
case DiskInitFile.IFREC_CRF_DELETE:
{
long oplogId = dis.readLong();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_CRF_DELETE oplogId={}", oplogId);
}
interpreter.cmnCrfDelete(oplogId);
}
break;
case DiskInitFile.IFREC_DRF_DELETE:
{
long oplogId = dis.readLong();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_DRF_DELETE oplogId={}", oplogId);
}
interpreter.cmnDrfDelete(oplogId);
}
break;
case DiskInitFile.IFREC_REGION_CONFIG_ID:
{
long drId = readDiskRegionID(dis);
byte lruAlgorithm = dis.readByte();
byte lruAction = dis.readByte();
int lruLimit = dis.readInt();
int concurrencyLevel = dis.readInt();
int initialCapacity = dis.readInt();
float loadFactor = dis.readFloat();
boolean statisticsEnabled = dis.readBoolean();
boolean isBucket = dis.readBoolean();
EnumSet<DiskRegionFlag> flags = EnumSet.noneOf(DiskRegionFlag.class);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REGION_CONFIG_ID drId={}", drId);
}
interpreter.cmnRegionConfig(drId, lruAlgorithm, lruAction, lruLimit, concurrencyLevel, initialCapacity, loadFactor, statisticsEnabled, isBucket, flags, // fixes bug 43910
ProxyBucketRegion.NO_FIXED_PARTITION_NAME, -1, null, false);
}
break;
case DiskInitFile.IFREC_REGION_CONFIG_ID_66:
{
long drId = readDiskRegionID(dis);
byte lruAlgorithm = dis.readByte();
byte lruAction = dis.readByte();
int lruLimit = dis.readInt();
int concurrencyLevel = dis.readInt();
int initialCapacity = dis.readInt();
float loadFactor = dis.readFloat();
boolean statisticsEnabled = dis.readBoolean();
boolean isBucket = dis.readBoolean();
EnumSet<DiskRegionFlag> flags = EnumSet.noneOf(DiskRegionFlag.class);
String partitionName = dis.readUTF();
int startingBucketId = dis.readInt();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REGION_CONFIG_ID drId={}", drId);
}
interpreter.cmnRegionConfig(drId, lruAlgorithm, lruAction, lruLimit, concurrencyLevel, initialCapacity, loadFactor, statisticsEnabled, isBucket, flags, partitionName, startingBucketId, null, false);
}
break;
case DiskInitFile.IFREC_REGION_CONFIG_ID_80:
{
long drId = readDiskRegionID(dis);
byte lruAlgorithm = dis.readByte();
byte lruAction = dis.readByte();
int lruLimit = dis.readInt();
int concurrencyLevel = dis.readInt();
int initialCapacity = dis.readInt();
float loadFactor = dis.readFloat();
boolean statisticsEnabled = dis.readBoolean();
boolean isBucket = dis.readBoolean();
EnumSet<DiskRegionFlag> flags = EnumSet.noneOf(DiskRegionFlag.class);
String partitionName = dis.readUTF();
int startingBucketId = dis.readInt();
String compressorClassName = dis.readUTF();
if ("".equals(compressorClassName)) {
compressorClassName = null;
}
if (dis.readBoolean()) {
flags.add(DiskRegionFlag.IS_WITH_VERSIONING);
}
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REGION_CONFIG_ID drId={}", drId);
}
interpreter.cmnRegionConfig(drId, lruAlgorithm, lruAction, lruLimit, concurrencyLevel, initialCapacity, loadFactor, statisticsEnabled, isBucket, flags, partitionName, startingBucketId, compressorClassName, false);
}
break;
case DiskInitFile.IFREC_REGION_CONFIG_ID_90:
{
long drId = readDiskRegionID(dis);
byte lruAlgorithm = dis.readByte();
byte lruAction = dis.readByte();
int lruLimit = dis.readInt();
int concurrencyLevel = dis.readInt();
int initialCapacity = dis.readInt();
float loadFactor = dis.readFloat();
boolean statisticsEnabled = dis.readBoolean();
boolean isBucket = dis.readBoolean();
EnumSet<DiskRegionFlag> flags = EnumSet.noneOf(DiskRegionFlag.class);
String partitionName = dis.readUTF();
int startingBucketId = dis.readInt();
String compressorClassName = dis.readUTF();
if ("".equals(compressorClassName)) {
compressorClassName = null;
}
if (dis.readBoolean()) {
flags.add(DiskRegionFlag.IS_WITH_VERSIONING);
}
boolean offHeap = dis.readBoolean();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REGION_CONFIG_ID drId={}", drId);
}
interpreter.cmnRegionConfig(drId, lruAlgorithm, lruAction, lruLimit, concurrencyLevel, initialCapacity, loadFactor, statisticsEnabled, isBucket, flags, partitionName, startingBucketId, compressorClassName, offHeap);
}
break;
case DiskInitFile.IFREC_OFFLINE_AND_EQUAL_MEMBER_ID:
{
long drId = readDiskRegionID(dis);
PersistentMemberID pmid = readPMID(dis, gfversion);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_OFFLINE_AND_EQUAL_MEMBER_ID drId={} pmid={}", drId, pmid);
}
interpreter.cmdOfflineAndEqualMemberId(drId, pmid);
}
break;
case DiskInitFile.IFREC_DISKSTORE_ID:
{
long leastSigBits = dis.readLong();
long mostSigBits = dis.readLong();
readEndOfRecord(dis);
result = new DiskStoreID(mostSigBits, leastSigBits);
interpreter.cmnDiskStoreID(result);
}
break;
case DiskInitFile.OPLOG_MAGIC_SEQ_ID:
readOplogMagicSeqRecord(dis, OPLOG_TYPE.IF);
break;
case DiskInitFile.IFREC_PR_CREATE:
{
String name = dis.readUTF();
int numBuckets = dis.readInt();
String colocatedWith = dis.readUTF();
readEndOfRecord(dis);
PRPersistentConfig config = new PRPersistentConfig(numBuckets, colocatedWith);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_PR_CREATE name={}, config={}", name, config);
}
interpreter.cmnPRCreate(name, config);
}
break;
case DiskInitFile.IFREC_GEMFIRE_VERSION:
{
short ver = Version.readOrdinal(dis);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_GEMFIRE_VERSION version={}", ver);
}
try {
gfversion = Version.fromOrdinal(ver, false);
} catch (UnsupportedVersionException e) {
throw new DiskAccessException(LocalizedStrings.Oplog_UNEXPECTED_PRODUCT_VERSION_0.toLocalizedString(ver), e, this.interpreter.getNameForError());
}
interpreter.cmnGemfireVersion(gfversion);
break;
}
case DiskInitFile.IFREC_PR_DESTROY:
{
String name = dis.readUTF();
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_PR_DESTROY name={}", name);
}
interpreter.cmnPRDestroy(name);
}
break;
case DiskInitFile.IFREC_ADD_CANONICAL_MEMBER_ID:
{
int id = dis.readInt();
Object object = DataSerializer.readObject(dis);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_ADD_CANONICAL_MEMBER_ID id={} name={}", id, object);
}
interpreter.cmnAddCanonicalMemberId(id, object);
break;
}
case DiskInitFile.IFREC_REVOKE_DISK_STORE_ID:
{
PersistentMemberPattern pattern = new PersistentMemberPattern();
InternalDataSerializer.invokeFromData(pattern, dis);
readEndOfRecord(dis);
if (logger.isTraceEnabled(LogMarker.PERSIST_RECOVERY)) {
logger.trace(LogMarker.PERSIST_RECOVERY, "IFREC_REVOKE_DISK_STORE_ID id={}" + pattern);
}
interpreter.cmnRevokeDiskStoreId(pattern);
}
break;
default:
throw new DiskAccessException(LocalizedStrings.DiskInitFile_UNKNOWN_OPCODE_0_FOUND.toLocalizedString(opCode), this.interpreter.getNameForError());
}
if (interpreter.isClosing()) {
break;
}
}
return result;
}
use of org.apache.geode.internal.Version in project geode by apache.
the class ByteSourceJUnitTest method testSendToDataOutput.
@Test
public void testSendToDataOutput() throws IOException {
HeapDataOutputStream hdos = new HeapDataOutputStream((Version) null);
ByteSource bs = createByteSource(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 });
bs.sendTo(hdos);
assertEquals(0, bs.remaining());
ByteBuffer bb = hdos.toByteBuffer();
assertEquals(10, bb.limit());
assertEquals(ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 }), bb);
bs.position(1);
bs.limit(9);
hdos = new HeapDataOutputStream((Version) null);
bs.sendTo(hdos);
assertEquals(0, bs.remaining());
bb = hdos.toByteBuffer();
assertEquals(8, bb.limit());
assertEquals(ByteBuffer.wrap(new byte[] { 2, 3, 4, 5, 6, 7, 8, 9 }), bb);
}
use of org.apache.geode.internal.Version in project geode by apache.
the class OldClientSupportDUnitTest method testConversionOfArrayTypes.
@Test
public void testConversionOfArrayTypes() throws Exception {
OldClientSupportService oldClientSupport = OldClientSupportProvider.getService(myCache);
Version oldClientVersion = Version.GFE_82;
VersionedDataOutputStream dout = new VersionedDataOutputStream(new HeapDataOutputStream(10, oldClientVersion), oldClientVersion);
for (String geodeClassName : newArrayClassNames) {
String newName = oldClientSupport.processOutgoingClassName(geodeClassName, dout);
Assert.assertNotEquals(geodeClassName, newName);
}
for (String className : allNonconformingArrayClassNames) {
String newName = oldClientSupport.processOutgoingClassName(className, dout);
Assert.assertEquals(className, newName);
}
VersionedDataInputStream din = new VersionedDataInputStream(new DataInputStream(new ByteArrayInputStream(new byte[10])), oldClientVersion);
for (String oldClassName : oldArrayClassNames) {
String newName = oldClientSupport.processIncomingClassName(oldClassName, din);
Assert.assertNotEquals(oldClassName, newName);
}
}
use of org.apache.geode.internal.Version in project geode by apache.
the class OldClientSupportDUnitTest method convertThrowable.
private void convertThrowable(String geodeClassName) throws Exception {
Version oldClientVersion = Version.GFE_82;
final String comGemstoneGemFire = "com.gemstone.gemfire";
final int comGemstoneGemFireLength = comGemstoneGemFire.length();
OldClientSupportService oldClientSupport = OldClientSupportProvider.getService(myCache);
System.out.println("checking " + geodeClassName);
Class geodeClass = Class.forName(geodeClassName);
Object geodeObject = instantiate(geodeClass);
if (geodeObject instanceof Throwable) {
Throwable geodeThrowable = (Throwable) instantiate(geodeClass);
Throwable gemfireThrowable = oldClientSupport.getThrowable(geodeThrowable, oldClientVersion);
Assert.assertEquals("Failed to convert " + geodeClassName + ". Throwable class is " + gemfireThrowable.getClass().getName(), comGemstoneGemFire, gemfireThrowable.getClass().getName().substring(0, comGemstoneGemFireLength));
}
}
Aggregations