switch deserialization order

This commit is contained in:
CJ Cobb
2021-03-24 21:00:49 -04:00
parent 29424fd863
commit d72867ec64
2 changed files with 23 additions and 3 deletions

View File

@@ -698,7 +698,7 @@ CassandraBackend::open()
continue; continue;
query = {}; query = {};
query << "SELECT key,object FROM " << tablePrefix << "objects " query << "SELECT object,key FROM " << tablePrefix << "objects "
<< " WHERE TOKEN(key) >= ? and sequence <= ? " << " WHERE TOKEN(key) >= ? and sequence <= ? "
<< " PER PARTITION LIMIT 1 LIMIT ? ALLOW FILTERING"; << " PER PARTITION LIMIT 1 LIMIT ? ALLOW FILTERING";

View File

@@ -385,6 +385,26 @@ public:
curGetIndex_++; curGetIndex_++;
return {buf, buf + bufSize}; return {buf, buf + bufSize};
} }
/*
uint32_t
getNumBytes()
{
if (!row_)
throw std::runtime_error("CassandraResult::getBytes - no result");
cass_byte_t const* buf;
std::size_t bufSize;
CassError rc = cass_value_get_bytes(
cass_row_get_column(row_, curGetIndex_), &buf, &bufSize);
if (rc != CASS_OK)
{
std::stringstream msg;
msg << "CassandraResult::getBytes - error getting value: " << rc
<< ", " << cass_error_desc(rc);
BOOST_LOG_TRIVIAL(error) << msg.str();
throw std::runtime_error(msg.str());
}
return bufSize;
}*/
ripple::uint256 ripple::uint256
getUInt256() getUInt256()
@@ -977,11 +997,11 @@ public:
size_t prevSize = objects.size(); size_t prevSize = objects.size();
do do
{ {
ripple::uint256 key = result.getUInt256();
std::vector<unsigned char> object = result.getBytes(); std::vector<unsigned char> object = result.getBytes();
if (object.size()) if (object.size())
{ {
objects.push_back({std::move(key), std::move(object)}); objects.push_back(
{result.getUInt256(), std::move(object)});
} }
} while (result.nextRow()); } while (result.nextRow());
size_t prevBatchSize = objects.size() - prevSize; size_t prevBatchSize = objects.size() - prevSize;