本文整理汇总了Java中org.apache.cassandra.net.MessagingService.VERSION_21属性的典型用法代码示例。如果您正苦于以下问题:Java MessagingService.VERSION_21属性的具体用法?Java MessagingService.VERSION_21怎么用?Java MessagingService.VERSION_21使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.cassandra.net.MessagingService
的用法示例。
在下文中一共展示了MessagingService.VERSION_21属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
public void serialize(RepairJobDesc desc, DataOutputPlus out, int version) throws IOException
{
if (version >= MessagingService.VERSION_21)
{
out.writeBoolean(desc.parentSessionId != null);
if (desc.parentSessionId != null)
UUIDSerializer.serializer.serialize(desc.parentSessionId, out, version);
}
UUIDSerializer.serializer.serialize(desc.sessionId, out, version);
out.writeUTF(desc.keyspace);
out.writeUTF(desc.columnFamily);
MessagingService.validatePartitioner(desc.ranges);
out.writeInt(desc.ranges.size());
for (Range<Token> rt : desc.ranges)
AbstractBounds.tokenSerializer.serialize(rt, out, version);
}
示例2: deserialize
public RepairJobDesc deserialize(DataInputPlus in, int version) throws IOException
{
UUID parentSessionId = null;
if (version >= MessagingService.VERSION_21)
{
if (in.readBoolean())
parentSessionId = UUIDSerializer.serializer.deserialize(in, version);
}
UUID sessionId = UUIDSerializer.serializer.deserialize(in, version);
String keyspace = in.readUTF();
String columnFamily = in.readUTF();
int nRanges = in.readInt();
Collection<Range<Token>> ranges = new ArrayList<>();
Range<Token> range;
for (int i = 0; i < nRanges; i++)
{
range = (Range<Token>) AbstractBounds.tokenSerializer.deserialize(in,
MessagingService.globalPartitioner(), version);
ranges.add(range);
}
return new RepairJobDesc(parentSessionId, sessionId, keyspace, columnFamily, ranges);
}
示例3: serializedSize
public long serializedSize(RepairJobDesc desc, int version)
{
int size = 0;
if (version >= MessagingService.VERSION_21)
{
size += TypeSizes.sizeof(desc.parentSessionId != null);
if (desc.parentSessionId != null)
size += UUIDSerializer.serializer.serializedSize(desc.parentSessionId, version);
}
size += UUIDSerializer.serializer.serializedSize(desc.sessionId, version);
size += TypeSizes.sizeof(desc.keyspace);
size += TypeSizes.sizeof(desc.columnFamily);
size += TypeSizes.sizeof(desc.ranges.size());
for (Range<Token> rt : desc.ranges)
{
size += AbstractBounds.tokenSerializer.serializedSize(rt, version);
}
return size;
}
示例4: getMessagingVersion
public int getMessagingVersion()
{
switch (version)
{
case VERSION_12:
return MessagingService.VERSION_12;
case VERSION_20:
return MessagingService.VERSION_20;
case VERSION_21:
return MessagingService.VERSION_21;
case VERSION_22:
return MessagingService.VERSION_22;
case VERSION_30:
return MessagingService.VERSION_30;
default:
throw new IllegalStateException("Unknown commitlog version " + version);
}
}
示例5: loadPaxosState
public static PaxosState loadPaxosState(DecoratedKey key, CFMetaData metadata, int nowInSec)
{
String req = "SELECT * FROM system.%s WHERE row_key = ? AND cf_id = ?";
UntypedResultSet results = QueryProcessor.executeInternalWithNow(nowInSec, String.format(req, PAXOS), key.getKey(), metadata.cfId);
if (results.isEmpty())
return new PaxosState(key, metadata);
UntypedResultSet.Row row = results.one();
Commit promised = row.has("in_progress_ballot")
? new Commit(row.getUUID("in_progress_ballot"), new PartitionUpdate(metadata, key, metadata.partitionColumns(), 1))
: Commit.emptyCommit(key, metadata);
// either we have both a recently accepted ballot and update or we have neither
int proposalVersion = row.has("proposal_version") ? row.getInt("proposal_version") : MessagingService.VERSION_21;
Commit accepted = row.has("proposal")
? new Commit(row.getUUID("proposal_ballot"), PartitionUpdate.fromBytes(row.getBytes("proposal"), proposalVersion, key))
: Commit.emptyCommit(key, metadata);
// either most_recent_commit and most_recent_commit_at will both be set, or neither
int mostRecentVersion = row.has("most_recent_commit_version") ? row.getInt("most_recent_commit_version") : MessagingService.VERSION_21;
Commit mostRecent = row.has("most_recent_commit")
? new Commit(row.getUUID("most_recent_commit_at"), PartitionUpdate.fromBytes(row.getBytes("most_recent_commit"), mostRecentVersion, key))
: Commit.emptyCommit(key, metadata);
return new PaxosState(promised, accepted, mostRecent);
}
示例6: createLegacyHint
private static Mutation createLegacyHint(Mutation mutation, long now, UUID targetId)
{
int version = MessagingService.VERSION_21;
int ttl = mutation.smallestGCGS();
UUID hintId = UUIDGen.getTimeUUID();
ByteBuffer key = UUIDType.instance.decompose(targetId);
Clustering clustering = SystemKeyspace.LegacyHints.comparator.make(hintId, version);
ByteBuffer value = ByteBuffer.wrap(FBUtilities.serialize(mutation, Mutation.serializer, version));
Cell cell = BufferCell.expiring(SystemKeyspace.LegacyHints.compactValueColumn(),
now,
ttl,
FBUtilities.nowInSeconds(),
value);
return new Mutation(PartitionUpdate.singleRowUpdate(SystemKeyspace.LegacyHints,
key,
BTreeRow.singleCellRow(clustering, cell)));
}
示例7: BigVersion
BigVersion(String version)
{
super(instance, version);
isLatestVersion = version.compareTo(current_version) == 0;
hasSamplingLevel = version.compareTo("ka") >= 0;
newStatsFile = version.compareTo("ka") >= 0;
//For a while Adler32 was in use, now the CRC32 instrinsic is very good especially after Haswell
//PureJavaCRC32 was always faster than Adler32. See CASSANDRA-8684
ChecksumType checksumType = ChecksumType.CRC32;
if (version.compareTo("ka") >= 0 && version.compareTo("ma") < 0)
checksumType = ChecksumType.Adler32;
this.uncompressedChecksumType = checksumType;
checksumType = ChecksumType.CRC32;
if (version.compareTo("jb") >= 0 && version.compareTo("ma") < 0)
checksumType = ChecksumType.Adler32;
this.compressedChecksumType = checksumType;
hasRepairedAt = version.compareTo("ka") >= 0;
tracksLegacyCounterShards = version.compareTo("ka") >= 0;
newFileName = version.compareTo("la") >= 0;
hasOldBfHashOrder = version.compareTo("ma") < 0;
hasCompactionAncestors = version.compareTo("ma") < 0;
storeRows = version.compareTo("ma") >= 0;
correspondingMessagingVersion = storeRows
? MessagingService.VERSION_30
: MessagingService.VERSION_21;
hasBoundaries = version.compareTo("ma") < 0;
hasCommitLogLowerBound = (version.compareTo("lb") >= 0 && version.compareTo("ma") < 0)
|| version.compareTo("mb") >= 0;
hasCommitLogIntervals = version.compareTo("mc") >= 0;
}
示例8: serialize
public void serialize(RepairJobDesc desc, DataOutputPlus out, int version) throws IOException
{
if (version >= MessagingService.VERSION_21)
{
out.writeBoolean(desc.parentSessionId != null);
if (desc.parentSessionId != null)
UUIDSerializer.serializer.serialize(desc.parentSessionId, out, version);
}
UUIDSerializer.serializer.serialize(desc.sessionId, out, version);
out.writeUTF(desc.keyspace);
out.writeUTF(desc.columnFamily);
AbstractBounds.serializer.serialize(desc.range, out, version);
}
示例9: deserialize
public RepairJobDesc deserialize(DataInput in, int version) throws IOException
{
UUID parentSessionId = null;
if (version >= MessagingService.VERSION_21)
{
if (in.readBoolean())
parentSessionId = UUIDSerializer.serializer.deserialize(in, version);
}
UUID sessionId = UUIDSerializer.serializer.deserialize(in, version);
String keyspace = in.readUTF();
String columnFamily = in.readUTF();
Range<Token> range = (Range<Token>)AbstractBounds.serializer.deserialize(in, version);
return new RepairJobDesc(parentSessionId, sessionId, keyspace, columnFamily, range);
}
示例10: serializedSize
public long serializedSize(RepairJobDesc desc, int version)
{
int size = 0;
if (version >= MessagingService.VERSION_21)
{
size += TypeSizes.NATIVE.sizeof(desc.parentSessionId != null);
if (desc.parentSessionId != null)
size += UUIDSerializer.serializer.serializedSize(desc.parentSessionId, version);
}
size += UUIDSerializer.serializer.serializedSize(desc.sessionId, version);
size += TypeSizes.NATIVE.sizeof(desc.keyspace);
size += TypeSizes.NATIVE.sizeof(desc.columnFamily);
size += AbstractBounds.serializer.serializedSize(desc.range, version);
return size;
}
示例11: getMessagingVersion
public int getMessagingVersion()
{
switch (version)
{
case VERSION_12:
return MessagingService.VERSION_12;
case VERSION_20:
return MessagingService.VERSION_20;
case VERSION_21:
return MessagingService.VERSION_21;
default:
throw new IllegalStateException("Unknown commitlog version " + version);
}
}
示例12: serialize
public void serialize(PagedRangeCommand cmd, DataOutputPlus out, int version) throws IOException
{
out.writeUTF(cmd.keyspace);
out.writeUTF(cmd.columnFamily);
out.writeLong(cmd.timestamp);
AbstractBounds.serializer.serialize(cmd.keyRange, out, version);
CFMetaData metadata = Schema.instance.getCFMetaData(cmd.keyspace, cmd.columnFamily);
// SliceQueryFilter (the count is not used)
SliceQueryFilter filter = (SliceQueryFilter)cmd.predicate;
metadata.comparator.sliceQueryFilterSerializer().serialize(filter, out, version);
// The start and stop of the page
metadata.comparator.serializer().serialize(cmd.start, out);
metadata.comparator.serializer().serialize(cmd.stop, out);
out.writeInt(cmd.rowFilter.size());
for (IndexExpression expr : cmd.rowFilter)
{
expr.writeTo(out);;
}
out.writeInt(cmd.limit);
if (version >= MessagingService.VERSION_21)
out.writeBoolean(cmd.countCQL3Rows);
}
示例13: deserialize
public PagedRangeCommand deserialize(DataInput in, int version) throws IOException
{
String keyspace = in.readUTF();
String columnFamily = in.readUTF();
long timestamp = in.readLong();
AbstractBounds<RowPosition> keyRange = AbstractBounds.serializer.deserialize(in, version).toRowBounds();
CFMetaData metadata = Schema.instance.getCFMetaData(keyspace, columnFamily);
SliceQueryFilter predicate = metadata.comparator.sliceQueryFilterSerializer().deserialize(in, version);
Composite start = metadata.comparator.serializer().deserialize(in);
Composite stop = metadata.comparator.serializer().deserialize(in);
int filterCount = in.readInt();
List<IndexExpression> rowFilter = new ArrayList<IndexExpression>(filterCount);
for (int i = 0; i < filterCount; i++)
{
rowFilter.add(IndexExpression.readFrom(in));
}
int limit = in.readInt();
boolean countCQL3Rows = version >= MessagingService.VERSION_21
? in.readBoolean()
: predicate.compositesToGroup >= 0 || predicate.count != 1; // See #6857
return new PagedRangeCommand(keyspace, columnFamily, timestamp, keyRange, predicate, start, stop, rowFilter, limit, countCQL3Rows);
}
示例14: serializedSize
public long serializedSize(PagedRangeCommand cmd, int version)
{
long size = 0;
size += TypeSizes.NATIVE.sizeof(cmd.keyspace);
size += TypeSizes.NATIVE.sizeof(cmd.columnFamily);
size += TypeSizes.NATIVE.sizeof(cmd.timestamp);
size += AbstractBounds.serializer.serializedSize(cmd.keyRange, version);
CFMetaData metadata = Schema.instance.getCFMetaData(cmd.keyspace, cmd.columnFamily);
size += metadata.comparator.sliceQueryFilterSerializer().serializedSize((SliceQueryFilter)cmd.predicate, version);
size += metadata.comparator.serializer().serializedSize(cmd.start, TypeSizes.NATIVE);
size += metadata.comparator.serializer().serializedSize(cmd.stop, TypeSizes.NATIVE);
size += TypeSizes.NATIVE.sizeof(cmd.rowFilter.size());
for (IndexExpression expr : cmd.rowFilter)
{
size += TypeSizes.NATIVE.sizeofWithShortLength(expr.column);
size += TypeSizes.NATIVE.sizeof(expr.operator.ordinal());
size += TypeSizes.NATIVE.sizeofWithShortLength(expr.value);
}
size += TypeSizes.NATIVE.sizeof(cmd.limit);
if (version >= MessagingService.VERSION_21)
size += TypeSizes.NATIVE.sizeof(cmd.countCQL3Rows);
return size;
}
示例15: defineSchema
@BeforeClass
public static void defineSchema() throws Exception
{
partitionerSwitcher = Util.switchPartitioner(RandomPartitioner.instance);
RANDOM_UUID = UUID.fromString("b5c3d033-75aa-4c2f-a819-947aac7a0c54");
FULL_RANGE = new Range<>(Util.testPartitioner().getMinimumToken(), Util.testPartitioner().getMinimumToken());
DESC = new RepairJobDesc(getVersion() < MessagingService.VERSION_21 ? null : RANDOM_UUID, RANDOM_UUID, "Keyspace1", "Standard1", Arrays.asList(FULL_RANGE));
}