@@ -240,7 +240,7 @@ void DatabaseContext::getLatestCommitVersions(const Reference<LocationInfo>& loc
240240 return ;
241241 }
242242
243- if (ssVersionVectorCache. getMaxVersion () != invalidVersion && readVersion > ssVersionVectorCache.getMaxVersion ()) {
243+ if (readVersion > ssVersionVectorCache.getMaxVersion ()) {
244244 if (!CLIENT_KNOBS->FORCE_GRV_CACHE_OFF && !info->options .skipGrvCache && info->options .useGrvCache ) {
245245 return ;
246246 } else {
@@ -253,16 +253,29 @@ void DatabaseContext::getLatestCommitVersions(const Reference<LocationInfo>& loc
253253
254254 std::map<Version, std::set<Tag>> versionMap; // order the versions to be returned
255255 for (int i = 0 ; i < locationInfo->locations ()->size (); i++) {
256- UID uid = locationInfo->locations ()->getId (i);
257- if (ssidTagMapping.find (uid) != ssidTagMapping.end ()) {
258- Tag tag = ssidTagMapping[uid];
256+ bool updatedVersionMap = false ;
257+ Version commitVersion = invalidVersion;
258+ Tag tag = invalidTag;
259+ auto iter = ssidTagMapping.find (locationInfo->locations ()->getId (i));
260+ if (iter != ssidTagMapping.end ()) {
261+ tag = iter->second ;
259262 if (ssVersionVectorCache.hasVersion (tag)) {
260- Version commitVersion = ssVersionVectorCache.getVersion (tag); // latest commit version
263+ commitVersion = ssVersionVectorCache.getVersion (tag); // latest commit version
261264 if (commitVersion < readVersion) {
265+ updatedVersionMap = true ;
262266 versionMap[commitVersion].insert (tag);
263267 }
264268 }
265269 }
270+ if (!updatedVersionMap) {
271+ TraceEvent (SevDebug, " CommitVersionNotFoundForSS" )
272+ .detail (" InSSIDMap" , iter != ssidTagMapping.end () ? 1 : 0 )
273+ .detail (" Tag" , tag)
274+ .detail (" CommitVersion" , commitVersion)
275+ .detail (" ReadVersion" , readVersion)
276+ .detail (" VersionVector" , ssVersionVectorCache.toString ());
277+ ++transactionCommitVersionNotFoundForSS;
278+ }
266279 }
267280
268281 // insert the commit versions in the version vector.
@@ -1445,13 +1458,13 @@ DatabaseContext::DatabaseContext(Reference<AsyncVar<Reference<IClusterConnection
14451458 transactionsProcessBehind(" ProcessBehind" , cc), transactionsThrottled(" Throttled" , cc),
14461459 transactionsExpensiveClearCostEstCount(" ExpensiveClearCostEstCount" , cc),
14471460 transactionGrvFullBatches(" NumGrvFullBatches" , cc), transactionGrvTimedOutBatches(" NumGrvTimedOutBatches" , cc),
1448- latencies( 1000 ), readLatencies( 1000 ), commitLatencies (1000 ), GRVLatencies( 1000 ), mutationsPerCommit (1000 ),
1449- bytesPerCommit (1000 ), bgLatencies (1000 ), bgGranulesPerRequest (1000 ), outstandingWatches( 0 ), sharedStatePtr( nullptr ),
1450- lastGrvTime( 0.0 ), cachedReadVersion (0 ), lastRkBatchThrottleTime( 0.0 ), lastRkDefaultThrottleTime( 0. 0 ),
1451- lastProxyRequestTime (0.0 ), transactionTracingSample( false ), taskID(taskID), clientInfo(clientInfo ),
1452- clientInfoMonitor(clientInfoMonitor ), coordinator(coordinator ), apiVersion(apiVersion ), mvCacheInsertLocation( 0 ),
1453- healthMetricsLastUpdated( 0 ), detailedHealthMetricsLastUpdated (0 ),
1454- smoothMidShardSize(CLIENT_KNOBS->SHARD_STAT_SMOOTH_AMOUNT),
1461+ transactionCommitVersionNotFoundForSS( " CommitVersionNotFoundForSS " , cc ), latencies (1000 ), readLatencies (1000 ),
1462+ commitLatencies (1000 ), GRVLatencies (1000 ), mutationsPerCommit (1000 ), bytesPerCommit( 1000 ), bgLatencies( 1000 ),
1463+ bgGranulesPerRequest( 1000 ), outstandingWatches (0 ), sharedStatePtr( nullptr ), lastGrvTime( 0.0 ), cachedReadVersion( 0 ),
1464+ lastRkBatchThrottleTime (0.0 ), lastRkDefaultThrottleTime( 0.0 ), lastProxyRequestTime( 0.0 ),
1465+ transactionTracingSample( false ), taskID(taskID ), clientInfo(clientInfo ), clientInfoMonitor(clientInfoMonitor ),
1466+ coordinator(coordinator), apiVersion(apiVersion), mvCacheInsertLocation( 0 ), healthMetricsLastUpdated (0 ),
1467+ detailedHealthMetricsLastUpdated( 0 ), smoothMidShardSize(CLIENT_KNOBS->SHARD_STAT_SMOOTH_AMOUNT),
14551468 specialKeySpace(std::make_unique<SpecialKeySpace>(specialKeys.begin, specialKeys.end, /* test */ false )),
14561469 connectToDatabaseEventCacheHolder(format(" ConnectToDatabase/%s" , dbId.toString().c_str())) {
14571470 dbId = deterministicRandom ()->randomUniqueID ();
@@ -1719,8 +1732,9 @@ DatabaseContext::DatabaseContext(const Error& err)
17191732 transactionsProcessBehind(" ProcessBehind" , cc), transactionsThrottled(" Throttled" , cc),
17201733 transactionsExpensiveClearCostEstCount(" ExpensiveClearCostEstCount" , cc),
17211734 transactionGrvFullBatches(" NumGrvFullBatches" , cc), transactionGrvTimedOutBatches(" NumGrvTimedOutBatches" , cc),
1722- latencies(1000 ), readLatencies(1000 ), commitLatencies(1000 ), GRVLatencies(1000 ), mutationsPerCommit(1000 ),
1723- bytesPerCommit(1000 ), bgLatencies(1000 ), bgGranulesPerRequest(1000 ), transactionTracingSample(false ),
1735+ transactionCommitVersionNotFoundForSS(" CommitVersionNotFoundForSS" , cc), latencies(1000 ), readLatencies(1000 ),
1736+ commitLatencies(1000 ), GRVLatencies(1000 ), mutationsPerCommit(1000 ), bytesPerCommit(1000 ), bgLatencies(1000 ),
1737+ bgGranulesPerRequest(1000 ), transactionTracingSample(false ),
17241738 smoothMidShardSize(CLIENT_KNOBS->SHARD_STAT_SMOOTH_AMOUNT),
17251739 connectToDatabaseEventCacheHolder(format(" ConnectToDatabase/%s" , dbId.toString().c_str())) {}
17261740
0 commit comments