Skip to content
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

Support old binary formats. #1899

Closed
andrii0lomakin opened this issue Dec 18, 2013 · 109 comments
Closed

Support old binary formats. #1899

andrii0lomakin opened this issue Dec 18, 2013 · 109 comments
Assignees
Milestone

Comments

@andrii0lomakin
Copy link
Member

To support old binary formats we can use following approach:

  1. Read storage configuration.
  2. If storage configuration version is different from latest, look at list of migration scripts which will be used to migrate db data.
  3. Perform migration automatically, with ability to track migration progress using listeners.

Subtasks:

  • Integration of component version concept into storage components
  • OMigration interface
  • Migrator implementation
  • API and console command for upgrade task
  • API and console command that show version of binary data structure
  • Automatic tests for testing backward compatibility
  • Add compatibility for
    • 1.5.0
    • 1.5.1
    • 1.5.2
    • 1.6.0
    • 1.6.1
    • 1.6.2
    • 1.6.3
  • Implement upgrade tasks for:
    • 1.5.0
    • 1.5.1
    • 1.5.2
    • 1.6.0
    • 1.6.1
    • 1.6.2
    • 1.6.3
@andrii0lomakin
Copy link
Member Author

May be it is not the best way. Too long time for migration. It is possible to use sometimes but in very rare cases.
But we can preserve old versions of clusters and indexes.
We can do it as in before mentioned approach using storage configuration number.

So for for each binary format change we change configuration number and use old clusters and index versions if needed.
Also with warning that used data structures out of dated.

Also we can provide migration tool that can be run pragmatically to migrate db versions without opening them.

@jamieb22
Copy link

Test scripts should be implemented to test that a new version of Orient has the ability to read/write and upgrade old database formats. These test scripts should be incorporated into the Orient build process to ensure that successive versions are backwards compatible.

@andrii0lomakin
Copy link
Member Author

@jamieb22 +1 ).

@ghost ghost assigned andrii0lomakin Jan 20, 2014
@lvca
Copy link
Member

lvca commented Jan 21, 2014

This will begin on January 24th.

@jamieb22
Copy link

jamieb22 commented Feb 8, 2014

Luca

Please may I have status update on this project.

So far, Orient DB is causing instability to our platform. The database
simply gets corrupted.

I am hoping an upgrade will resolve the matter.

Regards

Jamie

On 2014/01/21, 2:41 PM, Luca Garulli wrote:

This will begin on January 24th.


Reply to this email directly or view it on GitHub
#1899 (comment).

@lvca
Copy link
Member

lvca commented Feb 8, 2014

Hi Jamie,
we already started this after a analysis phase to understand all the impacts of it (not 100% of the internal structured had a version number). Andrey and Artem could update better on this.

@andrii0lomakin
Copy link
Member Author

Hi Jamie,
We would be appreciate if you send us of sample of your database so we will be sure that we provided all means to make possible migration of your data.

@jamieb22
Copy link

Please download the file orientdb.zip from sftp site
enterprise:fl0w3r@mailarchiva.com

On 2014/02/10, 7:22 PM, Andrey Lomakin wrote:

Hi Jamie,
We would be appreciate if you send us of sample of your database so we
will be sure that we provided all means to make possible migration of
your data.


Reply to this email directly or view it on GitHub
#1899 (comment).

@enisher
Copy link
Contributor

enisher commented Feb 14, 2014

Thanks @jamieb22!

We expect to finish compatibility with 1.5.1 in the middle of the next week.

@jamieb22
Copy link

Great... I am hoping this effort will offer a permanent upgrade path for
subsequent releases too!

On 2014/02/14, 10:34 AM, Artem Orobets wrote:

Thanks @jamieb22 https://github.com/jamieb22!

We expect to finish compatibility with 1.5.1 in the middle of the next
week.


Reply to this email directly or view it on GitHub
#1899 (comment).

@jamieb22
Copy link

Middle of next week has arrived. Any update?

On 2014/02/14, 10:34 AM, Artem Orobets wrote:

Thanks @jamieb22 https://github.com/jamieb22!

We expect to finish compatibility with 1.5.1 in the middle of the next
week.


Reply to this email directly or view it on GitHub
#1899 (comment).

@lvca
Copy link
Member

lvca commented Feb 20, 2014

We've completed this issue at 90%, we need today to finish tests, maximum tomorrow.

@andrii0lomakin
Copy link
Member Author

Hi,
We have tried your database with new changes and we are able to open it.
But we need time to make stable.
Sorry for delay we are completing several tasks at the same time.

@jamieb22
Copy link

Thank you for the update and for your efforts. Please rather take your
time and make it very stable. We cannot afford to lose data.

On 2014/02/20, 11:36 AM, Andrey Lomakin wrote:

Hi,
We have tried your database with new changes and we are able to open it.
But we need time to make stable.
Sorry for delay we are completing several tasks at the same time.


Reply to this email directly or view it on GitHub
#1899 (comment).

@jamieb22
Copy link

Regarding the comment:

We expect to finish compatibility with 1.5.1 in the middle of the next
week.

Isn't the latest version of Orient DB 1.7? Will this upgrade script take
us up to the latest version?

@lvca
Copy link
Member

lvca commented Feb 20, 2014

This issue will be deployed on v. 1.7-rc2 we will release as soon as this issue is fixed. We'd like to ask you to make some tests against multiple "old" databases with 1.7-rc2-SNAPSHOT as soon as this issue is closed, to be sure to release a bug free version with 1.7-rc2.

WDYT?

andrii0lomakin added a commit that referenced this issue Feb 22, 2014
@andrii0lomakin
Copy link
Member Author

@jamieb22 Could you send me your database once again.

@jamieb22
Copy link

The sftp site is still active. You can download.

Andrey Lomakin notifications@github.com wrote:

@jamieb22 Could you send me your database once again.


Reply to this email directly or view it on GitHub:
#1899 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

@andrii0lomakin
Copy link
Member Author

I was asked for the password and can not login.

@jamieb22
Copy link

The credentials are as follows:

sftp mailarchiva.com
username: enteprise
password: fl0w3r

On 2014/02/24, 11:38 AM, Andrey Lomakin wrote:

I was asked for the password and can not login.


Reply to this email directly or view it on GitHub
#1899 (comment).

@andrii0lomakin
Copy link
Member Author

I have very good news.
I have opened your databases using 1.5.1 and exported it in JSON.
Then:

  1. Opened database using latest develop branch.
  2. Created new plocal database and did JSON import.
  3. Compared imported database and old one.

Got result "databases match".
Here is full console output https://gist.github.com/laa/2a387cbcc53326872fc7 .
I am creating automatic binary compatibility test, will commit and close issue.

Could you as @lvca proposed build database from latest sources and provide the same comparison procedure too ?
Also after db compare not before could you run upgrade graph command to use new version of graph database ?

Please note that rc2 is not released yet (we have several critical issues to fix) so we do not recommend to use it (yet) in production.

@jamieb22
Copy link

Andrey, that's great news. Thank you. May I ask whether your upgrade
procedure will automatically detect whether a database requires an
upgrade, and thereafter perform the upgrade automatically? We are not
using the OrientDB console. We are using straight API integration. Our
expectation is that when the embedded database is started, it will be
automatically upgraded. Is this correct? Thus, our test would be to get
the latest sources and start our server. In essence, all the records
should be visible from our GUI. I would appreciate your feedback.

On 2014/02/24, 1:39 PM, Andrey Lomakin wrote:

I have very good news.
I have opened your databases using 1.5.1 and exported it in JSON.
Then:

  1. Opened database using latest develop branch.
  2. Created new plocal database and did JSON import.
  3. Compared imported database and old one.

Got result "databases match".
Here is full console output
https://gist.github.com/laa/2a387cbcc53326872fc7 .
I am creating automatic binary compatibility test, will commit and
close issue.

Could you as @lvca https://github.com/lvca proposed build database
from latest sources and provide the same comparison procedure too ?
Also after db compare not before could you run upgrade graph command
to use new version of graph database ?

Please note that rc2 is not released yet (we have several critical
issues to fix) so we do not recommend to use it (yet).


Reply to this email directly or view it on GitHub
#1899 (comment).

@jamieb22
Copy link

Andrey... can this function also be used as a backup procedure. It would be nice to be able to use a JSON export function to backup the DB on occasion? Is the JSON export thread safe? Are you creating public API functions for upgrading, exporting, etc?

@jamieb22
Copy link

Don't forget to build in upgrade test in the Orient build scripts. If we do not do this, it is guaranteed that the upgrade will be broken at some point in time.

@andrii0lomakin
Copy link
Member Author

Hi,

  1. Database is not upgraded automatically it will take hours if we will go in this way, it is able to work with previous version of binary format till you will not upgrade it yourself, please note that it may take hours for upgrade if database is huge. We simple can not freeze everything if database is opened.
  2. Console is wrapper for database API, so any thing which you able to do in console you able to do in Java.
  3. You can do JSON backup but it means that database will be frozen for writes, JSON export is slow (that is why you need to do export to JSON and import from it manually) so you can do it, but what the point to do it in run time ? database freeze/release is much faster.

About binary compatibility test we were planing to include them from beginning, otherwise it will be unprofessional :-) .

Actually here is how this test will run:

  1. get list of tags and form list of all which have 2 latest middle versions. so if we have 1.5, 1.5.1, 1.6.1, 1.6.2, 1.7, 1.7.1 we will have to test all 1, 6 and 1.7 tags.
  2. Checkout latest version. run test-plocal task on this version. but do not delete test database and exported database (it will contain all existing data structures in very different combinations).
  3. checkout next tag and do db import and compare content of imported and original database.
  4. do the same with snapshot.

will do this on CI every night and because it is kind of tricky will be written on Gradle.

@jamieb22
Copy link

Is there a way to determine the current version of Orient in code? We
would obviously need to determine this, in order to assess whether an
upgrade is necessary?

Will latest version of Orient be able to read older formats without upgrade?

On 2014/02/25, 11:51 AM, Andrey Lomakin wrote:

Hi,

  1. Database is not upgraded automatically it will take hours if we
    will go in this way, it is able to work with previous version of
    binary format till you will not upgrade it yourself, please note that
    it may take hours for upgrade if database is huge. We simple can not
    freeze everything if database is opened.
  2. Console is wrapper for database API, so any thing which you able to
    do in console you able to do in Java.
  3. You can do JSON backup but it means that database will be frozen
    for writes, JSON export is slow (that is why you need to do export to
    JSON and import from it manually) so you can do it, but what the point
    to do it in run time ? database freeze/release is much faster.

About binary compatibility test we were planing to include them from
beginning, otherwise it will be unprofessional :-) .

Actually here is how this test will run:

  1. get list of tags and form list of all which have 2 latest middle
    versions. so if we have 1.5, 1.5.1, 1.6.1, 1.6.2, 1.7, 1.7.1 we will
    have to test all 1, 6 and 1.7 tags.
  2. Checkout latest version. run test-plocal task on this version. but
    do not delete test database and exported database (it will contain all
    existing data structures in very different combinations).
  3. checkout next tag and do db import and compare content of imported
    and original database.
  4. do the same with snapshot.

will do this on CI every night and because it is kind of tricky will
be written on Gradle.


Reply to this email directly or view it on GitHub
#1899 (comment).

@andrii0lomakin
Copy link
Member Author

Hi,

Will latest version of Orient be able to read older formats without upgrade?

That is how it works.

During development database binary format can be changed several times, reading of version is not usable but you can read binary format version it can be taken from com.orientechnologies.orient.core.db.record.OCurrentStorageComponentsFactory#binaryFormatVersion and com.orientechnologies.orient.core.storage.OStorage#getComponentsFactory .
Latest binary format version is here com.orientechnologies.orient.core.config.OStorageConfiguration#CURRENT_BINARY_FORMAT_VERSION.
Note that binary compatibility on design level is started from 1.7-rc2, but as exception for your needs we also support 1.5.1 version of local storage.

@andrii0lomakin
Copy link
Member Author

@valenpo yes you can use single name with .gz at the end.

@valenpo
Copy link

valenpo commented Mar 11, 2014

@Laa Andrey, I follow exactly same code for conversion, and cant confirm that conversion is working.
Old DB size is ~1GB new one after conversion is 1.4M
I trying convert this DB http://yadi.sk/d/gaOcvd0EKK4en. Archive is 189MB

@andrii0lomakin
Copy link
Member Author

@valenpo Yes, this is too small :-) I will try to convert it too.
What is you console output ? Did you try to compare databases ?

@valenpo
Copy link

valenpo commented Mar 11, 2014

I just run same conversion program as you provide.

мар 11, 2014 2:54:46 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'database.ocf' was not closed correctly last time
мар 11, 2014 2:54:46 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'default.0.oda' was not closed correctly last time
мар 11, 2014 2:54:46 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'default.odh' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'default.1.oda' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'index.0.oda' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'index.odh' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'internal.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'internal.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'index.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'index.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'manindex.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'manindex.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'default.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'default.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'orole.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'orole.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'ouser.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'ouser.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'ofunction.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'ofunction.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'oschedule.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'oschedule.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'orids.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'orids.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'v.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'v.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'e.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'e.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'user.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'user.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'folder.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'folder.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'item.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'item.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'thread.0.ocl' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'thread.och' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: segment file 'txlog.otx' was not closed correctly last time
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: Current implementation of storage does not support sbtree collections
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
INFO: Wait till indexes restore after crash was finished.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: Current implementation of storage does not support sbtree collections
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
INFO: Index USER_NAME is not automatic index and will be added as is.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
INFO: Index USER_NAME was added in DB index list.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
INFO: Index EMAIL is not automatic index and will be added as is.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
INFO: Index EMAIL was added in DB index list.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
INFO: Index USER_ROOT_ID is not automatic index and will be added as is.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
INFO: Index USER_ROOT_ID was added in DB index list.
мар 11, 2014 2:54:47 PM com.orientechnologies.common.log.OLogManager log
INFO: Start creation of index OUser.name
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index OUser.name was successfully created and rebuild is going to be started.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Rebuild of OUser.name index was successfully finished.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index dictionary is not automatic index and will be added as is.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index dictionary was added in DB index list.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index ID is not automatic index and will be added as is.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index ID was added in DB index list.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index OID is not automatic index and will be added as is.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index OID was added in DB index list.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Start creation of index ORole.name
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index ORole.name was successfully created and rebuild is going to be started.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Rebuild of ORole.name index was successfully finished.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index mgn is not automatic index and will be added as is.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Index mgn was added in DB index list.
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: 9 indexes were restored successfully, 0 errors
мар 11, 2014 2:54:48 PM com.orientechnologies.common.log.OLogManager log
INFO: Indexes restore after crash was finished.

Started export of database 'archiva.db' to /Library/Application Support/MailArchiva/ROOT/database/archiva.db.json.gz...

Exporting database info...
OK

Exporting clusters...
OK (15 clusters)

Exporting schema...
OK (14 classes)

Exporting records...

  • Cluster 'internal' (id=0)...
    OK (records=3/3)
  • Cluster 'index' (id=1)...
    OK (records=4/4)
  • Cluster 'manindex' (id=2)...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (records=2489/2489)
  • Cluster 'default' (id=3)...
    OK (records=0/0)
  • Cluster 'orole' (id=4)...
    OK (records=3/3)
  • Cluster 'ouser' (id=5)...
    OK (records=3/3)
  • Cluster 'ofunction' (id=6)...
    OK (records=0/0)
  • Cluster 'oschedule' (id=7)...
    OK (records=0/0)
  • Cluster 'orids' (id=8)...
    OK (records=0/0)
  • Cluster 'v' (id=9)...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (records=256952/256952)
  • Cluster 'e' (id=10)...
    OK (records=0/0)
  • Cluster 'user' (id=11)...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (records=137/137)
  • Cluster 'folder' (id=12)...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (records=3566/3566)
  • Cluster 'item' (id=13)...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (records=546636/546636)
  • Cluster 'thread' (id=14)...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (records=84041/84041)

Done. Exported 893834 of total 893834 records

Exporting index info...
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.

  • Index dictionary...
    OK
  • Index USER_NAME...
    OK
  • Index OUser.name...
    OK
  • Index EMAIL...
    OK
  • Index ID...
    OK
  • Index mgn...
    OK
  • Index ORole.name...
    OK
  • Index USER_ROOT_ID...
    OK
  • Index OID...
    OK

OK (9 indexes)

Exporting manual indexes content...
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 11, 2014 3:00:48 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.

  • Exporting index dictionary ...
    OK (entries=0)
  • Exporting index USER_NAME ...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (entries=137)
  • Exporting index EMAIL ...
    OK (entries=0)
  • Exporting index ID ...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (entries=136)
  • Exporting index mgn ...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (entries=253085)
  • Exporting index USER_ROOT_ID ...
    OK (entries=1)
  • Exporting index OID ...
    .
    .
    .
    .
    .
    .
    .
    .
    .
    .
    OK (entries=256811)

OK (7 manual indexes)

Database export completed in 404346ms

Started import of database 'plocal:/Library/Application Support/MailArchiva/ROOT/database/new.archiva.db' from /Library/Application Support/MailArchiva/ROOT/database/archiva.db.json.gz...

Non merge mode (-merge=false): removing all default non security classes

  • Class ORIDs was removed.
  • Class OFunction was removed.
  • Class ORestricted was removed.
  • Class OTriggered was removed.
  • Class OSchedule was removed.

Removed 5 classes.

Importing database info...
OK

Importing clusters...

  • Creating cluster 'internal'...
    OK, assigned id=0
  • Creating cluster 'default'...
    OK, assigned id=3
  • Creating cluster 'orole'...
    OK, assigned id=4
  • Creating cluster 'ouser'...
    OK, assigned id=5
  • Creating cluster 'ofunction'...
    OK, assigned id=6
  • Creating cluster 'oschedule'...
    OK, assigned id=7
  • Creating cluster 'orids'...
    OK, assigned id=8
  • Creating cluster 'v'...
    OK, assigned id=9
  • Creating cluster 'e'...
    OK, assigned id=10
  • Creating cluster 'user'...
    OK, assigned id=11
  • Creating cluster 'folder'...
    OK, assigned id=12
  • Creating cluster 'item'...
    OK, assigned id=13
  • Creating cluster 'thread'...
    OK, assigned id=14

Rebuilding indexes of truncated clusters ...

Cluster content was truncated and index ORole.name will be rebuilt

Index ORole.name was successfully rebuilt.

Cluster content was truncated and index OUser.name will be rebuilt

Index OUser.name was successfully rebuilt.

Done 2 indexes were rebuilt.

Done. Imported 13 clusters

Importing database schema...
OK (14 classes)

Importing records...

  • Importing records into cluster 'internal' (id=0): = 2 records
  • Importing records into cluster 'orole' (id=4): = 3 records
  • Importing records into cluster 'ouser' (id=5): = 3 records
  • Importing records into cluster 'v' (id=9): ......................... = 256952 records
  • Importing records into cluster 'user' (id=11): = 137 records
  • Importing records into cluster 'folder' (id=12): = 3566 records
  • Importing records into cluster 'item' (id=13): ...................................................... = 546636 records
  • Importing records into cluster 'thread' (id=14): ........ = 84040 records
  • Importing records into cluster 'thread' (id=14):
    Started migration of links (-migrateLinks=true). Links are going to be updated according to new RIDs:
  • Cluster default...
    Processed: 0
  • Cluster orole...
    Processed: 3
  • Cluster ouser...
    Processed: 3
  • Cluster ofunction...
    Processed: 0
  • Cluster oschedule...
    Processed: 0
  • Cluster orids...
    Processed: 0
  • Cluster v...

10000 documents were processed...

20000 documents were processed...

30000 documents were processed...

40000 documents were processed...

50000 documents were processed...

60000 documents were processed...

70000 documents were processed...

80000 documents were processed...

90000 documents were processed...

100000 documents were processed...

110000 documents were processed...

120000 documents were processed...

130000 documents were processed...

140000 documents were processed...

150000 documents were processed...

160000 documents were processed...

170000 documents were processed...

180000 documents were processed...

190000 documents were processed...

200000 documents were processed...

210000 documents were processed...

220000 documents were processed...

230000 documents were processed...

240000 documents were processed...

250000 documents were processed...
Processed: 256952

  • Cluster e...
    Processed: 0
  • Cluster user...
    Processed: 137
  • Cluster folder...
    Processed: 3566
  • Cluster item...

10000 documents were processed...

20000 documents were processed...

30000 documents were processed...

40000 documents were processed...

50000 documents were processed...

60000 documents were processed...

70000 documents were processed...

80000 documents were processed...

90000 documents were processed...

100000 documents were processed...

110000 documents were processed...

120000 documents were processed...

130000 documents were processed...

140000 documents were processed...

150000 documents were processed...

160000 documents were processed...

170000 documents were processed...

180000 documents were processed...

190000 documents were processed...

200000 documents were processed...

210000 documents were processed...

220000 documents were processed...

230000 documents were processed...

240000 documents were processed...

250000 documents were processed...

260000 documents were processed...

270000 documents were processed...

280000 documents were processed...

290000 documents were processed...

300000 documents were processed...

310000 documents were processed...

320000 documents were processed...

330000 documents were processed...

340000 documents were processed...

350000 documents were processed...

360000 documents were processed...

370000 documents were processed...

380000 documents were processed...

390000 documents were processed...

400000 documents were processed...

410000 documents were processed...

420000 documents were processed...

430000 documents were processed...

440000 documents were processed...

450000 documents were processed...

460000 documents were processed...

470000 documents were processed...

480000 documents were processed...

490000 documents were processed...

500000 documents were processed...

510000 documents were processed...

520000 documents were processed...

530000 documents were processed...

540000 documents were processed...
Processed: 546636

  • Cluster thread...

10000 documents were processed...

20000 documents were processed...

30000 documents were processed...

40000 documents were processed...

50000 documents were processed...

60000 documents were processed...

70000 documents were processed...

80000 documents were processed...
Processed: 84041

Total links updated: 891338

Done. Imported 891339 records

Importing indexes ...

  • Index 'dictionary'...
    OK
  • Index 'USER_NAME'...
    OK
  • Index 'OUser.name'...
    OK
  • Index 'EMAIL'...
    OK
  • Index 'ID'...
    OK
  • Index 'mgn'...
    OK
  • Index 'ORole.name'...
    OK
  • Index 'USER_ROOT_ID'...
    OK
  • Index 'OID'...
    OK

Done. Created 9 indexes.

Importing manual index entries...

  • Index 'dictionary'...
    OK (0 entries)
  • Index 'USER_NAME'...
    OK (137 entries)
  • Index 'EMAIL'...
    OK (0 entries)
  • Index 'ID'...
    OK (136 entries)
  • Index 'mgn'...
    Error on database import happened just before line 0, column 658852613
    java.lang.NullPointerException
    at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importManualIndexes(ODatabaseImport.java:360)
    at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importDatabase(ODatabaseImport.java:199)
    at com.stimulus.archiva.database.blueprints.TestCaseDB.main(TestCaseDB.java:51)
    Exception in thread "main" com.orientechnologies.orient.core.db.tool.ODatabaseExportException: Error on importing database 'new.archiva.db' from file: /Library/Application Support/MailArchiva/ROOT/database/archiva.db.json.gz
    at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importDatabase(ODatabaseImport.java:217)
    at com.stimulus.archiva.database.blueprints.TestCaseDB.main(TestCaseDB.java:51)
    Caused by: java.lang.NullPointerException
    at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importManualIndexes(ODatabaseImport.java:360)
    at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importDatabase(ODatabaseImport.java:199)
    ... 1 more

@andrii0lomakin
Copy link
Member Author

:-) you did not close again )) but it is not the issue now, I am looking what is wrong with manual indexes import.

@valenpo
Copy link

valenpo commented Mar 11, 2014

nope, this DB (1.5.1) was closed correctly 100% via the graph.shutdown().

@valenpo
Copy link

valenpo commented Mar 11, 2014

Also FYI i see new converted DB is greater 2.4 times when old one. But I suppose it must be lesser, as snappy used.

Regards
Valentin

@andrii0lomakin
Copy link
Member Author

@valenpo the correct way is to shutdown JVM before database copy (does not matter embedded or server), call of shutdwon() method leads to connection close not storage close. You have invalid link in your manual index that is why you have NPE.
But I fixed this NPE any way, I will run tests and commit.

You have bigger database because it contains not only data but operations log too.

Also I have changed code a bit to provide better logging support.
So new code is:

final ODatabaseDocumentTx database = new ODatabaseDocumentTx("local:/home/andrey/Development/orientdb/archiva.db");
    database.open("admin", "admin");

    final ODatabaseExport databaseExport = new ODatabaseExport(database, "/home/andrey/Development/orientdb/archiva.db.json",
        new OCommandOutputListener() {
          @Override
          public void onMessage(String iText) {
            System.out.println(iText);
          }
        });

    databaseExport.exportDatabase();
    databaseExport.close();

    final ODatabaseDocumentTx newDatabase = new ODatabaseDocumentTx("plocal:/home/andrey/Development/orientdb/new.archiva.db");
    newDatabase.create();

    final ODatabaseImport databaseImport = new ODatabaseImport(newDatabase, "/home/andrey/Development/orientdb/archiva.db.json.gz",
        new OCommandOutputListener() {
          @Override
          public void onMessage(String iText) {
            System.out.println(iText);
          }
        });
    databaseImport.importDatabase();

    database.close();
    databaseImport.close();

    database.open("admin", "admin");

    OGraphMigration graphMigration = new OGraphMigration(newDatabase, new OCommandOutputListener() {
      @Override
      public void onMessage(String iText) {
        System.out.println(iText);
      }
    });

    graphMigration.execute();
    database.close(); 

@valenpo
Copy link

valenpo commented Mar 12, 2014

@Laa Andrey, morning FYI, I made some huge test till night, archiving 100 huge pst files with all structure of emails and folders, I can see about 100 pst root folders on tree view (this is stored on DB). After server restart with correct close (graph.shutdown()) I can see ~32 root folders, so 2/3 are lost. Those are E connections from ROOT vertex to USER vertex.

Also same DB with local are 4 times smaller (1GB local vs 4.4GB plocal). I assume that plocal use some compression?

I can provide generated DB and access to testing platform.

Making test can take alot of time, as alot of business logic involved, and I think better to see it on real environment
Regards
Valentin

@andrii0lomakin
Copy link
Member Author

@valenpo I mentioned several times before here #1899 (comment) and here #1899 (comment), that graph.shutdown() is not correct way to close storage. Could you confirm that you close storage by closing JVM, not only by calling graph.shutdown() ?

@valenpo
Copy link

valenpo commented Mar 12, 2014

@Laa yes, JVM is closed via standard Tomcat scripts.

@andrii0lomakin
Copy link
Member Author

@valenpo when you open db do you see message
"WARNING: segment file '...' was not closed correctly last time"

Do you see files with .wal extension into the closed database ?

@valenpo
Copy link

valenpo commented Mar 12, 2014

Andrey, logs are behind. Libraries are used on Tomcat instance, so tomcat start up normally as shutdown too.

I shutdown tomcat when the server perform no actions … Right now I see no one record. Should I upgrade to night build and test it again?

2014-03-12 15:34:36.788 WARN - Cannot find default script language for javascript
2014-03-12 15:34:36.879 WARN - segment file 'database.ocf' was not closed correctly last time
2014-03-12 15:34:37.043 WARN - Can not restore 1 WAL master record for storage archiva.db
2014-03-12 15:34:37.162 WARN - Storage archiva.db was not closed properly. Will try to restore from write ahead log.
2014-03-12 15:34:37.162 INFO - Looking for last checkpoint...
2014-03-12 15:34:37.162 INFO - Checkpoints are absent, the restore will start from the beginning.
2014-03-12 15:34:37.162 INFO - Date restore procedure is started.
2014-03-12 15:34:37.185 ERROR - Exception during storage data restore.
com.orientechnologies.orient.core.exception.OStorageException: File with id 3 does not exist.
at com.orientechnologies.orient.core.index.hashindex.local.cache.OWOWCache.openFile(OWOWCache.java:200)
at com.orientechnologies.orient.core.index.hashindex.local.cache.OReadWriteDiskCache.openFile(OReadWriteDiskCache.java:125)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.restoreFrom(OLocalPaginatedStorage.java:502)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.restoreFromBegging(OLocalPaginatedStorage.java:468)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.restoreFromWAL(OLocalPaginatedStorage.java:307)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.restoreIfNeeded(OLocalPaginatedStorage.java:274)
at com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.open(OLocalPaginatedStorage.java:256)
at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.open(ODatabaseRaw.java:101)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:54)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.open(ODatabaseRecordAbstract.java:131)
at com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:54)
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:878)
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.(OrientBaseGraph.java:103)
at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.(OrientTransactionalGraph.java:58)
at com.tinkerpop.blueprints.impls.orient.OrientTransactionalGraph.(OrientTransactionalGraph.java:54)
at com.tinkerpop.blueprints.impls.orient.OrientGraph.(OrientGraph.java:34)
at com.stimulus.archiva.database.blueprints.BluePrintDatabase.initGraph(BluePrintDatabase.java:95)
at com.stimulus.archiva.database.blueprints.BluePrintDatabase.connect(BluePrintDatabase.java:145)
at com.stimulus.archiva.database.DatabaseService.startup(DatabaseService.java:168)
at com.stimulus.archiva.domain.Services.startStop(Services.java:75)
at com.stimulus.archiva.domain.Services.startAll(Services.java:58)
at com.stimulus.archiva.domain.Application.startup(Application.java:625)
at com.stimulus.archiva.domain.Applications.startupApps(Applications.java:267)
at com.stimulus.archiva.domain.Applications.startup(Applications.java:250)
at com.stimulus.archiva.plugin.Startup.init(Startup.java:61)
at com.stimulus.archiva.security.MailArchivaSecurityFilter.init(MailArchivaSecurityFilter.java:46)
at com.stimulus.archiva.security.MailArchivaSecurityFilter.init(MailArchivaSecurityFilter.java:111)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5309)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1673)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
2014-03-12 15:34:37.186 INFO - Storage data restore was completed
2014-03-12 15:34:37.239 ERROR - Database's schema is empty! Recreating the system classes and allow the opening of the database but double check the integrity of the database
2014-03-12 15:34:37.520 INFO - SMTP server *:8091 starting
2014-03-12 15:34:37.522 INFO - SMTP server *:8091 started
2014-03-12 15:35:14.782 INFO - Successfully connected to vm:broker:(tcp://localhost:61617)?persistent=false&useJmx=false

@jamieb22
Copy link

Andrey

Our server always shutdown clearly. We have spent many hours making sure
that the JVM will exit cleanly. In any case, even if the server did not
shutdown cleanly, it seems like a huge amount of records to lose. What
happens if there is a powercut?

Jamie

On 2014/03/12, 12:42 PM, Andrey Lomakin wrote:

@valenpo https://github.com/valenpo I mentioned this several times
before, that graph.shutdown() is not correct way to close storage.
Could you confirm that you close storage by closing JVM, not only by
calling graph.shutdown() ?


Reply to this email directly or view it on GitHub
#1899 (comment).

@andrii0lomakin
Copy link
Member Author

@valenpo @jamieb22
I see message
"WARN - Storage archiva.db was not closed properly. Will try to restore from write ahead log."

Which means that storage was not closed correctly. And I have seen this message in all instances of db which you send to us.
So it seems like your issues with records lost were not related to local or plocal storage implementations.
But to the fact that even during Tomcat grace full shutdown storage was not closed correctly.
That is what we need to solve, about records lost, you lost not records but manual indexes content because by default they work in rollback only mode, I will provide settings to make possible to restore manual index records too.

So first step which we need to do is put following code in ServletContextListener.html#contextDestroyed method (implementation of interface of course).

Orient.isntance().shutdown();

And check whether we see given warning again, and check data presence.
Could you do this ?

@valenpo
Copy link

valenpo commented Mar 12, 2014

@OverRide
public void contextDestroyed(ServletContextEvent event) {
Orient.instance().shutdown();
}

done, so hope right now it will shutdown correct.

@valenpo
Copy link

valenpo commented Mar 12, 2014

@Laa Andrey, thank for clue. After that hook Orient.isntance().shutdown(); it looks DB started fine after server restart. I see all records.

Thanks

Regards
Valentin

@andrii0lomakin
Copy link
Member Author

Ok.
The only issue that needs to be fixed to have full durability support is this one #1761 could you arrange it's schedule with @lvca . I have written above that I will provide you settings to restore indexes but this issue is only partially fixed. And of course at the beginning of the change we have no idea that you use manual indexes it is so rare case. BTW can you replace them by automatic indexes ? they are faster than manual indexes.

@valenpo
Copy link

valenpo commented Mar 12, 2014

ok, I think we could change it to auto index. We use manual from 0.9 version of orient because it provide more control with query request. Also we don't need index all fields of V and E. What docs can you suggest to read about index conversion to auto?

Regards,
Valentin

@andrii0lomakin
Copy link
Member Author

It is quite simple
You can read about them here
https://github.com/orientechnologies/orientdb/wiki/Indexes

On Wed, Mar 12, 2014 at 5:01 PM, valenpo notifications@github.com wrote:

ok, I think we could change it to auto index. We use manual from 0.9
version of orient because it provide more control with query request. Also
we don't need index all fields of V and E. What docs can you suggest to
read about index conversion to auto?

Regards,
Valentin


Reply to this email directly or view it on GitHubhttps://github.com//issues/1899#issuecomment-37418490
.

Best regards,
Andrey Lomakin.

Orient Technologies
the Company behind OrientDB

@lvca lvca removed the In progress label Mar 24, 2014
@valenpo
Copy link

valenpo commented Mar 25, 2014

Executing such code
dbLocationPath = "/Library/Application Support/MailArchiva/ROOT/database/archiva.db";
String exportFile = "/Library/Application Support/MailArchiva/ROOT/database/export.json.gz";
String dbLocationPathOld = "/Library/Application Support/MailArchiva/ROOT/database/oldarchiva.db";

    final ODatabaseDocumentTx database = new ODatabaseDocumentTx("local:"+dbLocation);
    database.open("admin", "admin");

    final ODatabaseExport databaseExport = new ODatabaseExport(database, exportFile.getAbsolutePath(), new OCommandOutputListener() {
        @Override
        public void onMessage(String arg0) {
            System.out.println("export db: "+arg0);
        }
    });
    databaseExport.exportDatabase();
    databaseExport.close();

    final ODatabaseDocumentTx newDatabase = new ODatabaseDocumentTx("plocal:"+dbLocationPath);
    newDatabase.create();


    ODatabaseImport databaseImport;
    try (FileInputStream fis = new FileInputStream(exportFile)) {
        databaseImport = new ODatabaseImport(newDatabase, fis, new OCommandOutputListener() {
            @Override
            public void onMessage(String arg0) {
                System.out.println("importing db: "+arg0);
            }
        });
    };

    databaseImport.importDatabase();

    database.close();
    databaseImport.close();

    database.open("admin", "admin");

    OGraphMigration graphMigration = new OGraphMigration(newDatabase, new OCommandOutputListener() {
        @Override
        public void onMessage(String message) {
            System.out.println("database migrating process: "+message);
        }
    });

    graphMigration.execute();
    database.close();
    newDatabase.close();

throw exceptions
Exception in thread "main" com.orientechnologies.orient.core.exception.OQueryParsingException: Error on parsing query
Query: V
------^
at com.orientechnologies.orient.core.sql.filter.OSQLTarget.(OSQLTarget.java:70)
at com.orientechnologies.orient.core.sql.OSQLEngine.parseTarget(OSQLEngine.java:396)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.parse(OCommandExecutorSQLSelect.java:331)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.parse(OCommandExecutorSQLSelect.java:67)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:49)
at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:33)
at com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:83)
at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:69)
at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:82)
at com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:29)
at com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.query(ODatabaseRecordAbstract.java:698)
at com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.query(ODatabaseRecordWrapperAbstract.java:192)
at com.orientechnologies.orient.graph.migration.OGraphMigration.execute(OGraphMigration.java:43)
at com.stimulus.archiva.database.blueprints.DBSchemaConvert.migrateDB(DBSchemaConvert.java:99)
at com.stimulus.archiva.database.blueprints.DBSchemaConvert.main(DBSchemaConvert.java:42)
Caused by: com.orientechnologies.orient.core.exception.OCommandExecutionException: Class 'V' was not found in current database
at com.orientechnologies.orient.core.sql.filter.OSQLTarget.extractTargets(OSQLTarget.java:174)
at com.orientechnologies.orient.core.sql.filter.OSQLTarget.(OSQLTarget.java:61)
... 14 more

Database are very small, so can give for test http://yadi.sk/d/gaOcvd0EKK4en 19Kb

@andrii0lomakin
Copy link
Member Author

It means that nothing was imported.
What is your output during import ?

On Tue, Mar 25, 2014 at 3:30 PM, valenpo notifications@github.com wrote:

Executing such code
dbLocationPath = "/Library/Application
Support/MailArchiva/ROOT/database/archiva.db";
String exportFile = "/Library/Application
Support/MailArchiva/ROOT/database/export.json.gz";
String dbLocationPathOld = "/Library/Application
Support/MailArchiva/ROOT/database/oldarchiva.db";

final ODatabaseDocumentTx database = new ODatabaseDocumentTx("local:"+dbLocation);
database.open("admin", "admin");

final ODatabaseExport databaseExport = new ODatabaseExport(database, exportFile.getAbsolutePath(), new OCommandOutputListener() {
    @Override
    public void onMessage(String arg0) {
        System.out.println("export db: "+arg0);
    }
});
databaseExport.exportDatabase();
databaseExport.close();

final ODatabaseDocumentTx newDatabase = new ODatabaseDocumentTx("plocal:"+dbLocationPath);
newDatabase.create();


ODatabaseImport databaseImport;
try (FileInputStream fis = new FileInputStream(exportFile)) {
    databaseImport = new ODatabaseImport(newDatabase, fis, new OCommandOutputListener() {
        @Override
        public void onMessage(String arg0) {
            System.out.println("importing db: "+arg0);
        }
    });
};

databaseImport.importDatabase();

database.close();
databaseImport.close();

database.open("admin", "admin");

OGraphMigration graphMigration = new OGraphMigration(newDatabase, new OCommandOutputListener() {
    @Override
    public void onMessage(String message) {
        System.out.println("database migrating process: "+message);
    }
});

graphMigration.execute();
database.close();
newDatabase.close();

throw exceptions
Exception in thread "main"
com.orientechnologies.orient.core.exception.OQueryParsingException: Error
on parsing query
Query: V
------^
at
com.orientechnologies.orient.core.sql.filter.OSQLTarget.(OSQLTarget.java:70)
at
com.orientechnologies.orient.core.sql.OSQLEngine.parseTarget(OSQLEngine.java:396)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.parse(OCommandExecutorSQLSelect.java:331)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.parse(OCommandExecutorSQLSelect.java:67)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:49)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:33)
at
com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:83)
at
com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:69)
at
com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:82)
at
com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:29)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.query(ODatabaseRecordAbstract.java:698)
at
com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.query(ODatabaseRecordWrapperAbstract.java:192)
at
com.orientechnologies.orient.graph.migration.OGraphMigration.execute(OGraphMigration.java:43)
at
com.stimulus.archiva.database.blueprints.DBSchemaConvert.migrateDB(DBSchemaConvert.java:99)
at
com.stimulus.archiva.database.blueprints.DBSchemaConvert.main(DBSchemaConvert.java:42)
Caused by:
com.orientechnologies.orient.core.exception.OCommandExecutionException:
Class 'V' was not found in current database
at
com.orientechnologies.orient.core.sql.filter.OSQLTarget.extractTargets(OSQLTarget.java:174)
at
com.orientechnologies.orient.core.sql.filter.OSQLTarget.(OSQLTarget.java:61)
... 14 more

Database are very small, so can give for test
http://yadi.sk/d/gaOcvd0EKK4en 19Kb


Reply to this email directly or view it on GitHubhttps://github.com//issues/1899#issuecomment-38563778
.

Best regards,
Andrey Lomakin.

Orient Technologies
the Company behind OrientDB

@valenpo
Copy link

valenpo commented Mar 25, 2014

мар 25, 2014 5:23:37 PM com.orientechnologies.common.log.OLogManager log
WARNING: Current implementation of storage does not support sbtree collections
мар 25, 2014 5:23:38 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 25, 2014 5:23:38 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 25, 2014 5:23:38 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 25, 2014 5:23:38 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 25, 2014 5:23:38 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
export db:
Started export of database 'oldarchiva.db' to /Library/Application Support/MailArchiva/ROOT/database/export.json.gz...
export db:
Exporting database info...
export db: OK
export db:
Exporting clusters...
export db: OK (14 clusters)
export db:
Exporting schema...
export db: OK (13 classes)
export db:
Exporting records...
export db:

  • Cluster 'internal' (id=0)...
    export db: OK (records=3/3)
    export db:
  • Cluster 'index' (id=1)...
    export db: OK (records=4/4)
    export db:
  • Cluster 'manindex' (id=2)...
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: OK (records=12/12)
    export db:
  • Cluster 'default' (id=3)...
    export db: OK (records=0/0)
    export db:
  • Cluster 'orole' (id=4)...
    export db: OK (records=3/3)
    export db:
  • Cluster 'ouser' (id=5)...
    export db: OK (records=3/3)
    export db:
  • Cluster 'ofunction' (id=6)...
    export db: OK (records=0/0)
    export db:
  • Cluster 'oschedule' (id=7)...
    export db: OK (records=0/0)
    export db:
  • Cluster 'orids' (id=8)...
    export db: OK (records=0/0)
    export db:
  • Cluster 'v' (id=9)...
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: OK (records=395/395)
    export db:
  • Cluster 'e' (id=10)...
    export db: OK (records=0/0)
    export db:
  • Cluster 'user' (id=11)...
    export db: OK (records=1/1)
    export db:
  • Cluster 'folder' (id=12)...
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: OK (records=15/15)
    export db:
  • Cluster 'item' (id=13)...
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: OK (records=378/378)
    export db:

Done. Exported 814 of total 814 records

export db:
Exporting index info...
мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
export db:

  • Index dictionary...
    export db: OK
    export db:
  • Index USER_NAME...
    export db: OK
    export db:
  • Index OUser.name...
    export db: OK
    export db:
  • Index EMAIL...
    export db: OK
    export db:
  • Index ID...
    export db: OK
    export db:
  • Index ORole.name...
    export db: OK
    export db:
  • Index USER_ROOT_ID...
    export db: OK
    export db:
  • Index OID...
    export db: OK
    export db:
    OK (8 indexes)
    export db:
    Exporting manual indexes content...
    мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
    WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
    мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
    WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
    мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
    WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
    мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
    WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
    мар 25, 2014 5:23:50 PM com.orientechnologies.common.log.OLogManager log
    WARNING: Index was created using MVRBTREESET as values container. This container is deprecated and is not supported any more. To avoid this message please drop and recreate indexes or perform DB export/import.
    export db:
  • Exporting index dictionary ...
    export db: OK (entries=0)
    export db:
  • Exporting index USER_NAME ...
    export db: OK (entries=1)
    export db:
  • Exporting index EMAIL ...
    export db: OK (entries=0)
    export db:
  • Exporting index ID ...
    export db: OK (entries=1)
    export db:
  • Exporting index USER_ROOT_ID ...
    export db: OK (entries=1)
    export db:
  • Exporting index OID ...
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: .
    export db: OK (entries=393)
    export db:
    OK (6 manual indexes)
    export db:

Database export completed in 916ms
importing db:
Started import of database 'plocal:/Library/Application Support/MailArchiva/ROOT/database/archiva.db' from streaming.json...
importing db:
Non merge mode (-merge=false): removing all default non security classes
importing db:

  • Class OFunction was removed.
    importing db:
  • Class ORIDs was removed.
    importing db:
  • Class ORestricted was removed.
    importing db:
  • Class OSchedule was removed.
    importing db:
  • Class OTriggered was removed.
    importing db:
    Removed 5 classes.
    importing db:
    Rebuild of stale indexes...
    importing db:
    Start rebuild index ouser.name
    importing db:
    Rebuild of index ouser.name is completed.
    importing db:
    Start rebuild index orole.name
    importing db:
    Rebuild of index orole.name is completed.
    importing db:
    Stale indexes were rebuilt...
    importing db:
    Deleting RID Mapping table...
    importing db: OK

importing db:

Database import completed in 130 ms

@andrii0lomakin
Copy link
Member Author

So nothing is imported.
Because you provided wrong file path "from streaming.json" instead of "
export.json.gz".

I suggest you pay attention to log output it would allow to identify db
problems (for example we discussed issue that your database not correctly
closed for days despite of fact that it was reflect in log).

On Tue, Mar 25, 2014 at 3:39 PM, valenpo notifications@github.com wrote:

Database export completed in 916ms
importing db:
Started import of database 'plocal:/Library/Application
Support/MailArchiva/ROOT/database/archiva.db' from streaming.json...
importing db:
Non merge mode (-merge=false): removing all default non security classes
importing db:

  • Class OFunction was removed. importing db:
  • Class ORIDs was removed. importing db:
  • Class ORestricted was removed. importing db:
  • Class OSchedule was removed. importing db:
  • Class OTriggered was removed. importing db: Removed 5 classes.
    importing db: Rebuild of stale indexes... importing db: Start rebuild index
    ouser.name importing db: Rebuild of index ouser.name is completed.
    importing db: Start rebuild index orole.name importing db: Rebuild of
    index orole.name is completed. importing db: Stale indexes were
    rebuilt... importing db: Deleting RID Mapping table... importing db: OK

importing db:

Database import completed in 130 ms

Best regards,
Andrey Lomakin.

Orient Technologies
the Company behind OrientDB

@valenpo
Copy link

valenpo commented Mar 25, 2014

Andrey, such logging give nothing. I tested import code, here you see used fileinputstream, and correct input stream are provided.

I just follow you recommendation of export import.

ODatabaseImport databaseImport;
try (FileInputStream fis = new FileInputStream(exportFile)) {
databaseImport = new ODatabaseImport(newDatabase, fis, new OCommandOutputListener() {
@OverRide
public void onMessage(String arg0) {
System.out.println("importing db: "+arg0);
}
});
};

where file for export and import are same, checked it via debugger.
-rw-r--r-- 1 valenpo admin 43K 25 мар 17:48 export.json.gz
/Library/Application Support/MailArchiva/ROOT/database/export.json.gz

And such file exist, other case i will throw exception (filenotfound) etc ...

@valenpo
Copy link

valenpo commented Mar 25, 2014

I checked it with String, and it work. So maybe some problems with InputStream

@andrii0lomakin
Copy link
Member Author

Good.

On Tue, Mar 25, 2014 at 4:03 PM, valenpo notifications@github.com wrote:

I checked it with String, and it work. So maybe some problems with
InputStream


Reply to this email directly or view it on GitHubhttps://github.com//issues/1899#issuecomment-38567397
.

Best regards,
Andrey Lomakin.

Orient Technologies
the Company behind OrientDB

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants