1
0
Fork 0

Merge branch 'engine-api' of https://github.com/arangodb/arangodb into engine-api

This commit is contained in:
jsteemann 2017-03-30 16:22:37 +02:00
commit 8e9aaa2b51
8 changed files with 172 additions and 26 deletions

View File

@ -41,7 +41,6 @@
#include "RocksDBEngine/RocksDBToken.h"
#include "RocksDBEngine/RocksDBTransactionState.h"
#include "RocksDBEngine/RocksDBTypes.h"
#include "RocksDBEngine/RocksDBCommon.h"
#include <rocksdb/db.h>
#include <rocksdb/options.h>
@ -80,7 +79,6 @@ RocksDBEdgeIndexIterator::~RocksDBEdgeIndexIterator() {
}
bool RocksDBEdgeIndexIterator::next(TokenCallback const& cb, size_t limit) {
if (limit == 0 || !_iterator.valid()) {
// No limit no data, or we are actually done. The last call should have
// returned false
@ -114,7 +112,7 @@ bool RocksDBEdgeIndexIterator::next(TokenCallback const& cb, size_t limit) {
// aquire the document token through the primary index
RocksDBToken token;
Result res = rocksColl->lookupDocumentToken( _trx, edgeKey, token);
Result res = rocksColl->lookupDocumentToken(_trx, edgeKey, token);
if (res.ok()) {
cb(token);
if (--limit == 0) {

View File

@ -108,7 +108,7 @@ class RocksDBEdgeIndex final : public RocksDBIndex {
arangodb::basics::LocalTaskQueue* queue = nullptr) override;
int unload() override;
int drop() override;
int sizeHint(transaction::Methods*, size_t) override;

View File

@ -0,0 +1,48 @@
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Simon Grätzer
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_ROCKSDB_ROCKSDB_HASH_INDEX_H
#define ARANGOD_ROCKSDB_ROCKSDB_HASH_INDEX_H 1
#include "RocksDBEngine/RocksDBVPackIndex.h"
namespace arangodb {
class RocksDBHashIndex final : public RocksDBVPackIndex {
public:
RocksDBHashIndex() = delete;
RocksDBHashIndex(TRI_idx_iid_t iid, LogicalCollection* coll,
arangodb::velocypack::Slice const& info)
: RocksDBVPackIndex(iid, coll, info) {}
public:
IndexType type() const override { return Index::TRI_IDX_TYPE_HASH_INDEX; }
char const* typeName() const override { return "rocksdb-hash"; }
bool isSorted() const override { return false; }
};
}
#endif

View File

@ -29,6 +29,9 @@
#include "RocksDBEngine/RocksDBEdgeIndex.h"
#include "RocksDBEngine/RocksDBEngine.h"
#include "RocksDBEngine/RocksDBPrimaryIndex.h"
#include "RocksDBEngine/RocksDBPersistentIndex.h"
#include "RocksDBEngine/RocksDBHashIndex.h"
#include "RocksDBEngine/RocksDBSkiplistIndex.h"
#include "StorageEngine/EngineSelectorFeature.h"
#include "VocBase/ticks.h"
#include "VocBase/voc-types.h"
@ -357,13 +360,19 @@ std::shared_ptr<Index> RocksDBIndexFactory::prepareIndexFromSlice(
new arangodb::RocksDBEdgeIndex(iid, col, StaticStrings::FromString));
break;
}
//case arangodb::Index::TRI_IDX_TYPE_GEO1_INDEX:
//case arangodb::Index::TRI_IDX_TYPE_GEO2_INDEX:
case arangodb::Index::TRI_IDX_TYPE_HASH_INDEX: {
LOG_TOPIC(WARN, Logger::FIXME) << "Hash Index not implemented";
// // TODO: fix this wrong index type. only used temporarily because we
// don't have other indexes
// newIdx.reset(new arangodb::RocksDBEdgeIndex(db, iid, col,
// StaticStrings::FromString));
// break;
newIdx.reset(new arangodb::RocksDBHashIndex(iid, col, info));
break;
}
case arangodb::Index::TRI_IDX_TYPE_SKIPLIST_INDEX: {
newIdx.reset(new arangodb::RocksDBSkiplistIndex(iid, col, info));
break;
}
case arangodb::Index::TRI_IDX_TYPE_PERSISTENT_INDEX: {
newIdx.reset(new arangodb::RocksDBPersistentIndex(iid, col, info));
break;
}
case arangodb::Index::TRI_IDX_TYPE_UNKNOWN:

View File

@ -18,7 +18,7 @@
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Jan Steemann
/// @author Simon Grätzer
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_MMFILES_PATH_BASED_INDEX_H
@ -47,9 +47,14 @@ class RocksDBPathBasedIndex : public RocksDBIndex {
arangodb::velocypack::Slice const&, size_t baseSize,
bool allowPartialIndex);
~RocksDBPathBasedIndex();
virtual ~RocksDBPathBasedIndex();
public:
bool allowExpansion() const override { return true; }
bool canBeDropped() const override { return true; }
/// @brief return the attribute paths
std::vector<std::vector<std::string>> const& paths() const { return _paths; }

View File

@ -0,0 +1,49 @@
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Simon Grätzer
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_ROCKSDB_ROCKSDB_PERSISTENT_INDEX_H
#define ARANGOD_ROCKSDB_ROCKSDB_PERSISTENT_INDEX_H 1
#include "RocksDBEngine/RocksDBVPackIndex.h"
namespace arangodb {
class RocksDBPersistentIndex final : public RocksDBVPackIndex {
public:
RocksDBPersistentIndex() = delete;
RocksDBPersistentIndex(TRI_idx_iid_t iid, LogicalCollection* coll,
arangodb::velocypack::Slice const& info)
: RocksDBVPackIndex(iid, coll, info) {}
public:
IndexType type() const override {
return Index::TRI_IDX_TYPE_PERSISTENT_INDEX;
}
char const* typeName() const override { return "rocksdb-persistent"; }
bool isSorted() const override { return true; }
};
}
#endif

View File

@ -0,0 +1,48 @@
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Simon Grätzer
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_ROCKSDB_ROCKSDB_SKIPLIST_INDEX_H
#define ARANGOD_ROCKSDB_ROCKSDB_SKIPLIST_INDEX_H 1
#include "RocksDBEngine/RocksDBVPackIndex.h"
namespace arangodb {
class RocksDBSkiplistIndex final : public RocksDBVPackIndex {
public:
RocksDBSkiplistIndex() = delete;
RocksDBSkiplistIndex(TRI_idx_iid_t iid, LogicalCollection* coll,
arangodb::velocypack::Slice const& info)
: RocksDBVPackIndex(iid, coll, info) {}
public:
IndexType type() const override { return Index::TRI_IDX_TYPE_SKIPLIST_INDEX; }
char const* typeName() const override { return "rocksdb-skiplist"; }
bool isSorted() const override { return true; }
};
}
#endif

View File

@ -93,7 +93,7 @@ class RocksDBVPackIndexIterator final : public IndexIterator {
RocksDBKeyBounds _bounds;
};
class RocksDBVPackIndex final : public RocksDBPathBasedIndex {
class RocksDBVPackIndex : public RocksDBPathBasedIndex {
friend class RocksDBVPackIndexIterator;
public:
@ -102,21 +102,10 @@ class RocksDBVPackIndex final : public RocksDBPathBasedIndex {
RocksDBVPackIndex(TRI_idx_iid_t, LogicalCollection*,
arangodb::velocypack::Slice const&);
~RocksDBVPackIndex();
virtual ~RocksDBVPackIndex();
public:
IndexType type() const override {
return Index::TRI_IDX_TYPE_PERSISTENT_INDEX;
}
char const* typeName() const override { return "rocksdb-unique-index"; }
bool allowExpansion() const override { return true; }
bool canBeDropped() const override { return true; }
bool isSorted() const override { return true; }
bool hasSelectivityEstimate() const override { return _unique && true; }
double selectivityEstimate(