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

Add way to manually flush buffer for mongoimport

    • Type: Icon: New Feature New Feature
    • Resolution: Won't Fix
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: mongoimport
    • Labels:
    • Not Needed

      When mongoimport reads from stdin, SIGINT (^C) terminates without flushing any outstanding data in the write buffer. So the user must do one of these to gracefully shut down and flush the buffer:

      • Indicate an EOF (^D) to the terminal
      • Manually close the pipe / file descriptor that's associated with stdin
      • Use a command structure that automatically closes the pipe (e.g. cat out.json | mongoimport ...)

      If mongoimport is run in the background as a daemon, the user doesn't have many good ways to manually flush the buffer from a scripting standpoint.

      We can consider trapping SIGUSR1 to flush the buffer before passing control to the SIGINT logic. We can also potentially flush when we see SIGINT, but that might require a bit of investigation on whether that'll affect UX.

            Unassigned Unassigned
            evgeni.dobranov@mongodb.com Evgeni Dobranov
            1 Vote for this issue
            4 Start watching this issue