Hi Thomas,
Ok for you?
Regards,
Fred
2015-03-11 14:02 GMT-03:00 Thomas Mueller <[email protected]>:
> Hi,
>
> I think that "metrics" is a good name. Can I proceed with this?
>>
>
> OK, let's use "metrics".
>
>
>> If yes, which columns we will add, I thought in the following columns:
>>
>> store.unsavedMemory
>> store.fileStore.writeBytes
>> store.fileStore.readBytes
>> store.fileStore.writeCount
>> store.fileStore.readCount
>> store.fileStore.size
>> store.cache.usedMemory
>> store.cache.hits
>> store.cache.misses
>> store.chunkCache.usedMemory
>> store.chunkCache.hits
>> store.chunkCache.misses
>>
>
> I guess in this case we could drop the prefix "store.", and possibly
> change "fileStore" to "file". The term "chunkCache" is misleading (it's not
> a cache of chunks), I think "chunkRefCache" would be better, as it's a
> cache of references to chunks.
>
> Regards,
> Thomas
>
>
>>
>> As writeBytes and readBytes will be included in the new table, maybe
>> would be better remove info.FILE_WRITE and info.FILE_READ from settings
>> meta table.
>>
>> Regards,
>>
>> Fred
>> 2015-03-11 4:45 GMT-03:00 Thomas Mueller <[email protected]>:
>>
>>> Hi,
>>>
>>> I'm OK to use a new table name.
>>>
>>> I'm not sure what is the best name for this table. Most of the data is
>>> "raw", so it's not really statistics just yet. Sure, it can be used to
>>> generate statistics. Maybe "metrics"? What do other databases or storage
>>> systems use for this case?
>>>
>>> Regards,
>>> Thomas
>>>
>>>
>>>
>>> On Tuesday, March 10, 2015, Fred&Dani&Pandora&Aquiles <[email protected]>
>>> wrote:
>>>
>>>> Hi Thomas,
>>>>
>>>> That sounds like a good idea! On the API side, I would probably make it
>>>>> a key-value list, by extending the existing
>>>>> table information_schema.settings. Otherwise the table will get a *lot* of
>>>>> columns if we add other data. Of course, the problem of a key-value list
>>>>> is
>>>>> that the datatype for both keys and values is varchar, which is not needed
>>>>> here. But I don't think that's a big problem (right?).
>>>>>
>>>>>
>>>> I agree with you, as more informations are needed, more columns will be
>>>> added.
>>>>
>>>>
>>>>> Part of that info is already there, see for example "info.FILE_WRITE"
>>>>> in MetaTable.java
>>>>>
>>>>> What about using the following keys:
>>>>>
>>>>> store.unsavedMemory
>>>>> store.fileStore.writeBytes
>>>>> store.fileStore.readBytes
>>>>> store.fileStore.writeCount
>>>>> store.fileStore.readCount
>>>>> store.fileStore.size
>>>>> store.cache.usedMemory
>>>>> store.cache.hits
>>>>> store.cache.misses
>>>>> store.chunkCache.usedMemory
>>>>> store.chunkCache.hits
>>>>> store.chunkCache.misses
>>>>>
>>>>
>>>> I'm not sure if the meta table Setting is the best place to put this
>>>> stats. I can't see some I/O informations as database settings. IMHO, this
>>>> could 'pollute' the table with not necessarily related informations. What
>>>> you think about in create a separated meta table database_statistics and
>>>> put all related informations in key-value format?
>>>>
>>>> Regards,
>>>>
>>>> Fred
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "H2 Database" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/h2-database.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "H2 Database" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/h2-database.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "H2 Database" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/h2-database.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.
# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /home/fred/NetBeansProjects/h2-trunk/trunk/h2/src/main/org/h2
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: mvstore/MVStore.java
--- mvstore/MVStore.java Base (BASE)
+++ mvstore/MVStore.java Modificado Localmente (Baseado em LOCAL)
@@ -2553,6 +2553,15 @@
}
/**
+ * Get the chunk ref cache.
+ *
+ * @return the cache
+ */
+ public CacheLongKeyLIRS<PageChildren> getCacheChunkRef() {
+ return cacheChunkRef;
+ }
+
+ /**
* A background writer thread to automatically store changes from time to
* time.
*/
Index: table/MetaTable.java
--- table/MetaTable.java Base (BASE)
+++ table/MetaTable.java Modificado Localmente (Baseado em LOCAL)
@@ -43,6 +43,7 @@
import org.h2.jdbc.JdbcSQLException;
import org.h2.message.DbException;
import org.h2.mvstore.FileStore;
+import org.h2.mvstore.MVStore;
import org.h2.mvstore.db.MVTableEngine.Store;
import org.h2.result.Row;
import org.h2.result.SearchRow;
@@ -108,7 +109,8 @@
private static final int LOCKS = 26;
private static final int SESSION_STATE = 27;
private static final int QUERY_STATISTICS = 28;
- private static final int META_TABLE_TYPE_COUNT = QUERY_STATISTICS + 1;
+ private static final int METRICS = 29;
+ private static final int META_TABLE_TYPE_COUNT = METRICS + 1;
private final int type;
private final int indexColumn;
@@ -537,6 +539,10 @@
);
break;
}
+ case METRICS:
+ setObjectName("METRICS");
+ cols = createColumns("NAME", "VALUE");
+ break;
default:
throw DbException.throwInternalError("type="+type);
}
@@ -946,44 +952,17 @@
if (database.isPersistent()) {
PageStore store = database.getPageStore();
if (store != null) {
- add(rows, "info.FILE_WRITE_TOTAL",
- "" + store.getWriteCountTotal());
- add(rows, "info.FILE_WRITE",
- "" + store.getWriteCount());
- add(rows, "info.FILE_READ",
- "" + store.getReadCount());
- add(rows, "info.PAGE_COUNT",
- "" + store.getPageCount());
- add(rows, "info.PAGE_SIZE",
+ add(rows, "PAGE_SIZE",
"" + store.getPageSize());
- add(rows, "info.CACHE_MAX_SIZE",
+ add(rows, "CACHE_MAX_SIZE",
"" + store.getCache().getMaxMemory());
- add(rows, "info.CACHE_SIZE",
- "" + store.getCache().getMemory());
}
Store mvStore = database.getMvStore();
if (mvStore != null) {
- FileStore fs = mvStore.getStore().getFileStore();
- add(rows, "info.FILE_WRITE", "" +
- fs.getWriteCount());
- add(rows, "info.FILE_READ", "" +
- fs.getReadCount());
- long size;
- try {
- size = fs.getFile().size();
- } catch (IOException e) {
- throw DbException.convertIOException(e, "Can not get size");
- }
- int pageSize = 4 * 1024;
- long pageCount = size / pageSize;
- add(rows, "info.PAGE_COUNT", "" +
- pageCount);
- add(rows, "info.PAGE_SIZE", "" +
- pageSize);
- add(rows, "info.CACHE_MAX_SIZE", "" +
+ add(rows, "PAGE_SIZE", "" +
+ 4 * 1024);
+ add(rows, "CACHE_MAX_SIZE", "" +
mvStore.getStore().getCacheSize());
- add(rows, "info.CACHE_SIZE", "" +
- mvStore.getStore().getCacheSizeUsed());
}
}
break;
@@ -1807,6 +1786,62 @@
}
break;
}
+ case METRICS: {
+ if (database.isPersistent()) {
+ PageStore store = database.getPageStore();
+ if (store != null) {
+ add(rows, "FILE_WRITE_TOTAL_COUNT",
+ "" + store.getWriteCountTotal());
+ add(rows, "FILE_WRITE_COUNT",
+ "" + store.getWriteCount());
+ add(rows, "FILE_READ_COUNT",
+ "" + store.getReadCount());
+ add(rows, "PAGE_COUNT",
+ "" + store.getPageCount());
+ add(rows, "CACHE_SIZE_KB",
+ "" + store.getCache().getMemory());
+ }
+
+ Store store2 = database.getMvStore();
+ if (store2 != null){
+ MVStore mvStore = store2.getStore();
+ FileStore fs = mvStore.getFileStore();
+ add(rows, "UNSAVED_MEMORY_BYTES",
+ "" + mvStore.getUnsavedMemory());
+ add(rows, "FILE_WRITE_COUNT", "" +
+ fs.getWriteCount());
+ add(rows, "FILE_READ_COUNT", "" +
+ fs.getReadCount());
+ add(rows, "FILE_WRITE_BYTES", "" +
+ fs.getWriteCount());
+ add(rows, "FILE_READ_BYTES", "" +
+ fs.getReadBytes());
+ long size;
+ try {
+ size = fs.getFile().size();
+ } catch (IOException e) {
+ throw DbException.convertIOException(e, "Can not get size");
+ }
+ int pageSize = 4 * 1024;
+ long pageCount = size / pageSize;
+ add(rows, "PAGE_COUNT", "" +
+ pageCount);
+ add(rows, "CACHE_SIZE_MB", "" +
+ mvStore.getCacheSizeUsed());
+ add(rows, "CACHE_HITS", "" +
+ mvStore.getCache().getHits());
+ add(rows, "CACHE_MISSES", "" +
+ mvStore.getCache().getMisses());
+ add(rows, "CHUNK_REF_CACHE_SIZE_MB", "" +
+ mvStore.getCacheChunkRef().getUsedMemory());
+ add(rows, "CHUNK_REF_CACHE_HITS", "" +
+ mvStore.getCacheChunkRef().getHits());
+ add(rows, "CHUNK_REF_CACHE_MISSES", "" +
+ mvStore.getCacheChunkRef().getMisses());
+ }
+ }
+ break;
+ }
default:
DbException.throwInternalError("type="+type);
}