This is an automated email from the ASF dual-hosted git repository. jbarrett pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push: new c19087d GEODE-8181: Fixes default value for statistic-sampling-enabled. (#606) c19087d is described below commit c19087dfee444d12b5509641693294129a625c6b Author: Jacob Barrett <jbarr...@pivotal.io> AuthorDate: Tue Jun 2 09:12:43 2020 -0700 GEODE-8181: Fixes default value for statistic-sampling-enabled. (#606) --- clicache/integration-test/ExpirationTestsN.cs | 1 + cppcache/include/geode/SystemProperties.hpp | 5 +---- cppcache/integration-test/resources/system.properties | 2 +- cppcache/integration-test/testExpiration.cpp | 4 ++++ cppcache/integration-test/testSystemProperties.cpp | 4 ++-- cppcache/src/LocalRegion.cpp | 8 ++++---- cppcache/src/SystemProperties.cpp | 2 +- defaultSystem/geode.properties | 2 +- docs/geode-native-docs-cpp/configuring/sysprops.html.md.erb | 2 +- 9 files changed, 16 insertions(+), 14 deletions(-) diff --git a/clicache/integration-test/ExpirationTestsN.cs b/clicache/integration-test/ExpirationTestsN.cs index 8b3498a..a168578 100644 --- a/clicache/integration-test/ExpirationTestsN.cs +++ b/clicache/integration-test/ExpirationTestsN.cs @@ -51,6 +51,7 @@ namespace Apache.Geode.Client.UnitTests { base.InitTests(); Properties<string, string> config = new Properties<string, string>(); + config.Insert("statistic-sampling-enabled", "true"); CacheHelper.InitConfig(config); } diff --git a/cppcache/include/geode/SystemProperties.hpp b/cppcache/include/geode/SystemProperties.hpp index ab4963e..b116122 100644 --- a/cppcache/include/geode/SystemProperties.hpp +++ b/cppcache/include/geode/SystemProperties.hpp @@ -88,10 +88,7 @@ class APACHE_GEODE_EXPORT SystemProperties { /** * Whether time stats are enabled for the statistics. */ - bool getEnableTimeStatistics() const /*timestatisticsEnabled()*/ - { - return m_timestatisticsEnabled; - } /*m_timestatisticsEnabled*/ + bool getEnableTimeStatistics() const { return m_timestatisticsEnabled; } /** * Returns the path of the private key file for SSL use. diff --git a/cppcache/integration-test/resources/system.properties b/cppcache/integration-test/resources/system.properties index e1b0630..4ab6a09 100644 --- a/cppcache/integration-test/resources/system.properties +++ b/cppcache/integration-test/resources/system.properties @@ -14,7 +14,7 @@ # limitations under the License. # All the configurable parameters. statistic-sample-rate=700s -statistic-sampling-enabled=false +statistic-sampling-enabled=true statistic-archive-file=stats.gfs log-file=geode-native.log #log-level=debug diff --git a/cppcache/integration-test/testExpiration.cpp b/cppcache/integration-test/testExpiration.cpp index c0a8afc..7292c4c 100644 --- a/cppcache/integration-test/testExpiration.cpp +++ b/cppcache/integration-test/testExpiration.cpp @@ -47,6 +47,7 @@ size_t getNumOfEntries(std::shared_ptr<Region> &R1) { void startDSandCreateCache(std::shared_ptr<Cache> &cache) { auto pp = Properties::create(); auto cacheFactory = CacheFactory(pp); + cacheFactory.set("statistic-sampling-enabled", "true"); cache = std::make_shared<Cache>(cacheFactory.create()); ASSERT(cache != nullptr, "cache not equal to null expected"); } @@ -109,6 +110,9 @@ BEGIN_TEST(TEST_EXPIRATION) ASSERT(cache != nullptr, "Expected cache to be NON-nullptr"); + ASSERT(cache->getSystemProperties().statisticsEnabled(), + "Statistics must be enabled for expiration."); + auto cacheImpl = CacheRegionHelper::getCacheImpl(cache.get()); size_t n; diff --git a/cppcache/integration-test/testSystemProperties.cpp b/cppcache/integration-test/testSystemProperties.cpp index 74b01de..b8ac576 100644 --- a/cppcache/integration-test/testSystemProperties.cpp +++ b/cppcache/integration-test/testSystemProperties.cpp @@ -51,7 +51,7 @@ BEGIN_TEST(DEFAULT) ASSERT( systemProperties->statisticsSampleInterval() == std::chrono::seconds(1), "expected 1"); - ASSERT(systemProperties->statisticsEnabled() == true, "expected true"); + ASSERT(systemProperties->statisticsEnabled() == false, "expected false"); LOG(systemProperties->statisticsArchiveFile()); auto &&statisticsArchiveFileName = systemProperties->statisticsArchiveFile(); @@ -80,7 +80,7 @@ BEGIN_TEST(NEW_CONFIG) std::chrono::seconds(700), "expected 700"); - ASSERT(systemProperties->statisticsEnabled() == false, "expected false"); + ASSERT(systemProperties->statisticsEnabled() == true, "expected true"); ASSERT(systemProperties->threadPoolSize() == 96, "max-fe-thread should be 96"); diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp index b4f9fcf..73ba5d7 100644 --- a/cppcache/src/LocalRegion.cpp +++ b/cppcache/src/LocalRegion.cpp @@ -128,10 +128,10 @@ void LocalRegion::updateAccessAndModifiedTime(bool modified) { } std::shared_ptr<CacheStatistics> LocalRegion::getStatistics() const { CHECK_DESTROY_PENDING(TryReadGuard, LocalRegion::getStatistics); - bool m_statisticsEnabled = true; - auto& props = m_cacheImpl->getDistributedSystem().getSystemProperties(); - m_statisticsEnabled = props.statisticsEnabled(); - if (!m_statisticsEnabled) { + + if (!m_cacheImpl->getDistributedSystem() + .getSystemProperties() + .statisticsEnabled()) { throw StatisticsDisabledException( "LocalRegion::getStatistics statistics disabled for this region"); } diff --git a/cppcache/src/SystemProperties.cpp b/cppcache/src/SystemProperties.cpp index 9e86b01..3071634 100644 --- a/cppcache/src/SystemProperties.cpp +++ b/cppcache/src/SystemProperties.cpp @@ -88,7 +88,7 @@ constexpr auto DefaultConnectWaitTimeout = std::chrono::seconds::zero(); constexpr auto DefaultBucketWaitTimeout = std::chrono::seconds::zero(); constexpr auto DefaultSamplingInterval = std::chrono::seconds(1); -const bool DefaultSamplingEnabled = true; +constexpr bool DefaultSamplingEnabled = false; const char DefaultStatArchive[] = "statArchive.gfs"; const char DefaultLogFilename[] = ""; // stdout... diff --git a/defaultSystem/geode.properties b/defaultSystem/geode.properties index 15ee720..d415dd4 100644 --- a/defaultSystem/geode.properties +++ b/defaultSystem/geode.properties @@ -39,7 +39,7 @@ # # the rate is in seconds. #statistic-sample-rate=1 -#statistic-sampling-enabled=true +#statistic-sampling-enabled=false #statistic-archive-file=statArchive.gfs # zero indicates use no limit. #archive-file-size-limit=0 diff --git a/docs/geode-native-docs-cpp/configuring/sysprops.html.md.erb b/docs/geode-native-docs-cpp/configuring/sysprops.html.md.erb index c9314f5..0dd7198 100644 --- a/docs/geode-native-docs-cpp/configuring/sysprops.html.md.erb +++ b/docs/geode-native-docs-cpp/configuring/sysprops.html.md.erb @@ -186,7 +186,7 @@ When the chunk handler is not operative (enable-chunk-handler=false), each appli <tr class="odd"> <td>statistic-sampling-enabled</td> <td>Controls whether the process creates a statistic archive file.</td> -<td>true</td> +<td>false</td> </tr> <tr class="even"> <td>statistic-archive-file</td>