Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ignored index memory configuration #818

Merged
merged 3 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions herddb-core/src/main/java/herddb/core/DBManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ public Thread newThread(final Runnable r) {
ServerConfiguration.PROPERTY_MAX_INDEX_MEMORY_PERCENTAGE_DEFAULT);

if (maxIndexUsedMemoryPercentage <= 0.0D) {
maxIndexUsedMemoryPercentage = ServerConfiguration.PROPERTY_MAX_DATA_MEMORY_PERCENTAGE_DEFAULT;
maxIndexUsedMemoryPercentage = ServerConfiguration.PROPERTY_MAX_INDEX_MEMORY_PERCENTAGE_DEFAULT;
}

this.maxPKUsedMemoryPercentage = configuration.getDouble(
Expand Down Expand Up @@ -471,7 +471,7 @@ public void start() throws DataStorageManagerException, LogNotAvailableException
/ ((double) (maxDataUsedMemory + maxIndexUsedMemory + maxPKUsedMemory)) * maxMemoryReference);

maxDataUsedMemory = data;
maxIndexUsedMemory = data;
maxIndexUsedMemory = index;
maxPKUsedMemory = pk;
}

Expand Down
2 changes: 1 addition & 1 deletion herddb-core/src/main/java/herddb/core/TableManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ private FlushNewPageResult flushNewPage(DataPage page, DataPage spareDataPage) {
/*
* NewPages removal technically could be done before current write lock but
* doing it in lock permit to check safely if a page has been removed. Without
* lock we can't known if no page has been removed because already removed by a
* lock we can't know if no page has been removed because already removed by a
* concurrent thread or because it wasn't present in the first place.
*/
/* Set the new page as a fully active page */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,15 @@ public class ChangeRoleTest extends MultiServerBase {

@Test
public void testChangeRoleAndReleaseMemory() throws Exception {
ServerConfiguration serverconfig_1 = newServerConfigurationWithAutoPort(folder.newFolder().toPath());
serverconfig_1.set(ServerConfiguration.PROPERTY_NODEID, "server1");
serverconfig_1.set(ServerConfiguration.PROPERTY_MODE, ServerConfiguration.PROPERTY_MODE_CLUSTER);
serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, testEnv.getAddress());
serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_PATH, testEnv.getPath());
serverconfig_1.set(ServerConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT, testEnv.getTimeout());
serverconfig_1.set(ServerConfiguration.PROPERTY_ENFORCE_LEADERSHIP, false);
serverconfig_1.set(ServerConfiguration.PROPERTY_BOOKKEEPER_MAX_IDLE_TIME, 0); // disabled
ServerConfiguration serverconfig_1 = newServerConfigurationWithAutoPort(folder.newFolder().toPath())
.set(ServerConfiguration.PROPERTY_NODEID, "server1")
.set(ServerConfiguration.PROPERTY_MODE, ServerConfiguration.PROPERTY_MODE_CLUSTER)
.set(ServerConfiguration.PROPERTY_ZOOKEEPER_ADDRESS, testEnv.getAddress())
.set(ServerConfiguration.PROPERTY_ZOOKEEPER_PATH, testEnv.getPath())
.set(ServerConfiguration.PROPERTY_ZOOKEEPER_SESSIONTIMEOUT, testEnv.getTimeout())
.set(ServerConfiguration.PROPERTY_ENFORCE_LEADERSHIP, false)
.set(ServerConfiguration.PROPERTY_BOOKKEEPER_MAX_IDLE_TIME, 0) // disabled
.set(ServerConfiguration.PROPERTY_MAX_INDEX_MEMORY_PERCENTAGE, 0.2);

ServerConfiguration serverconfig_2 = serverconfig_1
.copy()
Expand Down
4 changes: 3 additions & 1 deletion herddb-core/src/test/java/herddb/core/BigTableScanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package herddb.core;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import herddb.codec.RecordSerializer;
import herddb.core.stats.TableManagerStats;
import herddb.mem.MemoryCommitLogManager;
Expand Down Expand Up @@ -80,7 +81,8 @@ public void bigTableScan() throws Exception {

TableManagerStats stats = manager.getTableSpaceManager(table.tablespace).getTableManager(table.name).getStats();
assertEquals(testSize, stats.getTablesize());
assertEquals(2, stats.getLoadedpages());
// More than a page loaded
assertTrue(stats.getLoadedpages() >= 2);

manager.checkpoint();

Expand Down
Loading