@@ -669,8 +669,8 @@ void ShardServerCatalogCacheLoader::_schedulePrimaryGetChunksSince(
669
669
return ;
670
670
}
671
671
672
- log ( ) << " Cache loader remotely refreshed for collection " << nss << " from version "
673
- << maxLoaderVersion << " and no metadata was found." ;
672
+ LOG ( 1 ) << " Cache loader remotely refreshed for collection " << nss << " from version "
673
+ << maxLoaderVersion << " and no metadata was found." ;
674
674
} else if (swCollectionAndChangedChunks.isOK ()) {
675
675
auto & collAndChunks = swCollectionAndChangedChunks.getValue ();
676
676
@@ -700,10 +700,10 @@ void ShardServerCatalogCacheLoader::_schedulePrimaryGetChunksSince(
700
700
}
701
701
}
702
702
703
- log ( ) << " Cache loader remotely refreshed for collection " << nss
704
- << " from collection version " << maxLoaderVersion
705
- << " and found collection version "
706
- << collAndChunks.changedChunks .back ().getVersion ();
703
+ LOG ( 1 ) << " Cache loader remotely refreshed for collection " << nss
704
+ << " from collection version " << maxLoaderVersion
705
+ << " and found collection version "
706
+ << collAndChunks.changedChunks .back ().getVersion ();
707
707
708
708
// Metadata was found remotely -- otherwise would have received NamespaceNotFound
709
709
// rather than Status::OK(). Return metadata for CatalogCache that's GTE
@@ -755,8 +755,8 @@ void ShardServerCatalogCacheLoader::_schedulePrimaryGetDatabase(
755
755
return ;
756
756
}
757
757
758
- log ( ) << " Cache loader remotely refreshed for database " << name
759
- << " and found the database has been dropped." ;
758
+ LOG ( 1 ) << " Cache loader remotely refreshed for database " << name
759
+ << " and found the database has been dropped." ;
760
760
761
761
} else if (swDatabaseType.isOK ()) {
762
762
Status scheduleStatus = _ensureMajorityPrimaryAndScheduleDbTask (
@@ -766,8 +766,8 @@ void ShardServerCatalogCacheLoader::_schedulePrimaryGetDatabase(
766
766
return ;
767
767
}
768
768
769
- log ( ) << " Cache loader remotely refreshed for database " << name << " and found "
770
- << swDatabaseType.getValue ().toBSON ();
769
+ LOG ( 1 ) << " Cache loader remotely refreshed for database " << name << " and found "
770
+ << swDatabaseType.getValue ().toBSON ();
771
771
}
772
772
773
773
// Complete the callbackFn work.
@@ -802,18 +802,18 @@ StatusWith<CollectionAndChangedChunks> ShardServerCatalogCacheLoader::_getLoader
802
802
persisted = std::move (swPersisted.getValue ());
803
803
}
804
804
805
- log ( ) << " Cache loader found "
806
- << (enqueued.changedChunks .empty ()
807
- ? (tasksAreEnqueued ? " a drop enqueued" : " no enqueued metadata" )
808
- : (" enqueued metadata from " +
809
- enqueued.changedChunks .front ().getVersion ().toString () + " to " +
810
- enqueued.changedChunks .back ().getVersion ().toString ()))
811
- << " and " << (persisted.changedChunks .empty ()
812
- ? " no persisted metadata"
813
- : (" persisted metadata from " +
814
- persisted.changedChunks .front ().getVersion ().toString () + " to " +
815
- persisted.changedChunks .back ().getVersion ().toString ()))
816
- << " , GTE cache version " << catalogCacheSinceVersion;
805
+ LOG ( 1 ) << " Cache loader found "
806
+ << (enqueued.changedChunks .empty ()
807
+ ? (tasksAreEnqueued ? " a drop enqueued" : " no enqueued metadata" )
808
+ : (" enqueued metadata from " +
809
+ enqueued.changedChunks .front ().getVersion ().toString () + " to " +
810
+ enqueued.changedChunks .back ().getVersion ().toString ()))
811
+ << " and " << (persisted.changedChunks .empty ()
812
+ ? " no persisted metadata"
813
+ : (" persisted metadata from " +
814
+ persisted.changedChunks .front ().getVersion ().toString () + " to " +
815
+ persisted.changedChunks .back ().getVersion ().toString ()))
816
+ << " , GTE cache version " << catalogCacheSinceVersion;
817
817
818
818
if (!tasksAreEnqueued) {
819
819
// There are no tasks in the queue. Return the persisted metadata.
@@ -905,10 +905,10 @@ Status ShardServerCatalogCacheLoader::_ensureMajorityPrimaryAndScheduleCollAndCh
905
905
906
906
Status status = _threadPool.schedule ([this , nss]() { _runCollAndChunksTasks (nss); });
907
907
if (!status.isOK ()) {
908
- log ( ) << " Cache loader failed to schedule persisted metadata update"
909
- << " task for namespace '" << nss << " ' due to '" << redact (status)
910
- << " '. Clearing task list so that scheduling"
911
- << " will be attempted by the next caller to refresh this namespace." ;
908
+ LOG ( 0 ) << " Cache loader failed to schedule persisted metadata update"
909
+ << " task for namespace '" << nss << " ' due to '" << redact (status)
910
+ << " '. Clearing task list so that scheduling"
911
+ << " will be attempted by the next caller to refresh this namespace." ;
912
912
913
913
_collAndChunkTaskLists.erase (nss);
914
914
}
@@ -935,10 +935,10 @@ Status ShardServerCatalogCacheLoader::_ensureMajorityPrimaryAndScheduleDbTask(
935
935
Status status =
936
936
_threadPool.schedule ([ this , name = dbName.toString () ]() { _runDbTasks (name); });
937
937
if (!status.isOK ()) {
938
- log ( ) << " Cache loader failed to schedule persisted metadata update"
939
- << " task for db '" << dbName << " ' due to '" << redact (status)
940
- << " '. Clearing task list so that scheduling"
941
- << " will be attempted by the next caller to refresh this namespace." ;
938
+ LOG ( 0 ) << " Cache loader failed to schedule persisted metadata update"
939
+ << " task for db '" << dbName << " ' due to '" << redact (status)
940
+ << " '. Clearing task list so that scheduling"
941
+ << " will be attempted by the next caller to refresh this namespace." ;
942
942
943
943
_dbTaskLists.erase (dbName.toString ());
944
944
}
@@ -953,17 +953,13 @@ void ShardServerCatalogCacheLoader::_runCollAndChunksTasks(const NamespaceString
953
953
try {
954
954
_updatePersistedCollAndChunksMetadata (context.opCtx (), nss);
955
955
taskFinished = true ;
956
+ } catch (const ExceptionForCat<ErrorCategory::ShutdownError>&) {
957
+ LOG (0 ) << " Failed to persist chunk metadata update for collection '" << nss
958
+ << " ' due to shutdown." ;
959
+ return ;
956
960
} catch (const DBException& ex) {
957
- Status exceptionStatus = ex.toStatus ();
958
-
959
- // This thread must stop if we are shutting down
960
- if (ErrorCodes::isShutdownError (exceptionStatus.code ())) {
961
- log () << " Failed to persist chunk metadata update for collection '" << nss
962
- << " ' due to shutdown." ;
963
- return ;
964
- }
965
-
966
- log () << redact (exceptionStatus);
961
+ LOG (0 ) << " Failed to persist chunk metadata update for collection '" << nss
962
+ << causedBy (redact (ex));
967
963
}
968
964
969
965
stdx::lock_guard<stdx::mutex> lock (_mutex);
@@ -977,10 +973,11 @@ void ShardServerCatalogCacheLoader::_runCollAndChunksTasks(const NamespaceString
977
973
if (!_collAndChunkTaskLists[nss].empty ()) {
978
974
Status status = _threadPool.schedule ([this , nss]() { _runCollAndChunksTasks (nss); });
979
975
if (!status.isOK ()) {
980
- log () << " Cache loader failed to schedule a persisted metadata update"
981
- << " task for namespace '" << nss << " ' due to '" << redact (status)
982
- << " '. Clearing task list so that scheduling will be attempted by the next"
983
- << " caller to refresh this namespace." ;
976
+ LOG (0 ) << " Cache loader failed to schedule a persisted metadata update"
977
+ << " task for namespace '" << nss << " ' due to '" << redact (status)
978
+ << " '. Clearing task list so that scheduling will be attempted by the next"
979
+ << " caller to refresh this namespace." ;
980
+
984
981
_collAndChunkTaskLists.erase (nss);
985
982
}
986
983
} else {
@@ -995,17 +992,12 @@ void ShardServerCatalogCacheLoader::_runDbTasks(StringData dbName) {
995
992
try {
996
993
_updatePersistedDbMetadata (context.opCtx (), dbName);
997
994
taskFinished = true ;
995
+ } catch (const ExceptionForCat<ErrorCategory::ShutdownError>&) {
996
+ LOG (0 ) << " Failed to persist metadata update for db '" << dbName << " ' due to shutdown." ;
997
+ return ;
998
998
} catch (const DBException& ex) {
999
- Status exceptionStatus = ex.toStatus ();
1000
-
1001
- // This thread must stop if we are shutting down
1002
- if (ErrorCodes::isShutdownError (exceptionStatus.code ())) {
1003
- log () << " Failed to persist metadata update for db '" << dbName.toString ()
1004
- << " ' due to shutdown." ;
1005
- return ;
1006
- }
1007
-
1008
- log () << redact (exceptionStatus);
999
+ LOG (0 ) << " Failed to persist chunk metadata update for database " << dbName
1000
+ << causedBy (redact (ex));
1009
1001
}
1010
1002
1011
1003
stdx::lock_guard<stdx::mutex> lock (_mutex);
@@ -1017,13 +1009,14 @@ void ShardServerCatalogCacheLoader::_runDbTasks(StringData dbName) {
1017
1009
1018
1010
// Schedule more work if there is any
1019
1011
if (!_dbTaskLists[dbName.toString ()].empty ()) {
1020
- Status status = _threadPool. schedule (
1021
- [ this , name = dbName.toString () ]() { _runDbTasks (StringData ( name) ); });
1012
+ Status status =
1013
+ _threadPool. schedule ( [ this , name = dbName.toString () ]() { _runDbTasks (name); });
1022
1014
if (!status.isOK ()) {
1023
- log () << " Cache loader failed to schedule a persisted metadata update"
1024
- << " task for namespace '" << dbName.toString () << " ' due to '" << redact (status)
1025
- << " '. Clearing task list so that scheduling will be attempted by the next"
1026
- << " caller to refresh this namespace." ;
1015
+ LOG (0 ) << " Cache loader failed to schedule a persisted metadata update"
1016
+ << " task for namespace '" << dbName << " ' due to '" << redact (status)
1017
+ << " '. Clearing task list so that scheduling will be attempted by the next"
1018
+ << " caller to refresh this namespace." ;
1019
+
1027
1020
_dbTaskLists.erase (dbName.toString ());
1028
1021
}
1029
1022
} else {
@@ -1099,7 +1092,7 @@ void ShardServerCatalogCacheLoader::_updatePersistedDbMetadata(OperationContext*
1099
1092
<< dbName.toString ()
1100
1093
<< " '. Will be retried." );
1101
1094
1102
- log ( ) << " Successfully updated persisted metadata for db ' " << dbName.toString ();
1095
+ LOG ( 1 ) << " Successfully updated persisted metadata for db " << dbName.toString ();
1103
1096
}
1104
1097
1105
1098
CollectionAndChangedChunks
0 commit comments