mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 09:58:50 +08:00
Convert existing tuple usages to use Tuple::makeTuple()
This commit is contained in:
parent
1b81e72604
commit
190ad8c7e9
@ -941,13 +941,13 @@ static Value dataOfRecord(const int i) {
|
|||||||
return Value(format("data-of-record-%08d", i));
|
return Value(format("data-of-record-%08d", i));
|
||||||
}
|
}
|
||||||
static std::string indexEntryKey(const int i) {
|
static std::string indexEntryKey(const int i) {
|
||||||
return Tuple().append(StringRef(prefix)).append(INDEX).append(indexKey(i)).append(primaryKey(i)).pack().toString();
|
return Tuple::makeTuple(prefix, INDEX, indexKey(i), primaryKey(i)).pack().toString();
|
||||||
}
|
}
|
||||||
static std::string recordKey(const int i, const int split) {
|
static std::string recordKey(const int i, const int split) {
|
||||||
return Tuple().append(prefix).append(RECORD).append(primaryKey(i)).append(split).pack().toString();
|
return Tuple::makeTuple(prefix, RECORD, primaryKey(i), split).pack().toString();
|
||||||
}
|
}
|
||||||
static std::string recordValue(const int i, const int split) {
|
static std::string recordValue(const int i, const int split) {
|
||||||
return Tuple().append(dataOfRecord(i)).append(split).pack().toString();
|
return Tuple::makeTuple(dataOfRecord(i), split).pack().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
const static int SPLIT_SIZE = 3;
|
const static int SPLIT_SIZE = 3;
|
||||||
@ -993,13 +993,8 @@ GetMappedRangeResult getMappedIndexEntries(int beginId,
|
|||||||
fdb::Transaction& tr,
|
fdb::Transaction& tr,
|
||||||
int matchIndex,
|
int matchIndex,
|
||||||
bool allMissing) {
|
bool allMissing) {
|
||||||
std::string mapper = Tuple()
|
std::string mapper =
|
||||||
.append(prefix)
|
Tuple::makeTuple(prefix, RECORD, (allMissing ? "{K[2]}"_sr : "{K[3]}"_sr), "{...}"_sr).pack().toString();
|
||||||
.append(RECORD)
|
|
||||||
.append(allMissing ? "{K[2]}"_sr : "{K[3]}"_sr)
|
|
||||||
.append("{...}"_sr)
|
|
||||||
.pack()
|
|
||||||
.toString();
|
|
||||||
return getMappedIndexEntries(beginId, endId, tr, mapper, matchIndex);
|
return getMappedIndexEntries(beginId, endId, tr, mapper, matchIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1037,7 +1032,7 @@ TEST_CASE("tuple_support_versionstamp") {
|
|||||||
// a random 12 bytes long StringRef as a versionstamp
|
// a random 12 bytes long StringRef as a versionstamp
|
||||||
StringRef str = "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12"_sr;
|
StringRef str = "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12"_sr;
|
||||||
Versionstamp vs(str);
|
Versionstamp vs(str);
|
||||||
const Tuple t = Tuple().append(prefix).append(RECORD).append(vs).append("{K[3]}"_sr).append("{...}"_sr);
|
const Tuple t = Tuple::makeTuple(prefix, RECORD, vs, "{K[3]}"_sr, "{...}"_sr);
|
||||||
ASSERT(t.getVersionstamp(2) == vs);
|
ASSERT(t.getVersionstamp(2) == vs);
|
||||||
|
|
||||||
// verify the round-way pack-unpack path for a Tuple containing a versionstamp
|
// verify the round-way pack-unpack path for a Tuple containing a versionstamp
|
||||||
@ -1181,7 +1176,7 @@ TEST_CASE("fdb_transaction_get_mapped_range_missing_all_secondary") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("fdb_transaction_get_mapped_range_restricted_to_serializable") {
|
TEST_CASE("fdb_transaction_get_mapped_range_restricted_to_serializable") {
|
||||||
std::string mapper = Tuple().append(prefix).append(RECORD).append("{K[3]}"_sr).pack().toString();
|
std::string mapper = Tuple::makeTuple(prefix, RECORD, "{K[3]}"_sr).pack().toString();
|
||||||
fdb::Transaction tr(db);
|
fdb::Transaction tr(db);
|
||||||
auto result = get_mapped_range(
|
auto result = get_mapped_range(
|
||||||
tr,
|
tr,
|
||||||
@ -1200,7 +1195,7 @@ TEST_CASE("fdb_transaction_get_mapped_range_restricted_to_serializable") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("fdb_transaction_get_mapped_range_restricted_to_ryw_enable") {
|
TEST_CASE("fdb_transaction_get_mapped_range_restricted_to_ryw_enable") {
|
||||||
std::string mapper = Tuple().append(prefix).append(RECORD).append("{K[3]}"_sr).pack().toString();
|
std::string mapper = Tuple::makeTuple(prefix, RECORD, "{K[3]}"_sr).pack().toString();
|
||||||
fdb::Transaction tr(db);
|
fdb::Transaction tr(db);
|
||||||
fdb_check(tr.set_option(FDB_TR_OPTION_READ_YOUR_WRITES_DISABLE, nullptr, 0)); // Not disable RYW
|
fdb_check(tr.set_option(FDB_TR_OPTION_READ_YOUR_WRITES_DISABLE, nullptr, 0)); // Not disable RYW
|
||||||
auto result = get_mapped_range(
|
auto result = get_mapped_range(
|
||||||
|
@ -85,7 +85,7 @@ Values must always be encoded according to the :ref:`api-python-tuple-layer`.
|
|||||||
const KeyRef myGlobalConfigKey = LiteralStringRef("config/key");
|
const KeyRef myGlobalConfigKey = LiteralStringRef("config/key");
|
||||||
|
|
||||||
// When you want to set the value..
|
// When you want to set the value..
|
||||||
Tuple value = Tuple().append((double)1.5);
|
Tuple value = Tuple::makeTuple((double)1.5);
|
||||||
|
|
||||||
FDBTransaction* tr = ...;
|
FDBTransaction* tr = ...;
|
||||||
tr->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES);
|
tr->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES);
|
||||||
|
@ -97,8 +97,8 @@ ACTOR Future<bool> profileCommandActor(Database db,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Tuple rate = Tuple().append(sampleRate);
|
Tuple rate = Tuple::makeTuple(sampleRate);
|
||||||
Tuple size = Tuple().append(sizeLimit);
|
Tuple size = Tuple::makeTuple(sizeLimit);
|
||||||
tr->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES);
|
tr->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES);
|
||||||
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSampleRate), rate.pack());
|
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSampleRate), rate.pack());
|
||||||
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSizeLimit), size.pack());
|
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSizeLimit), size.pack());
|
||||||
|
@ -144,10 +144,7 @@ std::string configDBTypeToString(ConfigDBType configDBType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("/fdbclient/ConfigDB/ConfigKey/EncodeDecode") {
|
TEST_CASE("/fdbclient/ConfigDB/ConfigKey/EncodeDecode") {
|
||||||
Tuple tuple;
|
auto packed = Tuple::makeTuple("class-A"_sr, "test_long"_sr).pack();
|
||||||
tuple << "class-A"_sr
|
|
||||||
<< "test_long"_sr;
|
|
||||||
auto packed = tuple.pack();
|
|
||||||
auto unpacked = ConfigKeyRef::decodeKey(packed);
|
auto unpacked = ConfigKeyRef::decodeKey(packed);
|
||||||
ASSERT(unpacked.configClass.get() == "class-A"_sr);
|
ASSERT(unpacked.configClass.get() == "class-A"_sr);
|
||||||
ASSERT(unpacked.knobName == "test_long"_sr);
|
ASSERT(unpacked.knobName == "test_long"_sr);
|
||||||
@ -169,18 +166,8 @@ void decodeFailureTest(KeyRef key) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST_CASE("/fdbclient/ConfigDB/ConfigKey/DecodeFailure") {
|
TEST_CASE("/fdbclient/ConfigDB/ConfigKey/DecodeFailure") {
|
||||||
{
|
decodeFailureTest(Tuple::makeTuple("s1"_sr, "s2"_sr, "s3"_sr).pack());
|
||||||
Tuple tuple;
|
decodeFailureTest(Tuple::makeTuple("s1"_sr, 5).pack());
|
||||||
tuple << "s1"_sr
|
|
||||||
<< "s2"_sr
|
|
||||||
<< "s3"_sr;
|
|
||||||
decodeFailureTest(tuple.pack());
|
|
||||||
}
|
|
||||||
{
|
|
||||||
Tuple tuple;
|
|
||||||
tuple << "s1"_sr << 5;
|
|
||||||
decodeFailureTest(tuple.pack());
|
|
||||||
}
|
|
||||||
decodeFailureTest("non-tuple-key"_sr);
|
decodeFailureTest("non-tuple-key"_sr);
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
@ -200,13 +200,7 @@ public:
|
|||||||
Version endVersion{ ::invalidVersion }; // not meaningful for range files
|
Version endVersion{ ::invalidVersion }; // not meaningful for range files
|
||||||
|
|
||||||
Tuple pack() const {
|
Tuple pack() const {
|
||||||
return Tuple()
|
return Tuple::makeTuple(version, fileName, (int)isRange, fileSize, blockSize, endVersion);
|
||||||
.append(version)
|
|
||||||
.append(StringRef(fileName))
|
|
||||||
.append((int)isRange)
|
|
||||||
.append(fileSize)
|
|
||||||
.append(blockSize)
|
|
||||||
.append(endVersion);
|
|
||||||
}
|
}
|
||||||
static RestoreFile unpack(Tuple const& t) {
|
static RestoreFile unpack(Tuple const& t) {
|
||||||
RestoreFile r;
|
RestoreFile r;
|
||||||
|
@ -183,13 +183,13 @@ ACTOR Future<Void> GlobalConfig::migrate(GlobalConfig* self) {
|
|||||||
if (sampleRate.present()) {
|
if (sampleRate.present()) {
|
||||||
const double sampleRateDbl =
|
const double sampleRateDbl =
|
||||||
BinaryReader::fromStringRef<double>(sampleRate.get().contents(), Unversioned());
|
BinaryReader::fromStringRef<double>(sampleRate.get().contents(), Unversioned());
|
||||||
Tuple rate = Tuple().append(sampleRateDbl);
|
Tuple rate = Tuple::makeTuple(sampleRateDbl);
|
||||||
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSampleRate), rate.pack());
|
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSampleRate), rate.pack());
|
||||||
}
|
}
|
||||||
if (sizeLimit.present()) {
|
if (sizeLimit.present()) {
|
||||||
const int64_t sizeLimitInt =
|
const int64_t sizeLimitInt =
|
||||||
BinaryReader::fromStringRef<int64_t>(sizeLimit.get().contents(), Unversioned());
|
BinaryReader::fromStringRef<int64_t>(sizeLimit.get().contents(), Unversioned());
|
||||||
Tuple size = Tuple().append(sizeLimitInt);
|
Tuple size = Tuple::makeTuple(sizeLimitInt);
|
||||||
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSizeLimit), size.pack());
|
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSizeLimit), size.pack());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1132,10 +1132,9 @@ ACTOR static Future<Void> handleTssMismatches(DatabaseContext* cx) {
|
|||||||
|
|
||||||
for (const DetailedTSSMismatch& d : data.second) {
|
for (const DetailedTSSMismatch& d : data.second) {
|
||||||
// <tssid, time, mismatchid> -> mismatch data
|
// <tssid, time, mismatchid> -> mismatch data
|
||||||
tssMismatchDB.set(
|
tssMismatchDB.set(tr,
|
||||||
tr,
|
Tuple::makeTuple(data.first.toString(), d.timestamp, d.mismatchId.toString()),
|
||||||
Tuple().append(data.first.toString()).append(d.timestamp).append(d.mismatchId.toString()),
|
d.traceString);
|
||||||
d.traceString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wait(tr->commit());
|
wait(tr->commit());
|
||||||
|
@ -2005,7 +2005,7 @@ Future<Optional<std::string>> ClientProfilingImpl::commit(ReadYourWritesTransact
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
double sampleRate = boost::lexical_cast<double>(sampleRateStr);
|
double sampleRate = boost::lexical_cast<double>(sampleRateStr);
|
||||||
Tuple rate = Tuple().append(sampleRate);
|
Tuple rate = Tuple::makeTuple(sampleRate);
|
||||||
insertions.push_back_deep(insertions.arena(), KeyValueRef(fdbClientInfoTxnSampleRate, rate.pack()));
|
insertions.push_back_deep(insertions.arena(), KeyValueRef(fdbClientInfoTxnSampleRate, rate.pack()));
|
||||||
} catch (boost::bad_lexical_cast& e) {
|
} catch (boost::bad_lexical_cast& e) {
|
||||||
return Optional<std::string>(ManagementAPIError::toJsonString(
|
return Optional<std::string>(ManagementAPIError::toJsonString(
|
||||||
@ -2024,7 +2024,7 @@ Future<Optional<std::string>> ClientProfilingImpl::commit(ReadYourWritesTransact
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
int64_t sizeLimit = boost::lexical_cast<int64_t>(sizeLimitStr);
|
int64_t sizeLimit = boost::lexical_cast<int64_t>(sizeLimitStr);
|
||||||
Tuple size = Tuple().append(sizeLimit);
|
Tuple size = Tuple::makeTuple(sizeLimit);
|
||||||
insertions.push_back_deep(insertions.arena(), KeyValueRef(fdbClientInfoTxnSizeLimit, size.pack()));
|
insertions.push_back_deep(insertions.arena(), KeyValueRef(fdbClientInfoTxnSizeLimit, size.pack()));
|
||||||
} catch (boost::bad_lexical_cast& e) {
|
} catch (boost::bad_lexical_cast& e) {
|
||||||
return Optional<std::string>(ManagementAPIError::toJsonString(
|
return Optional<std::string>(ManagementAPIError::toJsonString(
|
||||||
|
@ -141,12 +141,7 @@ bool ThrottleApi::TagQuotaValue::isValid() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Value ThrottleApi::TagQuotaValue::toValue() const {
|
Value ThrottleApi::TagQuotaValue::toValue() const {
|
||||||
Tuple tuple;
|
return Tuple::makeTuple(reservedReadQuota, totalReadQuota, reservedWriteQuota, totalWriteQuota).pack();
|
||||||
tuple.append(reservedReadQuota);
|
|
||||||
tuple.append(totalReadQuota);
|
|
||||||
tuple.append(reservedWriteQuota);
|
|
||||||
tuple.append(totalWriteQuota);
|
|
||||||
return tuple.pack();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ThrottleApi::TagQuotaValue ThrottleApi::TagQuotaValue::fromValue(ValueRef value) {
|
ThrottleApi::TagQuotaValue ThrottleApi::TagQuotaValue::fromValue(ValueRef value) {
|
||||||
|
@ -651,10 +651,7 @@ public:
|
|||||||
Reference<Task> task) {
|
Reference<Task> task) {
|
||||||
taskBucket->setOptions(tr);
|
taskBucket->setOptions(tr);
|
||||||
|
|
||||||
Tuple t;
|
Tuple t = Tuple::makeTuple(task->timeoutVersion, task->key);
|
||||||
t.append(task->timeoutVersion);
|
|
||||||
t.append(task->key);
|
|
||||||
|
|
||||||
RangeResult values = wait(tr->getRange(taskBucket->timeouts.range(t), 1));
|
RangeResult values = wait(tr->getRange(taskBucket->timeouts.range(t), 1));
|
||||||
if (values.size() > 0)
|
if (values.size() > 0)
|
||||||
return false;
|
return false;
|
||||||
@ -996,9 +993,7 @@ Future<bool> TaskBucket::isEmpty(Reference<ReadYourWritesTransaction> tr) {
|
|||||||
Future<Void> TaskBucket::finish(Reference<ReadYourWritesTransaction> tr, Reference<Task> task) {
|
Future<Void> TaskBucket::finish(Reference<ReadYourWritesTransaction> tr, Reference<Task> task) {
|
||||||
setOptions(tr);
|
setOptions(tr);
|
||||||
|
|
||||||
Tuple t;
|
Tuple t = Tuple::makeTuple(task->timeoutVersion, task->key);
|
||||||
t.append(task->timeoutVersion);
|
|
||||||
t.append(task->key);
|
|
||||||
|
|
||||||
tr->atomicOp(prefix.pack(LiteralStringRef("task_count")),
|
tr->atomicOp(prefix.pack(LiteralStringRef("task_count")),
|
||||||
LiteralStringRef("\xff\xff\xff\xff\xff\xff\xff\xff"),
|
LiteralStringRef("\xff\xff\xff\xff\xff\xff\xff\xff"),
|
||||||
|
@ -361,7 +361,7 @@ public:
|
|||||||
template <>
|
template <>
|
||||||
inline Standalone<StringRef> TupleCodec<FileBackupAgent::ERestoreState>::pack(
|
inline Standalone<StringRef> TupleCodec<FileBackupAgent::ERestoreState>::pack(
|
||||||
FileBackupAgent::ERestoreState const& val) {
|
FileBackupAgent::ERestoreState const& val) {
|
||||||
return Tuple().append(static_cast<int>(val)).pack();
|
return Tuple::makeTuple(static_cast<int>(val)).pack();
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
inline FileBackupAgent::ERestoreState TupleCodec<FileBackupAgent::ERestoreState>::unpack(
|
inline FileBackupAgent::ERestoreState TupleCodec<FileBackupAgent::ERestoreState>::unpack(
|
||||||
@ -578,7 +578,7 @@ ACTOR Future<Void> cleanupBackup(Database cx, DeleteData deleteData);
|
|||||||
using EBackupState = BackupAgentBase::EnumState;
|
using EBackupState = BackupAgentBase::EnumState;
|
||||||
template <>
|
template <>
|
||||||
inline Standalone<StringRef> TupleCodec<EBackupState>::pack(EBackupState const& val) {
|
inline Standalone<StringRef> TupleCodec<EBackupState>::pack(EBackupState const& val) {
|
||||||
return Tuple().append(static_cast<int>(val)).pack();
|
return Tuple::makeTuple(static_cast<int>(val)).pack();
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
inline EBackupState TupleCodec<EBackupState>::unpack(Standalone<StringRef> const& val) {
|
inline EBackupState TupleCodec<EBackupState>::unpack(Standalone<StringRef> const& val) {
|
||||||
@ -727,8 +727,7 @@ protected:
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline Standalone<StringRef> TupleCodec<Reference<IBackupContainer>>::pack(Reference<IBackupContainer> const& bc) {
|
inline Standalone<StringRef> TupleCodec<Reference<IBackupContainer>>::pack(Reference<IBackupContainer> const& bc) {
|
||||||
Tuple tuple;
|
Tuple tuple = Tuple::makeTuple(bc->getURL());
|
||||||
tuple.append(StringRef(bc->getURL()));
|
|
||||||
|
|
||||||
if (bc->getEncryptionKeyFileName().present()) {
|
if (bc->getEncryptionKeyFileName().present()) {
|
||||||
tuple.append(bc->getEncryptionKeyFileName().get());
|
tuple.append(bc->getEncryptionKeyFileName().get());
|
||||||
@ -775,9 +774,7 @@ public:
|
|||||||
Version version;
|
Version version;
|
||||||
std::string fileName;
|
std::string fileName;
|
||||||
int64_t fileSize;
|
int64_t fileSize;
|
||||||
Tuple pack() const {
|
Tuple pack() const { return Tuple::makeTuple(begin, version, fileName, fileSize); }
|
||||||
return Tuple().append(begin).append(version).append(StringRef(fileName)).append(fileSize);
|
|
||||||
}
|
|
||||||
static RangeSlice unpack(Tuple const& t) {
|
static RangeSlice unpack(Tuple const& t) {
|
||||||
RangeSlice r;
|
RangeSlice r;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -134,7 +134,7 @@ private:
|
|||||||
|
|
||||||
if (!candidateValueFuture.get().present()) {
|
if (!candidateValueFuture.get().present()) {
|
||||||
tr->addWriteConflictRange(singleKeyRange(self->recent.get(candidate).key()));
|
tr->addWriteConflictRange(singleKeyRange(self->recent.get(candidate).key()));
|
||||||
return Tuple().append(candidate).pack();
|
return Tuple::makeTuple(candidate).pack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ inline Tuple TupleCodec<Tuple>::unpack(Standalone<StringRef> const& val) {
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline Standalone<StringRef> TupleCodec<int64_t>::pack(int64_t const& val) {
|
inline Standalone<StringRef> TupleCodec<int64_t>::pack(int64_t const& val) {
|
||||||
return Tuple().append(val).pack();
|
return Tuple::makeTuple(val).pack();
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
inline int64_t TupleCodec<int64_t>::unpack(Standalone<StringRef> const& val) {
|
inline int64_t TupleCodec<int64_t>::unpack(Standalone<StringRef> const& val) {
|
||||||
@ -68,7 +68,7 @@ inline int64_t TupleCodec<int64_t>::unpack(Standalone<StringRef> const& val) {
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline Standalone<StringRef> TupleCodec<bool>::pack(bool const& val) {
|
inline Standalone<StringRef> TupleCodec<bool>::pack(bool const& val) {
|
||||||
return Tuple().append(val ? 1 : 0).pack();
|
return Tuple::makeTuple(val ? 1 : 0).pack();
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
inline bool TupleCodec<bool>::unpack(Standalone<StringRef> const& val) {
|
inline bool TupleCodec<bool>::unpack(Standalone<StringRef> const& val) {
|
||||||
@ -77,7 +77,7 @@ inline bool TupleCodec<bool>::unpack(Standalone<StringRef> const& val) {
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline Standalone<StringRef> TupleCodec<Standalone<StringRef>>::pack(Standalone<StringRef> const& val) {
|
inline Standalone<StringRef> TupleCodec<Standalone<StringRef>>::pack(Standalone<StringRef> const& val) {
|
||||||
return Tuple().append(val).pack();
|
return Tuple::makeTuple(val).pack();
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
inline Standalone<StringRef> TupleCodec<Standalone<StringRef>>::unpack(Standalone<StringRef> const& val) {
|
inline Standalone<StringRef> TupleCodec<Standalone<StringRef>>::unpack(Standalone<StringRef> const& val) {
|
||||||
@ -96,7 +96,7 @@ inline UID TupleCodec<UID>::unpack(Standalone<StringRef> const& val) {
|
|||||||
// This is backward compatible with TupleCodec<Standalone<StringRef>>
|
// This is backward compatible with TupleCodec<Standalone<StringRef>>
|
||||||
template <>
|
template <>
|
||||||
inline Standalone<StringRef> TupleCodec<std::string>::pack(std::string const& val) {
|
inline Standalone<StringRef> TupleCodec<std::string>::pack(std::string const& val) {
|
||||||
return Tuple().append(StringRef(val)).pack();
|
return Tuple::makeTuple(val).pack();
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
inline std::string TupleCodec<std::string>::unpack(Standalone<StringRef> const& val) {
|
inline std::string TupleCodec<std::string>::unpack(Standalone<StringRef> const& val) {
|
||||||
@ -143,7 +143,7 @@ struct TupleCodec<std::vector<T>> {
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline Standalone<StringRef> TupleCodec<KeyRange>::pack(KeyRange const& val) {
|
inline Standalone<StringRef> TupleCodec<KeyRange>::pack(KeyRange const& val) {
|
||||||
return Tuple().append(val.begin).append(val.end).pack();
|
return Tuple::makeTuple(val.begin, val.end).pack();
|
||||||
}
|
}
|
||||||
template <>
|
template <>
|
||||||
inline KeyRange TupleCodec<KeyRange>::unpack(Standalone<StringRef> const& val) {
|
inline KeyRange TupleCodec<KeyRange>::unpack(Standalone<StringRef> const& val) {
|
||||||
|
@ -42,9 +42,7 @@ public:
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
Key pack(T const& item) const {
|
Key pack(T const& item) const {
|
||||||
Tuple t;
|
return pack(Tuple::makeTuple(item));
|
||||||
t.append(item);
|
|
||||||
return pack(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Key pack(StringRef const& item, bool utf8 = false) const {
|
Key pack(StringRef const& item, bool utf8 = false) const {
|
||||||
@ -58,9 +56,7 @@ public:
|
|||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
Subspace get(T const& item) const {
|
Subspace get(T const& item) const {
|
||||||
Tuple t;
|
return get(Tuple::makeTuple(item));
|
||||||
t.append(item);
|
|
||||||
return get(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Subspace get(StringRef const& item, bool utf8 = false) const {
|
Subspace get(StringRef const& item, bool utf8 = false) const {
|
||||||
|
@ -40,13 +40,7 @@ struct MetricsRule {
|
|||||||
int minLevel;
|
int minLevel;
|
||||||
|
|
||||||
Tuple pack() const {
|
Tuple pack() const {
|
||||||
return Tuple()
|
return Tuple::makeTuple(namePattern, typePattern, addressPattern, idPattern, enabled ? 1 : 0, minLevel);
|
||||||
.append(namePattern)
|
|
||||||
.append(typePattern)
|
|
||||||
.append(addressPattern)
|
|
||||||
.append(idPattern)
|
|
||||||
.append(enabled ? 1 : 0)
|
|
||||||
.append(minLevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline MetricsRule unpack(Tuple const& t) {
|
static inline MetricsRule unpack(Tuple const& t) {
|
||||||
|
@ -112,13 +112,7 @@ public:
|
|||||||
|
|
||||||
Tuple pack() const {
|
Tuple pack() const {
|
||||||
// fprintf(stderr, "Filename:%s\n", fileName.c_str());
|
// fprintf(stderr, "Filename:%s\n", fileName.c_str());
|
||||||
return Tuple()
|
return Tuple::makeTuple(version, fileName, (int)isRange, fileSize, blockSize, endVersion);
|
||||||
.append(version)
|
|
||||||
.append(StringRef(fileName))
|
|
||||||
.append((int)isRange)
|
|
||||||
.append(fileSize)
|
|
||||||
.append(blockSize)
|
|
||||||
.append(endVersion);
|
|
||||||
}
|
}
|
||||||
static RestoreFile unpack(Tuple const& t) {
|
static RestoreFile unpack(Tuple const& t) {
|
||||||
RestoreFile r;
|
RestoreFile r;
|
||||||
@ -190,17 +184,16 @@ struct RestoreFileFR {
|
|||||||
int partitionId = -1; // Partition ID (Log Router Tag ID) for mutation files.
|
int partitionId = -1; // Partition ID (Log Router Tag ID) for mutation files.
|
||||||
|
|
||||||
Tuple pack() const {
|
Tuple pack() const {
|
||||||
return Tuple()
|
return Tuple::makeTuple(version,
|
||||||
.append(version)
|
fileName,
|
||||||
.append(StringRef(fileName))
|
(int)isRange,
|
||||||
.append((int)isRange)
|
fileSize,
|
||||||
.append(fileSize)
|
blockSize,
|
||||||
.append(blockSize)
|
endVersion,
|
||||||
.append(endVersion)
|
beginVersion,
|
||||||
.append(beginVersion)
|
cursor,
|
||||||
.append(cursor)
|
fileIndex,
|
||||||
.append(fileIndex)
|
partitionId);
|
||||||
.append(partitionId);
|
|
||||||
}
|
}
|
||||||
static RestoreFileFR unpack(Tuple const& t) {
|
static RestoreFileFR unpack(Tuple const& t) {
|
||||||
RestoreFileFR r;
|
RestoreFileFR r;
|
||||||
|
@ -3675,9 +3675,7 @@ void preprocessMappedKey(Tuple& mappedKeyFormatTuple, std::vector<Optional<Tuple
|
|||||||
bool escaped = unescapeLiterals(s, "{{", "{");
|
bool escaped = unescapeLiterals(s, "{{", "{");
|
||||||
escaped = unescapeLiterals(s, "}}", "}") || escaped;
|
escaped = unescapeLiterals(s, "}}", "}") || escaped;
|
||||||
if (escaped) {
|
if (escaped) {
|
||||||
Tuple escapedTuple;
|
vt.emplace_back(Tuple::makeTuple(s));
|
||||||
escapedTuple.append(s);
|
|
||||||
vt.emplace_back(escapedTuple);
|
|
||||||
} else if (singleKeyOrValue(s, sz)) {
|
} else if (singleKeyOrValue(s, sz)) {
|
||||||
// when it is SingleKeyOrValue, insert an empty Tuple to vector as placeholder
|
// when it is SingleKeyOrValue, insert an empty Tuple to vector as placeholder
|
||||||
vt.emplace_back(Tuple());
|
vt.emplace_back(Tuple());
|
||||||
@ -3749,16 +3747,12 @@ Key constructMappedKey(KeyValueRef* keyValue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("/fdbserver/storageserver/constructMappedKey") {
|
TEST_CASE("/fdbserver/storageserver/constructMappedKey") {
|
||||||
Key key = Tuple().append("key-0"_sr).append("key-1"_sr).append("key-2"_sr).getDataAsStandalone();
|
Key key = Tuple::makeTuple("key-0"_sr, "key-1"_sr, "key-2"_sr).getDataAsStandalone();
|
||||||
Value value = Tuple().append("value-0"_sr).append("value-1"_sr).append("value-2"_sr).getDataAsStandalone();
|
Value value = Tuple::makeTuple("value-0"_sr, "value-1"_sr, "value-2"_sr).getDataAsStandalone();
|
||||||
state KeyValueRef kvr(key, value);
|
state KeyValueRef kvr(key, value);
|
||||||
{
|
{
|
||||||
Tuple mappedKeyFormatTuple = Tuple()
|
Tuple mappedKeyFormatTuple =
|
||||||
.append("normal"_sr)
|
Tuple::makeTuple("normal"_sr, "{{escaped}}"_sr, "{K[2]}"_sr, "{V[0]}"_sr, "{...}"_sr);
|
||||||
.append("{{escaped}}"_sr)
|
|
||||||
.append("{K[2]}"_sr)
|
|
||||||
.append("{V[0]}"_sr)
|
|
||||||
.append("{...}"_sr);
|
|
||||||
|
|
||||||
Tuple mappedKeyTuple;
|
Tuple mappedKeyTuple;
|
||||||
std::vector<Optional<Tuple>> vt;
|
std::vector<Optional<Tuple>> vt;
|
||||||
@ -3767,19 +3761,15 @@ TEST_CASE("/fdbserver/storageserver/constructMappedKey") {
|
|||||||
|
|
||||||
Key mappedKey = constructMappedKey(&kvr, vt, mappedKeyTuple, mappedKeyFormatTuple);
|
Key mappedKey = constructMappedKey(&kvr, vt, mappedKeyTuple, mappedKeyFormatTuple);
|
||||||
|
|
||||||
Key expectedMappedKey = Tuple()
|
Key expectedMappedKey =
|
||||||
.append("normal"_sr)
|
Tuple::makeTuple("normal"_sr, "{escaped}"_sr, "key-2"_sr, "value-0"_sr).getDataAsStandalone();
|
||||||
.append("{escaped}"_sr)
|
|
||||||
.append("key-2"_sr)
|
|
||||||
.append("value-0"_sr)
|
|
||||||
.getDataAsStandalone();
|
|
||||||
// std::cout << printable(mappedKey) << " == " << printable(expectedMappedKey) << std::endl;
|
// std::cout << printable(mappedKey) << " == " << printable(expectedMappedKey) << std::endl;
|
||||||
ASSERT(mappedKey.compare(expectedMappedKey) == 0);
|
ASSERT(mappedKey.compare(expectedMappedKey) == 0);
|
||||||
ASSERT(isRangeQuery == true);
|
ASSERT(isRangeQuery == true);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
Tuple mappedKeyFormatTuple = Tuple().append("{{{{}}"_sr).append("}}"_sr);
|
Tuple mappedKeyFormatTuple = Tuple::makeTuple("{{{{}}"_sr, "}}"_sr);
|
||||||
|
|
||||||
Tuple mappedKeyTuple;
|
Tuple mappedKeyTuple;
|
||||||
std::vector<Optional<Tuple>> vt;
|
std::vector<Optional<Tuple>> vt;
|
||||||
@ -3787,13 +3777,13 @@ TEST_CASE("/fdbserver/storageserver/constructMappedKey") {
|
|||||||
preprocessMappedKey(mappedKeyFormatTuple, vt, isRangeQuery);
|
preprocessMappedKey(mappedKeyFormatTuple, vt, isRangeQuery);
|
||||||
Key mappedKey = constructMappedKey(&kvr, vt, mappedKeyTuple, mappedKeyFormatTuple);
|
Key mappedKey = constructMappedKey(&kvr, vt, mappedKeyTuple, mappedKeyFormatTuple);
|
||||||
|
|
||||||
Key expectedMappedKey = Tuple().append("{{}"_sr).append("}"_sr).getDataAsStandalone();
|
Key expectedMappedKey = Tuple::makeTuple("{{}"_sr, "}"_sr).getDataAsStandalone();
|
||||||
// std::cout << printable(mappedKey) << " == " << printable(expectedMappedKey) << std::endl;
|
// std::cout << printable(mappedKey) << " == " << printable(expectedMappedKey) << std::endl;
|
||||||
ASSERT(mappedKey.compare(expectedMappedKey) == 0);
|
ASSERT(mappedKey.compare(expectedMappedKey) == 0);
|
||||||
ASSERT(isRangeQuery == false);
|
ASSERT(isRangeQuery == false);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Tuple mappedKeyFormatTuple = Tuple().append("{{{{}}"_sr).append("}}"_sr);
|
Tuple mappedKeyFormatTuple = Tuple::makeTuple("{{{{}}"_sr, "}}"_sr);
|
||||||
|
|
||||||
Tuple mappedKeyTuple;
|
Tuple mappedKeyTuple;
|
||||||
std::vector<Optional<Tuple>> vt;
|
std::vector<Optional<Tuple>> vt;
|
||||||
@ -3801,13 +3791,13 @@ TEST_CASE("/fdbserver/storageserver/constructMappedKey") {
|
|||||||
preprocessMappedKey(mappedKeyFormatTuple, vt, isRangeQuery);
|
preprocessMappedKey(mappedKeyFormatTuple, vt, isRangeQuery);
|
||||||
Key mappedKey = constructMappedKey(&kvr, vt, mappedKeyTuple, mappedKeyFormatTuple);
|
Key mappedKey = constructMappedKey(&kvr, vt, mappedKeyTuple, mappedKeyFormatTuple);
|
||||||
|
|
||||||
Key expectedMappedKey = Tuple().append("{{}"_sr).append("}"_sr).getDataAsStandalone();
|
Key expectedMappedKey = Tuple::makeTuple("{{}"_sr, "}"_sr).getDataAsStandalone();
|
||||||
// std::cout << printable(mappedKey) << " == " << printable(expectedMappedKey) << std::endl;
|
// std::cout << printable(mappedKey) << " == " << printable(expectedMappedKey) << std::endl;
|
||||||
ASSERT(mappedKey.compare(expectedMappedKey) == 0);
|
ASSERT(mappedKey.compare(expectedMappedKey) == 0);
|
||||||
ASSERT(isRangeQuery == false);
|
ASSERT(isRangeQuery == false);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Tuple mappedKeyFormatTuple = Tuple().append("{K[100]}"_sr);
|
Tuple mappedKeyFormatTuple = Tuple::makeTuple("{K[100]}"_sr);
|
||||||
state bool throwException = false;
|
state bool throwException = false;
|
||||||
try {
|
try {
|
||||||
Tuple mappedKeyTuple;
|
Tuple mappedKeyTuple;
|
||||||
@ -3823,7 +3813,7 @@ TEST_CASE("/fdbserver/storageserver/constructMappedKey") {
|
|||||||
ASSERT(throwException);
|
ASSERT(throwException);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Tuple mappedKeyFormatTuple = Tuple().append("{...}"_sr).append("last-element"_sr);
|
Tuple mappedKeyFormatTuple = Tuple::makeTuple("{...}"_sr, "last-element"_sr);
|
||||||
state bool throwException2 = false;
|
state bool throwException2 = false;
|
||||||
try {
|
try {
|
||||||
Tuple mappedKeyTuple;
|
Tuple mappedKeyTuple;
|
||||||
@ -3839,7 +3829,7 @@ TEST_CASE("/fdbserver/storageserver/constructMappedKey") {
|
|||||||
ASSERT(throwException2);
|
ASSERT(throwException2);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
Tuple mappedKeyFormatTuple = Tuple().append("{K[not-a-number]}"_sr);
|
Tuple mappedKeyFormatTuple = Tuple::makeTuple("{K[not-a-number]}"_sr);
|
||||||
state bool throwException3 = false;
|
state bool throwException3 = false;
|
||||||
try {
|
try {
|
||||||
Tuple mappedKeyTuple;
|
Tuple mappedKeyTuple;
|
||||||
|
@ -294,8 +294,8 @@ struct ClientTransactionProfileCorrectnessWorkload : TestWorkload {
|
|||||||
wait(runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) -> Future<Void> {
|
wait(runRYWTransaction(cx, [=](Reference<ReadYourWritesTransaction> tr) -> Future<Void> {
|
||||||
tr->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES);
|
tr->setOption(FDBTransactionOptions::SPECIAL_KEY_SPACE_ENABLE_WRITES);
|
||||||
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
|
tr->setOption(FDBTransactionOptions::LOCK_AWARE);
|
||||||
Tuple rate = Tuple().append(sampleProbability);
|
Tuple rate = Tuple::makeTuple(sampleProbability);
|
||||||
Tuple size = Tuple().append(sizeLimit);
|
Tuple size = Tuple::makeTuple(sizeLimit);
|
||||||
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSampleRate), rate.pack());
|
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSampleRate), rate.pack());
|
||||||
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSizeLimit), size.pack());
|
tr->set(GlobalConfig::prefixedKey(fdbClientInfoTxnSizeLimit), size.pack());
|
||||||
return Void();
|
return Void();
|
||||||
|
@ -36,12 +36,7 @@ class ConfigIncrementWorkload : public TestWorkload {
|
|||||||
|
|
||||||
PerfIntCounter transactions, retries, commitUnknownResult;
|
PerfIntCounter transactions, retries, commitUnknownResult;
|
||||||
|
|
||||||
static Key getConfigKey() {
|
static Key getConfigKey() { return Tuple::makeTuple(/* config class */ nullptr, testKnobName).pack(); }
|
||||||
Tuple tuple;
|
|
||||||
tuple.appendNull(); // config class
|
|
||||||
tuple << testKnobName;
|
|
||||||
return tuple.pack();
|
|
||||||
}
|
|
||||||
|
|
||||||
ACTOR static Future<int> get(Reference<ISingleThreadTransaction> tr) {
|
ACTOR static Future<int> get(Reference<ISingleThreadTransaction> tr) {
|
||||||
TraceEvent(SevDebug, "ConfigIncrementGet");
|
TraceEvent(SevDebug, "ConfigIncrementGet");
|
||||||
|
@ -83,15 +83,11 @@ struct GetMappedRangeWorkload : ApiWorkload {
|
|||||||
static Value dataOfRecord(int i) { return Key(format("data-of-record-%08d", i)); }
|
static Value dataOfRecord(int i) { return Key(format("data-of-record-%08d", i)); }
|
||||||
static Value dataOfRecord(int i, int split) { return Key(format("data-of-record-%08d-split-%08d", i, split)); }
|
static Value dataOfRecord(int i, int split) { return Key(format("data-of-record-%08d-split-%08d", i, split)); }
|
||||||
|
|
||||||
static Key indexEntryKey(int i) {
|
static Key indexEntryKey(int i) { return Tuple::makeTuple(prefix, INDEX, indexKey(i), primaryKey(i)).pack(); }
|
||||||
return Tuple().append(prefix).append(INDEX).append(indexKey(i)).append(primaryKey(i)).pack();
|
static Key recordKey(int i) { return Tuple::makeTuple(prefix, RECORD, primaryKey(i)).pack(); }
|
||||||
}
|
static Key recordKey(int i, int split) { return Tuple::makeTuple(prefix, RECORD, primaryKey(i), split).pack(); }
|
||||||
static Key recordKey(int i) { return Tuple().append(prefix).append(RECORD).append(primaryKey(i)).pack(); }
|
static Value recordValue(int i) { return Tuple::makeTuple(dataOfRecord(i)).pack(); }
|
||||||
static Key recordKey(int i, int split) {
|
static Value recordValue(int i, int split) { return Tuple::makeTuple(dataOfRecord(i, split)).pack(); }
|
||||||
return Tuple().append(prefix).append(RECORD).append(primaryKey(i)).append(split).pack();
|
|
||||||
}
|
|
||||||
static Value recordValue(int i) { return Tuple().append(dataOfRecord(i)).pack(); }
|
|
||||||
static Value recordValue(int i, int split) { return Tuple().append(dataOfRecord(i, split)).pack(); }
|
|
||||||
|
|
||||||
ACTOR Future<Void> fillInRecords(Database cx, int n, GetMappedRangeWorkload* self) {
|
ACTOR Future<Void> fillInRecords(Database cx, int n, GetMappedRangeWorkload* self) {
|
||||||
state Transaction tr(cx);
|
state Transaction tr(cx);
|
||||||
@ -270,9 +266,9 @@ struct GetMappedRangeWorkload : ApiWorkload {
|
|||||||
GetMappedRangeWorkload* self,
|
GetMappedRangeWorkload* self,
|
||||||
int matchIndex,
|
int matchIndex,
|
||||||
bool allMissing = false) {
|
bool allMissing = false) {
|
||||||
Key beginTuple = Tuple().append(prefix).append(INDEX).append(indexKey(beginId)).getDataAsStandalone();
|
Key beginTuple = Tuple::makeTuple(prefix, INDEX, indexKey(beginId)).getDataAsStandalone();
|
||||||
state KeySelector beginSelector = KeySelector(firstGreaterOrEqual(beginTuple));
|
state KeySelector beginSelector = KeySelector(firstGreaterOrEqual(beginTuple));
|
||||||
Key endTuple = Tuple().append(prefix).append(INDEX).append(indexKey(endId)).getDataAsStandalone();
|
Key endTuple = Tuple::makeTuple(prefix, INDEX, indexKey(endId)).getDataAsStandalone();
|
||||||
state KeySelector endSelector = KeySelector(firstGreaterOrEqual(endTuple));
|
state KeySelector endSelector = KeySelector(firstGreaterOrEqual(endTuple));
|
||||||
state int limit = 100;
|
state int limit = 100;
|
||||||
state int expectedBeginId = beginId;
|
state int expectedBeginId = beginId;
|
||||||
@ -322,9 +318,9 @@ struct GetMappedRangeWorkload : ApiWorkload {
|
|||||||
Reference<TransactionWrapper>& tr,
|
Reference<TransactionWrapper>& tr,
|
||||||
GetMappedRangeWorkload* self) {
|
GetMappedRangeWorkload* self) {
|
||||||
Key mapper = getMapper(self, false);
|
Key mapper = getMapper(self, false);
|
||||||
Key beginTuple = Tuple().append(prefix).append(INDEX).append(indexKey(beginId)).getDataAsStandalone();
|
Key beginTuple = Tuple::makeTuple(prefix, INDEX, indexKey(beginId)).getDataAsStandalone();
|
||||||
KeySelector beginSelector = KeySelector(firstGreaterOrEqual(beginTuple));
|
KeySelector beginSelector = KeySelector(firstGreaterOrEqual(beginTuple));
|
||||||
Key endTuple = Tuple().append(prefix).append(INDEX).append(indexKey(endId)).getDataAsStandalone();
|
Key endTuple = Tuple::makeTuple(prefix, INDEX, indexKey(endId)).getDataAsStandalone();
|
||||||
KeySelector endSelector = KeySelector(firstGreaterOrEqual(endTuple));
|
KeySelector endSelector = KeySelector(firstGreaterOrEqual(endTuple));
|
||||||
return tr->getMappedRange(beginSelector,
|
return tr->getMappedRange(beginSelector,
|
||||||
endSelector,
|
endSelector,
|
||||||
|
@ -359,8 +359,7 @@ TEST_CASE("/fdbclient/TaskBucket/Subspace") {
|
|||||||
print_subspace_key(subspace_test1, 1);
|
print_subspace_key(subspace_test1, 1);
|
||||||
ASSERT(subspace_test1.key() == LiteralStringRef("abc"));
|
ASSERT(subspace_test1.key() == LiteralStringRef("abc"));
|
||||||
|
|
||||||
Tuple t;
|
Tuple t = Tuple::makeTuple("user"_sr);
|
||||||
t.append(LiteralStringRef("user"));
|
|
||||||
Subspace subspace_test2(t);
|
Subspace subspace_test2(t);
|
||||||
print_subspace_key(subspace_test2, 2);
|
print_subspace_key(subspace_test2, 2);
|
||||||
ASSERT(subspace_test2.key() == LiteralStringRef("\x01user\x00"));
|
ASSERT(subspace_test2.key() == LiteralStringRef("\x01user\x00"));
|
||||||
@ -369,8 +368,7 @@ TEST_CASE("/fdbclient/TaskBucket/Subspace") {
|
|||||||
print_subspace_key(subspace_test3, 3);
|
print_subspace_key(subspace_test3, 3);
|
||||||
ASSERT(subspace_test3.key() == LiteralStringRef("abc\x01user\x00"));
|
ASSERT(subspace_test3.key() == LiteralStringRef("abc\x01user\x00"));
|
||||||
|
|
||||||
Tuple t1;
|
Tuple t1 = Tuple::makeTuple(1);
|
||||||
t1.append(1);
|
|
||||||
Subspace subspace_test4(t1);
|
Subspace subspace_test4(t1);
|
||||||
print_subspace_key(subspace_test4, 4);
|
print_subspace_key(subspace_test4, 4);
|
||||||
ASSERT(subspace_test4.key() == LiteralStringRef("\x15\x01"));
|
ASSERT(subspace_test4.key() == LiteralStringRef("\x15\x01"));
|
||||||
@ -400,8 +398,7 @@ TEST_CASE("/fdbclient/TaskBucket/Subspace") {
|
|||||||
ASSERT(subspace_test8.key() == LiteralStringRef("\x01subitem\x00"));
|
ASSERT(subspace_test8.key() == LiteralStringRef("\x01subitem\x00"));
|
||||||
|
|
||||||
// pack
|
// pack
|
||||||
Tuple t3;
|
Tuple t3 = Tuple::makeTuple(""_sr);
|
||||||
t3.append(StringRef());
|
|
||||||
printf("%d==========%s===%d\n", 10, printable(subspace_test5.pack(t3)).c_str(), subspace_test5.pack(t3).size());
|
printf("%d==========%s===%d\n", 10, printable(subspace_test5.pack(t3)).c_str(), subspace_test5.pack(t3).size());
|
||||||
ASSERT(subspace_test5.pack(t3) == subspace_test5.pack(StringRef()));
|
ASSERT(subspace_test5.pack(t3) == subspace_test5.pack(StringRef()));
|
||||||
ASSERT(subspace_test5.pack(t3) == LiteralStringRef("abc\x01user\x00\x15\x7b\x01\x00"));
|
ASSERT(subspace_test5.pack(t3) == LiteralStringRef("abc\x01user\x00\x15\x7b\x01\x00"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user