tkalkirill commented on code in PR #7374:
URL: https://github.com/apache/ignite-3/pull/7374#discussion_r2675237161
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryDataRegion.java:
##########
@@ -516,4 +508,21 @@ private long allocatedPageCountOnDisk(int tableId, int
partitionId) {
return store == null ? 0 : store.pages();
}
+
+ @Override
+ public long regionSize() {
+ var dataRegionConfigView = (PersistentPageMemoryProfileView)
cfg.value();
+
+ long sizeBytes = dataRegionConfigView.sizeBytes();
+ if (sizeBytes == UNSPECIFIED_SIZE) {
+ sizeBytes = StorageEngine.defaultDataRegionSize();
+
+ LOG.info(
Review Comment:
Logging is unnecessary here; these methods will be used in metrics.
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/PersistentPageMemoryStorageEngine.java:
##########
@@ -389,6 +389,13 @@ private void
addDataRegion(PersistentPageMemoryProfileConfiguration storageProfi
regions.put(storageProfileConfiguration.name().value(), dataRegion);
}
+ @Override
+ public long requiredOffHeapMemorySize() {
Review Comment:
Since the methods will be used in metrics, when the configuration changes,
they will show new data, which may cause confusion for users.
##########
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/RocksDbStorageEngine.java:
##########
@@ -250,6 +250,13 @@ public void destroyMvTable(int tableId) {
}
}
+ @Override
+ public long requiredOffHeapMemorySize() {
Review Comment:
Since the methods will be used in metrics, when the configuration changes,
they will show new data, which may cause confusion for users.
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryDataRegion.java:
##########
@@ -192,4 +184,26 @@ private void checkDataRegionStarted() {
throw new StorageException("Data region not started");
}
}
+
+ @Override
+ public long regionSize() {
+ return maxSize(cfg);
+ }
+
+ private static long maxSize(VolatilePageMemoryProfileConfiguration cfg) {
+ var cfgView = (VolatilePageMemoryProfileView) cfg.value();
+
+ long maxSize = cfgView.maxSizeBytes();
+
+ if (maxSize == UNSPECIFIED_SIZE) {
+ maxSize = StorageEngine.defaultDataRegionSize();
+
+ LOG.info(
Review Comment:
Logging is unnecessary here; these methods will be used in metrics.
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/DataRegion.java:
##########
@@ -25,4 +25,11 @@ public interface DataRegion<T extends PageMemory> {
* Returns page memory.
*/
T pageMemory();
+
+ /**
+ * Returns the region size in bytes.
+ */
+ default long regionSize() {
Review Comment:
I would suggest introducing an interface that extends the current one with a
new method, judging by the implementation it will return the size from the
configuration and not the one actually used, as I would expect.
##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/VolatilePageMemoryStorageEngine.java:
##########
@@ -188,6 +188,13 @@ public void destroyMvTable(int tableId) {
// No-op.
}
+ @Override
+ public long requiredOffHeapMemorySize() {
Review Comment:
Since the methods will be used in metrics, when the configuration changes,
they will show new data, which may cause confusion for users.
--
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]