1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
|
/**
* Copyright (C) 2018-present MongoDB, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the Server Side Public License in all respects for
* all of the code used other than as permitted herein. If you modify file(s)
* with this exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kReplication
#include "mongo/platform/basic.h"
#include "mongo/embedded/replication_coordinator_embedded.h"
#include "mongo/db/repl/read_concern_args.h"
#include "mongo/db/repl/repl_set_config.h"
#include "mongo/embedded/not_implemented.h"
namespace mongo {
namespace embedded {
using namespace repl;
ReplicationCoordinatorEmbedded::ReplicationCoordinatorEmbedded(ServiceContext* service)
: _service(service) {}
ReplicationCoordinatorEmbedded::~ReplicationCoordinatorEmbedded() = default;
void ReplicationCoordinatorEmbedded::startup(OperationContext* opCtx) {}
void ReplicationCoordinatorEmbedded::shutdown(OperationContext* opCtx) {}
const ReplSettings& ReplicationCoordinatorEmbedded::getSettings() const {
static ReplSettings _settings;
return _settings;
}
ReplicationCoordinator::Mode ReplicationCoordinatorEmbedded::getReplicationMode() const {
return ReplicationCoordinator::Mode::modeNone;
}
bool ReplicationCoordinatorEmbedded::isMasterForReportingPurposes() {
return true;
}
bool ReplicationCoordinatorEmbedded::canAcceptWritesForDatabase(OperationContext* opCtx,
StringData dbName) {
return true;
}
bool ReplicationCoordinatorEmbedded::canAcceptWritesForDatabase_UNSAFE(OperationContext* opCtx,
StringData dbName) {
return true;
}
bool ReplicationCoordinatorEmbedded::canAcceptWritesFor(OperationContext* opCtx,
const NamespaceString& ns) {
return true;
}
bool ReplicationCoordinatorEmbedded::canAcceptWritesFor_UNSAFE(OperationContext* opCtx,
const NamespaceString& ns) {
return true;
}
Status ReplicationCoordinatorEmbedded::checkCanServeReadsFor(OperationContext* opCtx,
const NamespaceString& ns,
bool slaveOk) {
return Status::OK();
}
Status ReplicationCoordinatorEmbedded::checkCanServeReadsFor_UNSAFE(OperationContext* opCtx,
const NamespaceString& ns,
bool slaveOk) {
return Status::OK();
}
bool ReplicationCoordinatorEmbedded::isInPrimaryOrSecondaryState() const {
return false;
}
bool ReplicationCoordinatorEmbedded::shouldRelaxIndexConstraints(OperationContext* opCtx,
const NamespaceString& ns) {
return false;
}
bool ReplicationCoordinatorEmbedded::getMaintenanceMode() {
return false;
}
WriteConcernOptions ReplicationCoordinatorEmbedded::getGetLastErrorDefault() {
return WriteConcernOptions();
}
bool ReplicationCoordinatorEmbedded::isReplEnabled() const {
return false;
}
WriteConcernOptions ReplicationCoordinatorEmbedded::populateUnsetWriteConcernOptionsSyncMode(
WriteConcernOptions wc) {
WriteConcernOptions writeConcern(wc);
writeConcern.syncMode = WriteConcernOptions::SyncMode::NONE;
return writeConcern;
}
bool ReplicationCoordinatorEmbedded::buildsIndexes() {
return true;
}
OpTime ReplicationCoordinatorEmbedded::getCurrentCommittedSnapshotOpTime() const {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::appendDiagnosticBSON(mongo::BSONObjBuilder*) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::appendConnectionStats(
executor::ConnectionPoolStats* stats) const {
UASSERT_NOT_IMPLEMENTED;
}
MemberState ReplicationCoordinatorEmbedded::getMemberState() const {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::waitForMemberState(MemberState, Milliseconds) {
UASSERT_NOT_IMPLEMENTED;
}
Seconds ReplicationCoordinatorEmbedded::getSlaveDelaySecs() const {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::clearSyncSourceBlacklist() {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::setFollowerMode(const MemberState&) {
UASSERT_NOT_IMPLEMENTED;
}
ReplicationCoordinator::ApplierState ReplicationCoordinatorEmbedded::getApplierState() {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::signalDrainComplete(OperationContext*, long long) {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::waitForDrainFinish(Milliseconds) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::signalUpstreamUpdater() {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::setMyHeartbeatMessage(const std::string&) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::setMyLastAppliedOpTimeForward(const OpTime&, DataConsistency) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::setMyLastDurableOpTimeForward(const OpTime&) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::setMyLastAppliedOpTime(const OpTime&) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::setMyLastDurableOpTime(const OpTime&) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::resetMyLastOpTimes() {
UASSERT_NOT_IMPLEMENTED;
}
OpTime ReplicationCoordinatorEmbedded::getMyLastAppliedOpTime() const {
UASSERT_NOT_IMPLEMENTED;
}
OpTime ReplicationCoordinatorEmbedded::getMyLastDurableOpTime() const {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::waitUntilOpTimeForRead(OperationContext*,
const ReadConcernArgs& readConcern) {
// nothing to wait for
auto level = readConcern.getLevel();
if ((level == ReadConcernLevel::kLocalReadConcern ||
level == ReadConcernLevel::kAvailableReadConcern) &&
(!readConcern.getArgsAfterClusterTime() && !readConcern.getArgsOpTime() &&
!readConcern.getArgsAtClusterTime())) {
return Status::OK();
}
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::waitUntilOpTimeForReadUntil(OperationContext*,
const ReadConcernArgs&,
boost::optional<Date_t>) {
UASSERT_NOT_IMPLEMENTED;
}
ReplicationCoordinator::StatusAndDuration ReplicationCoordinatorEmbedded::awaitReplication(
OperationContext*, const OpTime&, const WriteConcernOptions&) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::stepDown(OperationContext*,
const bool,
const Milliseconds&,
const Milliseconds&) {
UASSERT_NOT_IMPLEMENTED;
}
OID ReplicationCoordinatorEmbedded::getElectionId() {
UASSERT_NOT_IMPLEMENTED;
}
int ReplicationCoordinatorEmbedded::getMyId() const {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::resyncData(OperationContext*, bool) {
UASSERT_NOT_IMPLEMENTED;
}
StatusWith<BSONObj> ReplicationCoordinatorEmbedded::prepareReplSetUpdatePositionCommand() const {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::processReplSetGetStatus(BSONObjBuilder*,
ReplSetGetStatusResponseStyle) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::fillIsMasterForReplSet(IsMasterResponse*) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::appendSlaveInfoData(BSONObjBuilder*) {
UASSERT_NOT_IMPLEMENTED;
}
ReplSetConfig ReplicationCoordinatorEmbedded::getConfig() const {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::processReplSetGetConfig(BSONObjBuilder*) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::processReplSetMetadata(const rpc::ReplSetMetadata&) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::cancelAndRescheduleElectionTimeout() {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::setMaintenanceMode(bool) {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::processReplSetSyncFrom(OperationContext*,
const HostAndPort&,
BSONObjBuilder*) {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::processReplSetFreeze(int, BSONObjBuilder*) {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::processReplSetReconfig(OperationContext*,
const ReplSetReconfigArgs&,
BSONObjBuilder*) {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::processReplSetInitiate(OperationContext*,
const BSONObj&,
BSONObjBuilder*) {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::abortCatchupIfNeeded() {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::processReplSetUpdatePosition(const UpdatePositionArgs&,
long long*) {
UASSERT_NOT_IMPLEMENTED;
}
std::vector<HostAndPort> ReplicationCoordinatorEmbedded::getHostsWrittenTo(const OpTime&, bool) {
UASSERT_NOT_IMPLEMENTED;
}
std::vector<HostAndPort> ReplicationCoordinatorEmbedded::getOtherNodesInReplSet() const {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::checkIfWriteConcernCanBeSatisfied(
const WriteConcernOptions&) const {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::checkReplEnabledForCommand(BSONObjBuilder*) {
return Status(ErrorCodes::NoReplicationEnabled, "no replication on embedded");
}
HostAndPort ReplicationCoordinatorEmbedded::chooseNewSyncSource(const OpTime&) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::blacklistSyncSource(const HostAndPort&, Date_t) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::resetLastOpTimesFromOplog(OperationContext*, DataConsistency) {
UASSERT_NOT_IMPLEMENTED;
}
bool ReplicationCoordinatorEmbedded::shouldChangeSyncSource(
const HostAndPort&, const rpc::ReplSetMetadata&, boost::optional<rpc::OplogQueryMetadata>) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::advanceCommitPoint(const OpTime&) {
UASSERT_NOT_IMPLEMENTED;
}
OpTime ReplicationCoordinatorEmbedded::getLastCommittedOpTime() const {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::processReplSetRequestVotes(OperationContext*,
const ReplSetRequestVotesArgs&,
ReplSetRequestVotesResponse*) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::prepareReplMetadata(const BSONObj&,
const OpTime&,
BSONObjBuilder*) const {
UASSERT_NOT_IMPLEMENTED;
}
bool ReplicationCoordinatorEmbedded::getWriteConcernMajorityShouldJournal() {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::processHeartbeatV1(const ReplSetHeartbeatArgsV1&,
ReplSetHeartbeatResponse*) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::summarizeAsHtml(ReplSetHtmlSummary*) {
UASSERT_NOT_IMPLEMENTED;
}
long long ReplicationCoordinatorEmbedded::getTerm() {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::updateTerm(OperationContext*, long long) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::waitUntilSnapshotCommitted(OperationContext*,
const Timestamp&) {
UASSERT_NOT_IMPLEMENTED;
}
size_t ReplicationCoordinatorEmbedded::getNumUncommittedSnapshots() {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::dropAllSnapshots() {
UASSERT_NOT_IMPLEMENTED;
}
Status ReplicationCoordinatorEmbedded::stepUpIfEligible(bool skipDryRun) {
UASSERT_NOT_IMPLEMENTED;
}
ReplSettings::IndexPrefetchConfig ReplicationCoordinatorEmbedded::getIndexPrefetchConfig() const {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::setIndexPrefetchConfig(
const ReplSettings::IndexPrefetchConfig) {
UASSERT_NOT_IMPLEMENTED;
}
void ReplicationCoordinatorEmbedded::signalDropPendingCollectionsRemovedFromStorage() {
UASSERT_NOT_IMPLEMENTED;
}
} // namespace embedded
} // namespace mongo
|