Skip to content

MVStoreTool -dump throws a NullPointerException or returns binary data #3931

@vreuland

Description

@vreuland

I am creating this ticket to fix the two small issues I had with MVStoreTool (-dump) when investigating another issue (cf. #3909 (comment))

There are instead 2 small bugs in the MVStoreTool when it tries to dump a database (where some chunks were dropped and space re-used):

  1. If one of the read block starts with a 'c', the tool will try to parse it as a chunk header. It can happen that this is not the start of a chunk: Chunks are not always contiguous (due to chunk compaction/move/drop and space re-use) and blocks following a chunk can therefore contain something else than a valid chunk header. In previous versions (2.1.214), the parsing of such a block would throw a MVStoreException and that exception would be caught by the tool (the tool would then simply move to the next block). In latest version (2.2.224), the exception is not there anymore and a null is returned, leading to a NullPointerException further down:
Exception in thread "main" java.lang.NullPointerException
	at org.h2.mvstore.DataUtils.parseMap(DataUtils.java:804)
	at org.h2.mvstore.Chunk.<init>(Chunk.java:171)
	at org.h2.mvstore.SFChunk.<init>(SFChunk.java:26)
	at org.h2.mvstore.MVStoreTool.dump(MVStoreTool.java:151)
	at org.h2.mvstore.MVStoreTool.main(MVStoreTool.java:57)
  1. Similar issue is observed with blocks starting with an "H". The tool thinks that this is a file header (even though the two file headers have already been read at the beginning of the file) and start outputting binary stuff... This bug was already present in previous versions I think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions