diff options
author | Judah Schvimer <judah@mongodb.com> | 2016-08-16 09:48:07 -0400 |
---|---|---|
committer | Judah Schvimer <judah@mongodb.com> | 2016-08-16 09:48:07 -0400 |
commit | c911be4e42994ad6106d12ca6a760c255e5d0452 (patch) | |
tree | 41469532652f672e9134024b537abd173e1ed5b2 /src/mongo/db/repl/databases_cloner.h | |
parent | 3fff4a07c4f8a917a51afd894e3b251b5f906860 (diff) | |
download | mongo-c911be4e42994ad6106d12ca6a760c255e5d0452.tar.gz |
SERVER-25125 Report initial sync progress in ReplSetGetStatus
Diffstat (limited to 'src/mongo/db/repl/databases_cloner.h')
-rw-r--r-- | src/mongo/db/repl/databases_cloner.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/mongo/db/repl/databases_cloner.h b/src/mongo/db/repl/databases_cloner.h index 170ba2b7489..4bfe44b1c16 100644 --- a/src/mongo/db/repl/databases_cloner.h +++ b/src/mongo/db/repl/databases_cloner.h @@ -63,6 +63,15 @@ using UniqueLock = stdx::unique_lock<stdx::mutex>; */ class DatabasesCloner { public: + struct Stats { + size_t databasesCloned = 0U; + std::vector<DatabaseCloner::Stats> databaseStats; + + std::string toString() const; + BSONObj toBSON() const; + void append(BSONObjBuilder* builder) const; + }; + using IncludeDbFilterFn = stdx::function<bool(const BSONObj& dbInfo)>; using OnFinishFn = stdx::function<void(const Status&)>; DatabasesCloner(StorageInterface* si, @@ -78,6 +87,7 @@ public: bool isActive(); void join(); void shutdown(); + DatabasesCloner::Stats getStats() const; /** * Returns the status after completion. If multiple error occur, only one is recorded/returned. @@ -133,10 +143,9 @@ private: mutable stdx::mutex _mutex; // (S) Status _status{ErrorCodes::NotYetInitialized, ""}; // (M) If it is not OK, we stop everything. executor::TaskExecutor* _exec; // (R) executor to schedule things with - OldThreadPool* _dbWorkThreadPool; // (R) db worker thread pool for collection cloning. - HostAndPort _source; // (R) The source to use, until we get an error - bool _active = false; // (M) false until we start - std::size_t _currentClonerIndex = 0U; // (M) Index of currently active database cloner. + OldThreadPool* _dbWorkThreadPool; // (R) db worker thread pool for collection cloning. + HostAndPort _source; // (R) The source to use, until we get an error + bool _active = false; // (M) false until we start CollectionCloner::ScheduleDbWorkFn _scheduleDbWorkFn; // (M) const IncludeDbFilterFn _includeDbFn; // (R) function which decides which dbs are cloned. @@ -145,6 +154,7 @@ private: std::unique_ptr<RemoteCommandRetryScheduler> _listDBsScheduler; // (M) scheduler for listDBs. std::vector<std::shared_ptr<DatabaseCloner>> _databaseCloners; // (M) database cloners by name + Stats _stats; // (M) }; |