Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-1684

Mongodump: Don't create or .Close() the SessionProvider if one is already provided

    • Type: Icon: Task Task
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.4.4
    • Component/s: mongodump

      I would like mongodump to allow a SessionProvider to be passed-in similar to how mongorestore has done it. Currently a SessionProvider is created within mongodump and closed at the end.

      This PR moves to supporting an explicit SessionProvider, if not the old logic (backwards-compatible) is used.

      PR: https://github.com/mongodb/mongo-tools/pull/84

      PR Description:

      In this (merged) commit mongodump.MongoDump now exposes the field 'SessionProvider': 5ae956b#diff-ba031cdd7da2cf37217b3529bc49a3da, however if you provide one, the .Init() function will overwrite it.
      
      This commit moves to making this logic conditional, ie: if SessionProvider is defined then we DO NOT overwrite it, similar to 'OutputWriter'. There is also a boolean flag to disabled the deferred .Close() on the SessionProvider if the session provider was provided from outside.
      
      EDIT: if it's cleaner, I could always just move the SessionProvider code up to https://github.com/mongodb/mongo-tools/blob/master/mongodump/main/mongodump.go, like mongorestore has done - passing the provider 'in' instead of creating it. No preference
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            tvaillancourt Tim Vaillancourt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: