Changeset 5893


Ignore:
Timestamp:
Nov 28, 2011, 8:26:23 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1630: Migrate from MySQL to PostgreSQL

Made it possible to configure some options in the base.config file (need to write documentation!). Seems like the option to gzip the files is not performing so good. The compression is slower than reading from the database so it takes longer time to export. Ok, we save a lot of disk space, but the total time might be more important for the big production server.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Migration.java

    r5891 r5893  
    123123      session = HibernateUtil.newSession();
    124124      tx = HibernateUtil.newTransaction(session);
    125       HibernateUtil.doJdbcWork(session, new Migration(true, destination, session, progress));
     125      Migration exporter = new Migration(true, destination, session, progress);
     126      exporter.setExportCompressed(Values.getBoolean(Config.getString("migrate.export.compress"), false));
     127      HibernateUtil.doJdbcWork(session, exporter);
    126128      HibernateUtil.commit(tx);
    127129      tx = null;
     
    162164      session = HibernateUtil.newSession(c);
    163165      tx = HibernateUtil.newTransaction(session);
    164       HibernateUtil.doJdbcWork(session, new Migration(false, destination, session, progress));
     166      Migration importer = new Migration(false, destination, session, progress);
     167      importer.setAnalyzeAfterImport(Values.getBoolean(Config.getString("migrate.import.analyze"),
     168        HibernateUtil.getDbEngine().analyzeAfterBatchOperation()));
     169      importer.setDropPrimaryKeyBeforeImport(Values.getBoolean(Config.getString("migrate.import.drop-primary-key"), true));
     170      importer.setDropConstraintsBeforeImport(Values.getBoolean(Config.getString("migrate.import.drop-constraints"), true));
     171      HibernateUtil.doJdbcWork(session, importer);
    165172      HibernateUtil.commit(tx);
    166173      tx = null;
     
    195202    this.dateFormat = new DateFormatter("yyyy-MM-dd");
    196203    this.dateTimeFormat = new DateFormatter("yyyy-MM-dd HH:mm:ss");
    197     this.exportCompressed = true;
     204    this.exportCompressed = false;
    198205    this.dropPrimaryKeyBeforeImport = true;
    199206    this.dropConstraintsBeforeImport = true;
Note: See TracChangeset for help on using the changeset viewer.