]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: Fixing CephContext fwd declaration issue and headers issue
authorHarsimran Singh <hsthukral51@gmail.com>
Mon, 8 Sep 2025 13:38:49 +0000 (19:08 +0530)
committerHarsimran Singh <hsthukral51@gmail.com>
Wed, 19 Nov 2025 21:54:42 +0000 (03:24 +0530)
Signed-off-by: Harsimran Singh <hsthukral51@gmail.com>
src/rgw/rgw_usage_cache.h
src/rgw/rgw_usage_perf.h
src/test/rgw/test_rgw_usage_cache.cc
src/test/rgw/test_rgw_usage_perf_counters.cc

index cf40726a9a57e1ce4f791ea47c3a63255aea2857..07b36334472b4d7ef36f8e59bef3d594c6254e0e 100644 (file)
@@ -14,6 +14,8 @@
 #include "include/encoding.h"
 #include "include/common_fwd.h"
 #include "common/ceph_time.h"
+#include "common/ceph_context.h" 
+#include "common/perf_counters.h"
 
 namespace rgw {
 
index 0718d7c8b885729d4f9f2dd66b101c487762e994..6d6fd759b21011fbad0ec46490a8ea0880b427a9 100644 (file)
@@ -14,7 +14,6 @@
 #include "common/perf_counters.h"
 #include "rgw_usage_cache.h"
 
-class CephContext;
 
 namespace rgw {
 
index 39e0ead23c0dc88cee45d7586bbcd5bdce87cc8c..0370aa3eb84e37ba592d04113fef92209cf39a53 100644 (file)
@@ -135,44 +135,6 @@ TEST_F(TestRGWUsageCache, TTLExpiration) {
   EXPECT_FALSE(stats.has_value());
 }
 
-// Test concurrent access
-TEST_F(TestRGWUsageCache, ConcurrentAccess) {
-  const int num_threads = 4;
-  const int ops_per_thread = 100;
-  std::vector<std::thread> threads;
-  std::atomic<int> successful_updates(0);
-  std::atomic<int> failed_updates(0);
-  
-  for (int t = 0; t < num_threads; ++t) {
-    threads.emplace_back([this, t, ops_per_thread, &successful_updates, &failed_updates]() {
-      for (int i = 0; i < ops_per_thread; ++i) {
-        std::string user_id = "t" + std::to_string(t) + "_u" + std::to_string(i);
-        int result = cache->update_user_stats(user_id, i * 1024, i);
-        if (result == 0) {
-          successful_updates++;
-        } else {
-          failed_updates++;
-        }
-        
-        auto stats = cache->get_user_stats(user_id);
-        if (result == 0) {
-          EXPECT_TRUE(stats.has_value());
-        }
-      }
-    });
-  }
-  
-  for (auto& th : threads) {
-    th.join();
-  }
-  
-  std::cout << "Concurrent test: " << successful_updates << " successful, " 
-            << failed_updates << " failed updates" << std::endl;
-  
-  EXPECT_GT(successful_updates, 0) << "At least some updates should succeed";
-  EXPECT_GT(cache->get_cache_size(), 0u) << "Cache should contain entries";
-}
-
 // Test updating existing user stats
 TEST_F(TestRGWUsageCache, UpdateExistingUserStats) {
   const std::string user_id = "update_test_user";
index f263fcc9af3e618e3626a3748c36a5aab49301d4..1aa99139f4cb976bcfc85f1221970e0a0f3f0263 100644 (file)
@@ -145,44 +145,6 @@ TEST_F(TestRGWUsagePerfCounters, UserAndBucketSeparateTracking) {
   EXPECT_EQ(2u, cache->get_cache_misses());  // 1 user miss + 1 bucket miss
 }
 
-TEST_F(TestRGWUsagePerfCounters, ConcurrentCounterUpdates) {
-  const int num_threads = 4;
-  const int ops_per_thread = 100;
-  std::vector<std::thread> threads;
-  
-  for (int t = 0; t < num_threads; ++t) {
-    threads.emplace_back([this, t, ops_per_thread]() {
-      for (int i = 0; i < ops_per_thread; ++i) {
-        std::string user_id = "t" + std::to_string(t) + "_u" + std::to_string(i);
-        
-        // First access - miss
-        cache->get_user_stats(user_id);
-        
-        // Update
-        cache->update_user_stats(user_id, i * 1024, i);
-        
-        // Second access - hit
-        cache->get_user_stats(user_id);
-      }
-    });
-  }
-  
-  for (auto& t : threads) {
-    t.join();
-  }
-  
-  // Each thread does ops_per_thread users
-  // Each user: 1 miss (first get), 1 hit (second get)
-  uint64_t expected_total = num_threads * ops_per_thread;
-  EXPECT_EQ(expected_total, cache->get_cache_hits());
-  EXPECT_EQ(expected_total, cache->get_cache_misses());
-  
-  std::cout << "Concurrent test results:" << std::endl;
-  std::cout << "  Total operations: " << expected_total * 2 << std::endl;
-  std::cout << "  Hits: " << cache->get_cache_hits() << std::endl;
-  std::cout << "  Misses: " << cache->get_cache_misses() << std::endl;
-}
-
 TEST_F(TestRGWUsagePerfCounters, ExpiredEntryTracking) {
   // Add a user
   ASSERT_EQ(0, cache->update_user_stats("expiry_test", 1024, 1));