diff options
author | Wisdom Omuya <deafgoat@gmail.com> | 2015-06-17 13:55:31 -0400 |
---|---|---|
committer | Wisdom Omuya <deafgoat@gmail.com> | 2015-06-22 11:49:30 -0400 |
commit | 0eeb63144b045c70858975ad58352aebd578c86c (patch) | |
tree | c4e128296426b564aed19768beedff44766f3020 /mongodump | |
parent | bec13deda88acf4c904abf20604d173611db10aa (diff) | |
download | mongo-0eeb63144b045c70858975ad58352aebd578c86c.tar.gz |
TOOLS-792: update mongodump log message for archives
Diffstat (limited to 'mongodump')
-rw-r--r-- | mongodump/mongodump.go | 16 | ||||
-rw-r--r-- | mongodump/prepare.go | 8 |
2 files changed, 17 insertions, 7 deletions
diff --git a/mongodump/mongodump.go b/mongodump/mongodump.go index 1e548022405..c69d8d3df9a 100644 --- a/mongodump/mongodump.go +++ b/mongodump/mongodump.go @@ -440,14 +440,24 @@ func (dump *MongoDump) DumpIntent(intent *intents.Intent) error { return dump.dumpQueryToWriter(findQuery, intent) } + // set where the intent will be written to + intent.Location = intent.BSONPath + if dump.OutputOptions.Archive != "" { + if dump.OutputOptions.Archive == "-" { + intent.Location = "archive on stdout" + } else { + intent.Location = fmt.Sprintf("archive '%v'", dump.OutputOptions.Archive) + } + } + if !dump.OutputOptions.Repair { - log.Logf(log.Always, "writing %v to %v", intent.Namespace(), intent.BSONPath) + log.Logf(log.Always, "writing %v to %v", intent.Namespace(), intent.Location) if err = dump.dumpQueryToWriter(findQuery, intent); err != nil { return err } } else { // handle repairs as a special case, since we cannot count them - log.Logf(log.Always, "writing repair of %v to %v", intent.Namespace(), intent.BSONPath) + log.Logf(log.Always, "writing repair of %v to %v", intent.Namespace(), intent.Location) repairIter := session.DB(intent.DB).C(intent.C).Repair() repairCounter := progress.NewCounter(1) // this counter is ignored if err := dump.dumpIterToWriter(repairIter, intent.BSONFile, repairCounter); err != nil { @@ -457,7 +467,7 @@ func (dump *MongoDump) DumpIntent(intent *intents.Intent) error { "\trepair cursor found %v documents in %v", repairCounter, intent.Namespace()) } - // don't dump metatdata for SystemIndexes collection + // don't dump metadata for SystemIndexes collection if intent.IsSystemIndexes() { return nil } diff --git a/mongodump/prepare.go b/mongodump/prepare.go index de3379ae9bf..24530a7f57c 100644 --- a/mongodump/prepare.go +++ b/mongodump/prepare.go @@ -126,7 +126,7 @@ func (f atomicFlusher) Write(buf []byte) (int, error) { return f.availableWriteFlusher.Write(buf) } -// realMetadataFile impelemnts intent.file, and corresponds to a Metadata file on disk +// realMetadataFile implements intent.file, and corresponds to a Metadata file on disk type realMetadataFile struct { io.WriteCloser errorReader @@ -140,11 +140,11 @@ type realMetadataFile struct { // If compression is needed, the File gets wrapped in a gzip.Writer func (f *realMetadataFile) Open() (err error) { if f.intent.MetadataPath == "" { - return fmt.Errorf("No MetadataPath for %v.%v", f.intent.DB, f.intent.C) + return fmt.Errorf("No metadata path for %v.%v", f.intent.DB, f.intent.C) } err = os.MkdirAll(filepath.Dir(f.intent.MetadataPath), os.ModeDir|os.ModePerm) if err != nil { - return fmt.Errorf("error creating directory for Metadata file %v: %v", + return fmt.Errorf("error creating directory for metadata file %v: %v", filepath.Dir(f.intent.MetadataPath), err) } @@ -154,7 +154,7 @@ func (f *realMetadataFile) Open() (err error) { } f.WriteCloser, err = os.Create(fileName) if err != nil { - return fmt.Errorf("error creating Metadata file %v: %v", fileName, err) + return fmt.Errorf("error creating metadata file %v: %v", fileName, err) } if f.gzip { f.WriteCloser = &wrappedWriteCloser{ |