1
0
Fork 0

fixing compiler warnings

This commit is contained in:
Simon Grätzer 2017-05-08 14:14:23 +02:00
parent 2aef42231e
commit a610d81e3d
9 changed files with 62 additions and 45 deletions

View File

@ -211,9 +211,9 @@ void RocksDBEngine::start() {
_options.compaction_readahead_size =
static_cast<size_t>(opts->_compactionReadaheadSize);
_options.env->SetBackgroundThreads(opts->_numThreadsHigh,
_options.env->SetBackgroundThreads((int)opts->_numThreadsHigh,
rocksdb::Env::Priority::HIGH);
_options.env->SetBackgroundThreads(opts->_numThreadsLow,
_options.env->SetBackgroundThreads((int)opts->_numThreadsLow,
rocksdb::Env::Priority::LOW);
_options.create_if_missing = true;

View File

@ -384,7 +384,7 @@ bool RocksDBGeoIndex::matchesDefinition(VPackSlice const& info) const {
return true;
}
int RocksDBGeoIndex::insert(transaction::Methods*, TRI_voc_rid_t revisionId,
int RocksDBGeoIndex::insert(transaction::Methods *, TRI_voc_rid_t revisionId,
VPackSlice const& doc, bool isRollback) {
double latitude;
double longitude;
@ -453,6 +453,12 @@ int RocksDBGeoIndex::insert(transaction::Methods*, TRI_voc_rid_t revisionId,
return TRI_ERROR_NO_ERROR;
}
int RocksDBGeoIndex::insertRaw(rocksdb::WriteBatchWithIndex* batch,
TRI_voc_rid_t revisionId,
arangodb::velocypack::Slice const& doc) {
return this->insert(nullptr, revisionId, doc, false);
}
int RocksDBGeoIndex::remove(transaction::Methods*, TRI_voc_rid_t revisionId,
VPackSlice const& doc, bool isRollback) {
double latitude = 0.0;
@ -512,6 +518,12 @@ int RocksDBGeoIndex::remove(transaction::Methods*, TRI_voc_rid_t revisionId,
return TRI_ERROR_NO_ERROR;
}
int RocksDBGeoIndex::removeRaw(rocksdb::WriteBatch*, TRI_voc_rid_t revisionId,
arangodb::velocypack::Slice const& doc) {
return this->remove(nullptr, revisionId, doc, false);
}
int RocksDBGeoIndex::unload() {
// create a new, empty index
auto empty = GeoIndex_new(_objectId);

View File

@ -140,9 +140,12 @@ class RocksDBGeoIndex final : public RocksDBIndex {
int insert(transaction::Methods*, TRI_voc_rid_t,
arangodb::velocypack::Slice const&, bool isRollback) override;
int insertRaw(rocksdb::WriteBatchWithIndex*, TRI_voc_rid_t,
arangodb::velocypack::Slice const&) override;
int remove(transaction::Methods*, TRI_voc_rid_t,
arangodb::velocypack::Slice const&, bool isRollback) override;
int removeRaw(rocksdb::WriteBatch*, TRI_voc_rid_t,
arangodb::velocypack::Slice const&) override;
int unload() override;

View File

@ -90,26 +90,26 @@ VPackBuilder PotToVpack(GeoPot* pot){
GeoPot VpackToPot(VPackSlice const& slice){
GeoPot rv{};
TRI_ASSERT(slice.isArray());
rv.LorLeaf = slice.at(0).getInt(); // int
rv.RorPoints = slice.at(1).getInt(); // int
rv.LorLeaf = (int) slice.at(0).getInt(); // int
rv.RorPoints = (int) slice.at(1).getInt(); // int
rv.middle = slice.at(2).getUInt(); // GeoString
{
auto maxdistSlice = slice.at(3);
TRI_ASSERT(maxdistSlice.isArray());
TRI_ASSERT(maxdistSlice.length() == GeoIndexFIXEDPOINTS);
for(std::size_t i = 0; i < GeoIndexFIXEDPOINTS; i++){
rv.maxdist[i] = maxdistSlice.at(i).getUInt(); //unit 16/33
rv.maxdist[i] = (int) maxdistSlice.at(i).getUInt(); //unit 16/33
}
}
rv.start = slice.at(4).getUInt(); // GeoString
rv.start = (int) slice.at(4).getUInt(); // GeoString
rv.end = slice.at(5).getUInt(); // GeoString
rv.level = slice.at(6).getInt(); // int
rv.level = (int) slice.at(6).getInt(); // int
{
auto pointsSlice = slice.at(7);
TRI_ASSERT(pointsSlice.isArray());
TRI_ASSERT(pointsSlice.length() == GeoIndexFIXEDPOINTS);
for(std::size_t i = 0; i < GeoIndexPOTSIZE; i++){
rv.points[i] = pointsSlice.at(i).getInt(); //int
rv.points[i] = (int) pointsSlice.at(i).getInt(); //int
}
}
return rv;

View File

@ -182,19 +182,12 @@ VPackSlice RocksDBKey::indexedVPack(rocksdb::Slice const& slice) {
}
std::pair<bool, uint32_t> RocksDBKey::geoValues(rocksdb::Slice const& slice) {
TRI_ASSERT(size >= sizeof(char) + sizeof(uint64_t) * 2);
RocksDBEntryType type = static_cast<RocksDBEntryType>(data[0]);
TRI_ASSERT(slice.size() >= sizeof(char) + sizeof(uint64_t) * 2);
RocksDBEntryType type = static_cast<RocksDBEntryType>(*slice.data());
TRI_ASSERT(type == RocksDBEntryType::GeoIndexValue);
uint64_t val = uint64FromPersistent(data + sizeof(char) + sizeof(uint64_t));
uint64_t val = uint64FromPersistent(slice.data() + sizeof(char) + sizeof(uint64_t));
bool isSlot = (val >> 63) & 0x1;
return std::pair<bool, uint32_t>(isSlot, (val & );
size_t length = sizeof(char) + sizeof(objectId) + sizeof(offset);
_buffer.reserve(length);
_buffer.push_back(static_cast<char>(_type));
offset |= std::uint64_t{isSlot} << 63; //encode slot|pot in highest bit
uint64ToPersistent(_buffer, objectId);
uint64ToPersistent(_buffer, offset);
return std::pair<bool, uint32_t>(isSlot, (val & 0xffffffff));
}
std::string const& RocksDBKey::string() const { return _buffer; }
@ -332,7 +325,7 @@ RocksDBKey::RocksDBKey(RocksDBEntryType type, uint64_t objectId, uint32_t offset
_buffer.push_back(static_cast<char>(_type));
uint64ToPersistent(_buffer, objectId);
uint64_t norm = offset;
if (isSlot) norm |= 1 << 63;//encode slot|pot in highest bit
if (isSlot) norm |= uint64_t(1) << 63;//encode slot|pot in highest bit
uint64ToPersistent(_buffer, norm);
break;
}

View File

@ -226,7 +226,7 @@ class RocksDBKey {
///
/// May be called only on GeoIndexValues
//////////////////////////////////////////////////////////////////////////////
std::pair<bool, uint64_t> geoValues(rocksdb::Slice const&);
std::pair<bool, uint32_t> geoValues(rocksdb::Slice const& slice);
public:
//////////////////////////////////////////////////////////////////////////////

View File

@ -73,6 +73,10 @@ RocksDBKeyBounds RocksDBKeyBounds::UniqueIndex(uint64_t indexId) {
return RocksDBKeyBounds(RocksDBEntryType::UniqueIndexValue, indexId);
}
RocksDBKeyBounds RocksDBKeyBounds::FulltextIndex(uint64_t indexId) {
return RocksDBKeyBounds(RocksDBEntryType::FulltextIndexValue, indexId);
}
RocksDBKeyBounds RocksDBKeyBounds::GeoIndex(uint64_t indexId) {
return RocksDBKeyBounds(RocksDBEntryType::GeoIndexValue, indexId);
}
@ -98,11 +102,6 @@ RocksDBKeyBounds RocksDBKeyBounds::CounterValues() {
return RocksDBKeyBounds(RocksDBEntryType::CounterValue);
}
RocksDBKeyBounds RocksDBKeyBounds::FulltextIndex(uint64_t indexId) {
return RocksDBKeyBounds(RocksDBEntryType::FulltextIndexValue, indexId);
}
RocksDBKeyBounds RocksDBKeyBounds::FulltextIndexPrefix(uint64_t indexId,
arangodb::StringRef const& word) {
// I did not want to pass a bool to the constructor for this
@ -236,8 +235,9 @@ RocksDBKeyBounds::RocksDBKeyBounds(RocksDBEntryType type, uint64_t first)
case RocksDBEntryType::PrimaryIndexValue:
case RocksDBEntryType::EdgeIndexValue:
case RocksDBEntryType::View:
case RocksDBEntryType::FulltextIndexValue: {
case RocksDBEntryType::FulltextIndexValue:
case RocksDBEntryType::GeoIndexValue:
case RocksDBEntryType::View: {
size_t length = sizeof(char) + sizeof(uint64_t);
_startBuffer.reserve(length);
_startBuffer.push_back(static_cast<char>(_type));

View File

@ -85,6 +85,11 @@ class RocksDBKeyBounds {
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds UniqueIndex(uint64_t indexId);
//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all entries of a fulltext index
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds FulltextIndex(uint64_t indexId);
//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all entries belonging to a specified unique index
//////////////////////////////////////////////////////////////////////////////
@ -114,12 +119,7 @@ class RocksDBKeyBounds {
/// @brief Bounds for all counter values
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds CounterValues();
//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all entries of a fulltext index
//////////////////////////////////////////////////////////////////////////////
static RocksDBKeyBounds FulltextIndex(uint64_t indexId);
//////////////////////////////////////////////////////////////////////////////
/// @brief Bounds for all entries of a fulltext index, matching prefixes
//////////////////////////////////////////////////////////////////////////////

View File

@ -72,6 +72,20 @@ static rocksdb::Slice UniqueIndexValue(
reinterpret_cast<std::underlying_type<RocksDBEntryType>::type*>(
&uniqueIndexValue),
1);
static RocksDBEntryType fulltextIndexValue =
RocksDBEntryType::FulltextIndexValue;
static rocksdb::Slice FulltextIndexValue(
reinterpret_cast<std::underlying_type<RocksDBEntryType>::type*>(
&fulltextIndexValue),
1);
static RocksDBEntryType geoIndexValue =
RocksDBEntryType::GeoIndexValue;
static rocksdb::Slice GeoIndexValue(
reinterpret_cast<std::underlying_type<RocksDBEntryType>::type*>(
&geoIndexValue),
1);
static RocksDBEntryType view = RocksDBEntryType::View;
static rocksdb::Slice View(
@ -89,13 +103,6 @@ static rocksdb::Slice ReplicationApplierConfig(
reinterpret_cast<std::underlying_type<RocksDBEntryType>::type*>(
&replicationApplierConfig),
1);
static RocksDBEntryType fulltextIndexValue =
RocksDBEntryType::FulltextIndexValue;
static rocksdb::Slice FulltextIndexValue(
reinterpret_cast<std::underlying_type<RocksDBEntryType>::type*>(
&fulltextIndexValue),
1);
}
rocksdb::Slice const& arangodb::rocksDBSlice(RocksDBEntryType const& type) {
@ -116,14 +123,16 @@ rocksdb::Slice const& arangodb::rocksDBSlice(RocksDBEntryType const& type) {
return IndexValue;
case RocksDBEntryType::UniqueIndexValue:
return UniqueIndexValue;
case RocksDBEntryType::FulltextIndexValue:
return FulltextIndexValue;
case RocksDBEntryType::GeoIndexValue:
return GeoIndexValue;
case RocksDBEntryType::View:
return View;
case RocksDBEntryType::SettingsValue:
return SettingsValue;
case RocksDBEntryType::ReplicationApplierConfig:
return ReplicationApplierConfig;
case RocksDBEntryType::FulltextIndexValue:
return FulltextIndexValue;
}
return Document; // avoids warning - errorslice instead ?!