Opened 9 years ago

Closed 9 years ago

Last modified 3 years ago

#666 closed optimization (implemented)

support streamed ascii-save

Reported by: westram Owned by: westram
Priority: normal Milestone: arb7.0
Component: Library (DB) Version:
Keywords: Cc: cquast@…

Description (last modified by westram)

Motivation:

  • reduce memory usage when saving database from silva pipeline

Implement interface object ArbDBwriter which allows to modify database during save providing the following methods:

  • startSaveAs / finishSave
  • saveFromTill(GBDATA*start,GBDATA*end)

Reimplement

GB_ERROR GB_MAIN_TYPE::save_as(const char *as_path, const char *savetype) {
    ArbDBwriter writer(this);
    GB_ERROR error = write.startSaveAs(as_path,savetype);
    if (!error) error = writer.saveFromTill(root_container,root_container);
    if (!error) error = writer.finishSave();
    return error;
}

Intended use:

GBDATA *storeNextSpecies(GBDATA *gb_species_container, GB_ERROR *error) {
    assert(!*error);
    GB_transaction ta(gb_species_container);
    GBDATA *gb_species = ...; 
    return gb_species;
}

    // ...
    ArbDBwriter writer(gb_main);
    GB_ERROR error = write.startSaveAs("xxx.arb", "a");
    GBDATA *gb_species_data = ...; 
    if (!error) error = writer.saveFromTill(gb_main,gb_species_data);
    if (!error) {
        for (GBDATA *gb_species = storeNextSpecies(&error); 
             gb_species && !error;
             gb_species = storeNextSpecies(&error)) 
        {
             error = writer.saveFromTill(gb_species,gb_species);
             if (error) break;
             {
                 GB_transaction ta(gb_main);
                 error = GB_delete(gb_species);
             }
             if (error) break;
        }
    }
    if (!error) error = writer.saveFromTill(gb_species_data,gb_main);
    if (!error) error = writer.finishSave();  

Change History (6)

comment:1 Changed 9 years ago by westram

promising ticket number ;-)

comment:2 Changed 9 years ago by westram

  • Description modified (diff)
  • Status changed from new to accepted

comment:3 Changed 9 years ago by westram

  • Status changed from accepted to _started

comment:4 Changed 9 years ago by westram

  • Resolution set to implemented
  • Status changed from _started to closed

by [14577]

@Chris:

  • Interface for streamed ascii save is here.
  • Example test code is here.
    It basically does what we've discussed:
    • save until species container
    • foreach (of 2) species
      • create species
      • stream-save it
      • delete species
    • save rest of database
  • New flags to request compressed save are available and documented here (#665).
Last edited 9 years ago by westram (previous) (diff)

comment:5 Changed 9 years ago by westram

  • Milestone set to arb6.1

mark changes that got fixed after arb 6.0.x

comment:6 Changed 3 years ago by westram

  • Milestone changed from arb6.1 to arb7.0

Milestone renamed

Note: See TracTickets for help on using tickets.