Skip to content

feat: 8841: Need a way to change the number of object key buckets in MerkleDb #18910

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

Merged
merged 14 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from 11 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
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public class V059HintsSchema extends Schema {
private static final SemanticVersion VERSION =
SemanticVersion.newBuilder().minor(59).build();

private static final long MAX_HINTS = 1L << 31;
private static final long MAX_PREPROCESSING_VOTES = 1L << 31;
private static final long MAX_HINTS = 1L << 10;
private static final long MAX_PREPROCESSING_VOTES = 1L << 10;

public static final String HINTS_KEY_SETS_KEY = "HINTS_KEY_SETS";
public static final String ACTIVE_HINT_CONSTRUCTION_KEY = "ACTIVE_HINT_CONSTRUCTION";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class V060HintsSchema extends Schema {
public static final String CRS_PUBLICATIONS_KEY = "CRS_PUBLICATIONS";
private static final Logger log = LogManager.getLogger(V060HintsSchema.class);

private static final long MAX_CRS_PUBLICATIONS = 1L << 31;
private static final long MAX_CRS_PUBLICATIONS = 1L << 10;

private final HintsContext signingContext;
private final HintsLibrary library;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ void setUp() {
final var hederaConfig = mock(HederaConfig.class);
lenient().when(config.getConfigData(HederaConfig.class)).thenReturn(hederaConfig);
final var merkleDbConfig = mock(MerkleDbConfig.class);
lenient().when(merkleDbConfig.goodAverageBucketEntryCount()).thenReturn(32);
lenient().when(merkleDbConfig.longListChunkSize()).thenReturn(1024);
lenient().when(merkleDbConfig.maxNumOfKeys()).thenReturn(1000L);
lenient().when(config.getConfigData(MerkleDbConfig.class)).thenReturn(merkleDbConfig);
final var virtualMapConfig = mock(VirtualMapConfig.class);
lenient().when(config.getConfigData(VirtualMapConfig.class)).thenReturn(virtualMapConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class V0490ConsensusSchema extends Schema {
private static final SemanticVersion VERSION =
SemanticVersion.newBuilder().major(0).minor(49).patch(0).build();

private static final long MAX_TOPICS = 1_000_000_000L;
private static final long MAX_TOPICS = 1_000_000L;

/**
* Constructor for this schema.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class V0490FileSchema extends Schema {
* A hint to the database system of the maximum number of files we will store. This MUST NOT BE CHANGED. If it is
* changed, then the database has to be rebuilt.
*/
private static final int MAX_FILES_HINT = 50_000_000;
private static final int MAX_FILES_HINT = 50_000;
/**
* The version of the schema.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
* General schema for the schedule service.
*/
public final class V0490ScheduleSchema extends Schema {
private static final long MAX_SCHEDULES_BY_ID_KEY = 50_000_000L;
private static final long MAX_SCHEDULES_BY_EXPIRY_SEC_KEY = 50_000_000L;
private static final long MAX_SCHEDULES_BY_EQUALITY = 50_000_000L;
private static final long MAX_SCHEDULES_BY_ID_KEY = 50_000L;
private static final long MAX_SCHEDULES_BY_EXPIRY_SEC_KEY = 50_000L;
private static final long MAX_SCHEDULES_BY_EQUALITY = 50_000L;
/**
* The version of the schema.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
public final class V0570ScheduleSchema extends Schema {
private static final Logger log = LogManager.getLogger(V0570ScheduleSchema.class);

private static final long MAX_SCHEDULED_COUNTS = 50_000_000L;
private static final long MAX_SCHEDULED_ORDERS = 50_000_000L;
private static final long MAX_SCHEDULED_USAGES = 50_000_000L;
private static final long MAX_SCHEDULE_ID_BY_EQUALITY = 50_000_000L;
private static final long MAX_SCHEDULED_COUNTS = 50_000L;
private static final long MAX_SCHEDULED_ORDERS = 50_000L;
private static final long MAX_SCHEDULED_USAGES = 50_000L;
private static final long MAX_SCHEDULE_ID_BY_EQUALITY = 50_000L;
private static final SemanticVersion VERSION =
SemanticVersion.newBuilder().major(0).minor(57).patch(0).build();
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
* for both the contract storage and bytecode.
*/
public class V0490ContractSchema extends Schema {
private static final int MAX_BYTECODES = 50_000_000;
private static final int MAX_STORAGE_ENTRIES = 1_000_000_000;
private static final int MAX_BYTECODES = 50_000;
private static final int MAX_STORAGE_ENTRIES = 1_000_000;
private static final SemanticVersion VERSION =
SemanticVersion.newBuilder().major(0).minor(49).patch(0).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
* Initial mod-service schema for the token service.
*/
public class V0490TokenSchema extends Schema {
// These need to be big so databases are created at right scale. If they are too small then the on disk hash map
// buckets will be too full which results in very poor performance. Have chosen 10 billion as should give us
// plenty of runway.
private static final long MAX_STAKING_INFOS = 1_000_000L;
private static final long MAX_TOKENS = 1_000_000_000L;
private static final long MAX_ACCOUNTS = 1_000_000_000L;
private static final long MAX_TOKEN_RELS = 1_000_000_000L;
private static final long MAX_MINTABLE_NFTS = 1_000_000_000L;

// Initial virtual map capacity values. Previously these values had to be large enough to avoid
// key hash collisions at the database level, which would result in low performance. With the
// new feature of dynamic hash map resizing in the database, these capacity hints can be kept
// low. These are just hints for initial virtual map sizes. Over time the maps will be able to
// contain more elements, if needed
private static final long MAX_STAKING_INFOS = 1_000L;
private static final long MAX_TOKENS = 1_000_000L;
private static final long MAX_ACCOUNTS = 1_000_000L;
private static final long MAX_TOKEN_RELS = 1_000_000L;
private static final long MAX_MINTABLE_NFTS = 1_000_000L;
private static final SemanticVersion VERSION =
SemanticVersion.newBuilder().major(0).minor(49).patch(0).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class V0530TokenSchema extends Schema {
private static final Logger logger = LogManager.getLogger(V0530TokenSchema.class);
private static final long MAX_PENDING_AIRDROPS = 1_000_000_000L;
private static final long MAX_PENDING_AIRDROPS = 1_000_000L;
public static final String AIRDROPS_KEY = "PENDING_AIRDROPS";

private static final SemanticVersion VERSION =
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading