Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/mongo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ foreach (tool
add_executable(mongo${tool} tools/${tool})
endforeach ()
add_executable(bsondump tools/bsondump)
add_executable(toku2mongo tools/toku2mongo)
foreach (tool
mongodump
mongorestore
Expand All @@ -604,6 +605,7 @@ foreach (tool
mongofiles
mongobridge
bsondump
toku2mongo
)
add_dependencies(${tool} generate_error_codes generate_action_types install_tdb_h)
if (NOT APPLE)
Expand All @@ -627,6 +629,7 @@ install_executables(tokumx_tools
mongo2toku
mongofiles
bsondump
toku2mongo
)
target_link_libraries(mongofiles gridfs)

Expand Down
23 changes: 21 additions & 2 deletions src/mongo/db/gtid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "mongo/db/gtid.h"

#include "mongo/base/parse_number.h"
#include "mongo/bson/util/builder.h"
#include "mongo/util/time_support.h"

Expand Down Expand Up @@ -87,11 +88,29 @@ namespace mongo {
bool GTID::isInitial() const {
return (_primarySeqNo == 0);
}

std::string GTID::toConciseString() const {
std::stringstream ss;
ss << _primarySeqNo << ":" << _GTSeqNo;
return ss.str();
}

Status GTID::parseConciseString(const StringData &s, GTID &gtid) {
size_t colonPos = s.find(":");
StringData primaryStr = s.substr(0, colonPos);
StringData seqStr = s.substr(colonPos + 1);
Status status = parseNumberFromString(primaryStr, &gtid._primarySeqNo);
if (!status.isOK()) {
return status;
}
status = parseNumberFromString(seqStr, &gtid._GTSeqNo);
return status;
}

uint64_t GTID::getPrimary() const {
return _primarySeqNo;
}
}

GTIDManager::GTIDManager( GTID lastGTID, uint64_t lastTime, uint64_t lastHash, uint32_t id, uint64_t lastVotedForPrimary ) {
_selfID = id;
_lastLiveGTID = lastGTID;
Expand Down
4 changes: 4 additions & 0 deletions src/mongo/db/gtid.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
//#include "mongo/db/jsobj.h"
#include <limits>

#include "mongo/base/status.h"

namespace mongo {

class BSONObjBuilder;
Expand All @@ -42,6 +44,8 @@ namespace mongo {
void setPrimaryTo(uint64_t newPrimary);
string toString() const;
bool isInitial() const;
static Status parseConciseString(const StringData &s, GTID &gtid);
std::string toConciseString() const;
uint64_t getPrimary() const;
bool operator==(const GTID& other) const {
return _primarySeqNo == other._primarySeqNo && _GTSeqNo == other._GTSeqNo;
Expand Down
Loading