@@ -326,7 +326,10 @@ bool MigrationSourceManager::transferMods(OperationContext* txn,
326326 return false ;
327327 }
328328
329- if (!_sessionId->matches (sessionId)) {
329+ // TODO after 3.4 release, !sessionId.isEmpty() can be removed: versions >= 3.2 will
330+ // all have sessionId implemented. (two more instances below).
331+ // A mongod version < v3.2 will not have sessionId, in which case it is empty and ignored.
332+ if (!sessionId.isEmpty () && !_sessionId->matches (sessionId)) {
330333 errmsg = str::stream () << " requested migration session id " << sessionId.toString ()
331334 << " does not match active session id "
332335 << _sessionId->toString ();
@@ -482,7 +485,8 @@ bool MigrationSourceManager::clone(OperationContext* txn,
482485 return false ;
483486 }
484487
485- if (!_sessionId->matches (sessionId)) {
488+ // A mongod version < v3.2 will not have sessionId, in which case it is empty and ignored.
489+ if (!sessionId.isEmpty () && !_sessionId->matches (sessionId)) {
486490 errmsg = str::stream () << " requested migration session id " << sessionId.toString ()
487491 << " does not match active session id "
488492 << _sessionId->toString ();
@@ -512,7 +516,8 @@ bool MigrationSourceManager::clone(OperationContext* txn,
512516 return false ;
513517 }
514518
515- if (!_sessionId->matches (sessionId)) {
519+ // A mongod version < v3.2 will not have sessionId, in which case it is empty and ignored.
520+ if (!sessionId.isEmpty () && !_sessionId->matches (sessionId)) {
516521 errmsg = str::stream () << " migration session id changed from " << sessionId.toString ()
517522 << " to " << _sessionId->toString ()
518523 << " while initial clone was active" ;
0 commit comments