Skip to content

Commit ac772a0

Browse files
committed
COMMON: Also clean up the negative user name cache when a mapping reset is requested and also periodically
1 parent 68a541c commit ac772a0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

common/Mapping.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,18 @@ Mapping::Init()
133133
std::call_once(g_cache_map_init, []() {
134134
// Force expiry of UID/GID cache every 2 cycles
135135
gShardedPhysicalUidCache.set_force_expiry(true, 2);
136-
gShardedPhysicalGidCache.set_force_expiry(true, 2);
137-
gShardedNegativeGroupNameCache.set_force_expiry(true, 2);
138-
gShardedNegativePhysicalUidCache.set_force_expiry(true, 2);
139136
gShardedPhysicalUidCache.reset_cleanup_thread(3600 * 1000,
140137
"UidCacheGC");
138+
gShardedPhysicalGidCache.set_force_expiry(true, 2);
141139
gShardedPhysicalGidCache.reset_cleanup_thread(3600 * 1000,
142140
"GidCacheGC");
143141
gShardedNegativeUserNameCache.set_force_expiry(true, 8);
144142
gShardedNegativeUserNameCache.reset_cleanup_thread(3600 * 1000,
145143
"NegUserNameGC");
144+
gShardedNegativeGroupNameCache.set_force_expiry(true, 8);
146145
gShardedNegativeGroupNameCache.reset_cleanup_thread(3600 * 1000,
147146
"NegGroupNameGC");
147+
gShardedNegativePhysicalUidCache.set_force_expiry(true, 2);
148148
gShardedNegativePhysicalUidCache.reset_cleanup_thread(3600 * 1000,
149149
"NegUidGC");
150150
ActiveUidsSharded.reset_cleanup_thread(300 * 1000,
@@ -166,12 +166,13 @@ Mapping::Reset()
166166
{
167167
{
168168
std::scoped_lock lock{gPhysicalUserNameCacheMutex, gPhysicalGroupNameCacheMutex};
169-
gPhysicalGroupNameCache.clear();
170169
gPhysicalUserNameCache.clear();
170+
gPhysicalGroupNameCache.clear();
171171
gPhysicalGroupIdCache.clear();
172172
gPhysicalUserIdCache.clear();
173173
gShardedPhysicalUidCache.clear();
174174
gShardedPhysicalGidCache.clear();
175+
gShardedNegativeUserNameCache.clear();
175176
gShardedNegativeGroupNameCache.clear();
176177
gShardedNegativePhysicalUidCache.clear();
177178
}

0 commit comments

Comments
 (0)