devmadhuu commented on code in PR #10492:
URL: https://github.com/apache/ozone/pull/10492#discussion_r3394928475


##########
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/persistence/TestUnhealthyContainersDerbyPerformance.java:
##########
@@ -220,43 +216,85 @@ public class TestUnhealthyContainersDerbyPerformance {
   // One-time setup: create Derby schema + insert 1 M records
   // -----------------------------------------------------------------------
 
+  private String inMemoryDbName;
+
   /**
-   * Initialises the embedded Derby database and creates the Recon schema.
+   * Initialises the embedded in-memory Derby database and creates the Recon 
schema.
    * Data population is done in dedicated test methods.
    *
-   * <p>The {@code @TempDir} is injected as a <em>method parameter</em> rather
-   * than a class field.  With {@code @TestInstance(PER_CLASS)}, a field-level
-   * {@code @TempDir} is populated by JUnit's {@code TempDirExtension} in its
-   * own {@code beforeAll} callback, which may run <em>after</em> the user's
-   * {@code @BeforeAll} — leaving it null when needed here.  A method
-   * parameter is resolved by JUnit before the method body executes.</p>
-   *
-   * <h3>Performance settings applied here</h3>
-   * <ul>
-   *   <li><b>Page cache</b> ({@code derby.storage.pageCacheSize = 20000}):
-   *       ~80 MB of 4-KB B-tree pages resident in heap — covers the hot path
-   *       for index scans on a 1-M-row table even with the file-based
-   *       driver.</li>
-   * </ul>
+   * <p>Uses {@code jdbc:derby:memory:...} to keep all 1M rows in RAM and 
eliminate
+   * disk I/O (fsync) overhead across the benchmark's insert, replace, and 
delete
+   * transactions.</p>
    */
   @BeforeAll
-  public void setUpDatabase(@TempDir Path tempDir) throws Exception {
+  public void setUpDatabase() throws Exception {
+    inMemoryDbName = "reconPerf_" + java.util.UUID.randomUUID().toString();
     LOG.info("=== Derby Performance Benchmark — Setup ===");
     LOG.info("Dataset: {} states × {} container IDs = {} total records",
         TESTED_STATES.size(), CONTAINER_ID_RANGE, TOTAL_RECORDS);
 
-    // Derby engine property — must be set before the first connection.
-    //
-    // pageCacheSize: number of 4-KB pages Derby keeps in its buffer pool.
-    //   Default = 1,000 pages (4 MB) — far too small for a 1-M-row table.
-    //   20,000 pages = ~80 MB, enough to hold the full B-tree for both the
-    //   primary-key index and the composite (state, container_id) index.
-    System.setProperty("derby.storage.pageCacheSize", "20000");
-
     // ----- Guice wiring (mirrors AbstractReconSqlDBTest) -----
-    File configDir = Files.createDirectory(tempDir.resolve("Config")).toFile();
-    Provider<DataSourceConfiguration> configProvider =
-        new DerbyDataSourceConfigurationProvider(configDir);
+    Provider<DataSourceConfiguration> configProvider = () -> new 
DataSourceConfiguration() {

Review Comment:
   can you check if this below whole block can be reused from 
`AbstractReconSqlDBTest.DerbyDataSourceConfigurationProvider` instead of 
rewriting here ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to