1
0
Fork 0

removed unused version attribute

This commit is contained in:
jsteemann 2016-08-16 17:21:59 +02:00
parent 294f4092d6
commit 803a3c84ce
4 changed files with 19 additions and 33 deletions

View File

@ -453,7 +453,7 @@ int MMFilesEngine::getCollectionsAndIndexes(TRI_vocbase_t* vocbase,
continue; continue;
} }
if (info.version() < TRI_COL_VERSION && !isUpgrade) { if (info.version() < VocbaseCollectionInfo::version() && !isUpgrade) {
// collection is too "old" // collection is too "old"
LOG(ERR) << "collection '" << info.name() LOG(ERR) << "collection '" << info.name()
<< "' has a too old version. Please start the server " << "' has a too old version. Please start the server "
@ -1321,7 +1321,7 @@ VocbaseCollectionInfo MMFilesEngine::loadCollectionInfo(TRI_vocbase_t* vocbase,
VocbaseCollectionInfo info(vocbase, collectionName, slice, isSystemValue); VocbaseCollectionInfo info(vocbase, collectionName, slice, isSystemValue);
// warn about wrong version of the collection // warn about wrong version of the collection
if (versionWarning && info.version() < TRI_COL_VERSION) { if (versionWarning && info.version() < VocbaseCollectionInfo::version()) {
if (info.name()[0] != '\0') { if (info.name()[0] != '\0') {
// only warn if the collection version is older than expected, and if it's // only warn if the collection version is older than expected, and if it's
// not a shape collection // not a shape collection

View File

@ -2620,7 +2620,7 @@ static void JS_VersionVocbaseCol(
TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract collection"); TRI_V8_THROW_EXCEPTION_INTERNAL("cannot extract collection");
} }
TRI_V8_RETURN(v8::Number::New(isolate, (int) TRI_COL_VERSION)); TRI_V8_RETURN(v8::Number::New(isolate, (int) VocbaseCollectionInfo::version()));
TRI_V8_TRY_CATCH_END TRI_V8_TRY_CATCH_END
} }

View File

@ -1274,8 +1274,7 @@ bool TRI_collection_t::closeDataFiles(std::vector<TRI_datafile_t*> const& files)
VocbaseCollectionInfo::VocbaseCollectionInfo(CollectionInfo const& other) VocbaseCollectionInfo::VocbaseCollectionInfo(CollectionInfo const& other)
: _version(TRI_COL_VERSION), : _type(other.type()),
_type(other.type()),
_revision(0), // not known in the cluster case on the coordinator _revision(0), // not known in the cluster case on the coordinator
_cid(other.id()), // this is on the coordinator and describes a _cid(other.id()), // this is on the coordinator and describes a
// cluster-wide collection, for safety reasons, // cluster-wide collection, for safety reasons,
@ -1308,8 +1307,7 @@ VocbaseCollectionInfo::VocbaseCollectionInfo(TRI_vocbase_t* vocbase,
TRI_col_type_e type, TRI_col_type_e type,
TRI_voc_size_t maximalSize, TRI_voc_size_t maximalSize,
VPackSlice const& keyOptions) VPackSlice const& keyOptions)
: _version(TRI_COL_VERSION), : _type(type),
_type(type),
_revision(0), _revision(0),
_cid(0), _cid(0),
_planId(0), _planId(0),
@ -1355,8 +1353,7 @@ VocbaseCollectionInfo::VocbaseCollectionInfo(TRI_vocbase_t* vocbase,
TRI_col_type_e type, TRI_col_type_e type,
VPackSlice const& options, VPackSlice const& options,
bool forceIsSystem) bool forceIsSystem)
: _version(TRI_COL_VERSION), : _type(type),
_type(type),
_revision(0), _revision(0),
_cid(0), _cid(0),
_planId(0), _planId(0),
@ -1514,9 +1511,6 @@ VocbaseCollectionInfo::VocbaseCollectionInfo(TRI_vocbase_t* vocbase,
_isSystem = (*_name == '_'); _isSystem = (*_name == '_');
} }
// collection version
TRI_col_version_t VocbaseCollectionInfo::version() const { return _version; }
// collection type // collection type
TRI_col_type_e VocbaseCollectionInfo::type() const { return _type; } TRI_col_type_e VocbaseCollectionInfo::type() const { return _type; }
@ -1656,7 +1650,6 @@ void VocbaseCollectionInfo::update(VPackSlice const& slice, bool preferDefaults,
} }
void VocbaseCollectionInfo::update(VocbaseCollectionInfo const& other) { void VocbaseCollectionInfo::update(VocbaseCollectionInfo const& other) {
_version = other.version();
_type = other.type(); _type = other.type();
_cid = other.id(); _cid = other.id();
_planId = other.planId(); _planId = other.planId();
@ -4525,7 +4518,7 @@ int TRI_collection_t::indexFromVelocyPack(arangodb::Transaction* trx,
} }
/// @brief state during opening of a collection /// @brief state during opening of a collection
struct open_iterator_state_t { struct OpenIteratorState {
TRI_collection_t* _document; TRI_collection_t* _document;
TRI_voc_tid_t _tid; TRI_voc_tid_t _tid;
TRI_voc_fid_t _fid; TRI_voc_fid_t _fid;
@ -4537,8 +4530,8 @@ struct open_iterator_state_t {
uint64_t _documents; uint64_t _documents;
int64_t _initialCount; int64_t _initialCount;
open_iterator_state_t(TRI_collection_t* document, OpenIteratorState(TRI_collection_t* document,
TRI_vocbase_t* vocbase) TRI_vocbase_t* vocbase)
: _document(document), : _document(document),
_tid(0), _tid(0),
_fid(0), _fid(0),
@ -4550,7 +4543,7 @@ struct open_iterator_state_t {
_documents(0), _documents(0),
_initialCount(-1) {} _initialCount(-1) {}
~open_iterator_state_t() { ~OpenIteratorState() {
for (auto& it : _stats) { for (auto& it : _stats) {
delete it.second; delete it.second;
} }
@ -4559,7 +4552,7 @@ struct open_iterator_state_t {
/// @brief find a statistics container for a given file id /// @brief find a statistics container for a given file id
static DatafileStatisticsContainer* FindDatafileStats( static DatafileStatisticsContainer* FindDatafileStats(
open_iterator_state_t* state, TRI_voc_fid_t fid) { OpenIteratorState* state, TRI_voc_fid_t fid) {
auto it = state->_stats.find(fid); auto it = state->_stats.find(fid);
if (it != state->_stats.end()) { if (it != state->_stats.end()) {
@ -4577,7 +4570,7 @@ static DatafileStatisticsContainer* FindDatafileStats(
/// @brief process a document (or edge) marker when opening a collection /// @brief process a document (or edge) marker when opening a collection
static int OpenIteratorHandleDocumentMarker(TRI_df_marker_t const* marker, static int OpenIteratorHandleDocumentMarker(TRI_df_marker_t const* marker,
TRI_datafile_t* datafile, TRI_datafile_t* datafile,
open_iterator_state_t* state) { OpenIteratorState* state) {
auto const fid = datafile->_fid; auto const fid = datafile->_fid;
TRI_collection_t* document = state->_document; TRI_collection_t* document = state->_document;
arangodb::Transaction* trx = state->_trx; arangodb::Transaction* trx = state->_trx;
@ -4673,7 +4666,7 @@ static int OpenIteratorHandleDocumentMarker(TRI_df_marker_t const* marker,
/// @brief process a deletion marker when opening a collection /// @brief process a deletion marker when opening a collection
static int OpenIteratorHandleDeletionMarker(TRI_df_marker_t const* marker, static int OpenIteratorHandleDeletionMarker(TRI_df_marker_t const* marker,
TRI_datafile_t* datafile, TRI_datafile_t* datafile,
open_iterator_state_t* state) { OpenIteratorState* state) {
TRI_collection_t* document = state->_document; TRI_collection_t* document = state->_document;
arangodb::Transaction* trx = state->_trx; arangodb::Transaction* trx = state->_trx;
@ -4743,7 +4736,7 @@ static int OpenIteratorHandleDeletionMarker(TRI_df_marker_t const* marker,
static bool OpenIterator(TRI_df_marker_t const* marker, void* data, static bool OpenIterator(TRI_df_marker_t const* marker, void* data,
TRI_datafile_t* datafile) { TRI_datafile_t* datafile) {
TRI_collection_t* document = TRI_collection_t* document =
static_cast<open_iterator_state_t*>(data)->_document; static_cast<OpenIteratorState*>(data)->_document;
TRI_voc_tick_t const tick = marker->getTick(); TRI_voc_tick_t const tick = marker->getTick();
TRI_df_marker_type_t const type = marker->getType(); TRI_df_marker_type_t const type = marker->getType();
@ -4751,7 +4744,7 @@ static bool OpenIterator(TRI_df_marker_t const* marker, void* data,
if (type == TRI_DF_MARKER_VPACK_DOCUMENT) { if (type == TRI_DF_MARKER_VPACK_DOCUMENT) {
res = OpenIteratorHandleDocumentMarker(marker, datafile, res = OpenIteratorHandleDocumentMarker(marker, datafile,
static_cast<open_iterator_state_t*>(data)); static_cast<OpenIteratorState*>(data));
if (datafile->_dataMin == 0) { if (datafile->_dataMin == 0) {
datafile->_dataMin = tick; datafile->_dataMin = tick;
@ -4762,12 +4755,12 @@ static bool OpenIterator(TRI_df_marker_t const* marker, void* data,
} }
} else if (type == TRI_DF_MARKER_VPACK_REMOVE) { } else if (type == TRI_DF_MARKER_VPACK_REMOVE) {
res = OpenIteratorHandleDeletionMarker(marker, datafile, res = OpenIteratorHandleDeletionMarker(marker, datafile,
static_cast<open_iterator_state_t*>(data)); static_cast<OpenIteratorState*>(data));
} else { } else {
if (type == TRI_DF_MARKER_HEADER) { if (type == TRI_DF_MARKER_HEADER) {
// ensure there is a datafile info entry for each datafile of the // ensure there is a datafile info entry for each datafile of the
// collection // collection
FindDatafileStats(static_cast<open_iterator_state_t*>(data), datafile->_fid); FindDatafileStats(static_cast<OpenIteratorState*>(data), datafile->_fid);
} }
LOG(TRACE) << "skipping marker type " << TRI_NameMarkerDatafile(marker); LOG(TRACE) << "skipping marker type " << TRI_NameMarkerDatafile(marker);
@ -4834,7 +4827,7 @@ static int IterateMarkersCollection(arangodb::Transaction* trx,
auto document = reinterpret_cast<TRI_collection_t*>(collection); auto document = reinterpret_cast<TRI_collection_t*>(collection);
// initialize state for iteration // initialize state for iteration
open_iterator_state_t openState(document, collection->_vocbase); OpenIteratorState openState(document, collection->_vocbase);
if (collection->_info.initialCount() != -1) { if (collection->_info.initialCount() != -1) {
auto primaryIndex = document->primaryIndex(); auto primaryIndex = document->primaryIndex();

View File

@ -71,9 +71,6 @@ struct DocumentOperation;
} }
} }
/// @brief current collection version
#define TRI_COL_VERSION 5
/// @brief predefined collection name for users /// @brief predefined collection name for users
#define TRI_COL_NAME_USERS "_users" #define TRI_COL_NAME_USERS "_users"
@ -107,15 +104,11 @@ struct TRI_doc_collection_info_t {
char _lastCompactionStamp[21]; char _lastCompactionStamp[21];
}; };
/// @brief collection version
typedef uint32_t TRI_col_version_t;
namespace arangodb { namespace arangodb {
/// @brief collection info block saved to disk as json /// @brief collection info block saved to disk as json
class VocbaseCollectionInfo { class VocbaseCollectionInfo {
private: private:
TRI_col_version_t _version; // collection version
TRI_col_type_e _type; // collection type TRI_col_type_e _type; // collection type
TRI_voc_rid_t _revision; // last revision id written TRI_voc_rid_t _revision; // last revision id written
TRI_voc_cid_t _cid; // local collection identifier TRI_voc_cid_t _cid; // local collection identifier
@ -156,7 +149,7 @@ class VocbaseCollectionInfo {
void toVelocyPack(VPackBuilder& builder) const; void toVelocyPack(VPackBuilder& builder) const;
// collection version // collection version
TRI_col_version_t version() const; static constexpr uint32_t version() { return 5; }
// collection type // collection type
TRI_col_type_e type() const; TRI_col_type_e type() const;