orientechnologies / orientdb

OrientDB is the most versatile DBMS supporting Graph, Document, Reactive, Full-Text and Geospatial models in one Multi-Model product. OrientDB can run distributed (Multi-Master), supports SQL, ACID Transactions, Full-Text indexing and Reactive Queries.
https://orientdb.dev
Apache License 2.0
4.75k stars 871 forks source link

How to read a WAL file outside OrientDB ? #10355

Open Nulhiedbriks opened 1 week ago

Nulhiedbriks commented 1 week ago

OrientDB Version: 3.2.26

After a crash server, Database is corrupt because of the UNIQUE index. I can't do anything whit this corrupt index. Some vertices are shown duplicated while there is an index and when i tried to delete one RID both are deleted. Some vertices are also here but cannot be display. (Invalid type null) error.

I've rebuild the db with a backup, but there is missing data (or updated data) that are surely in WAL file. When i put the WAL file in the new DB folder, nothing is done (WAL file is reset). I want to analyse what's inside the WAL file to add manually missing data. So how can i open/read a WAL file ?

tglman commented 2 days ago

Hi,

Is not easy to read the WAL file by hand, in there are present different set of records that describe different behaviours, if you want to check the types of records that we have just check everything that implements OWALRecord in the OrientDB codebase.

In the specific the data is kept in OUpdatePageRecord which is not the high level data but the binary diff changes of a transactional update of a single page of a single file, in the record itself there is also a "sequential" that identify the transaction, the same sequential is kept in the pages to verify what's the level of a persistent page compared to the changes in the WAL.

All the types of files, indexes, data, metadata use this type of WAL record to log the changes and recover them in case of crash.

I'm not sure actually how you can get to this state in the first place, did the crash happen during a version update or did happen with the same OrientDB version of the code running ?