Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-32061

INTO OUTFILE should work with named pipes

Details

    Description

      It would be really great if MariaDB's "INTO OUTFILE" feature could write into a named pipe. That would allow me to compress its output on the fly when I do backups, rather than writing the enormous uncompressed file first and then compressing it. It would save a lot of disk space and time.

      Attachments

        Activity

          I have applied this solution:
          https://bugs.gentoo.org/529574
          to MariaDB 10.11.5 and it works very well! Essentially it just declines to fail if the existing file specified in the SQL command is a named pipe.

          xan@biblionix.com Xan Charbonnet added a comment - I have applied this solution: https://bugs.gentoo.org/529574 to MariaDB 10.11.5 and it works very well! Essentially it just declines to fail if the existing file specified in the SQL command is a named pipe.
          danblack Daniel Black added a comment - - edited

          Looking at SQL-2008 on SELECT INTO the target-specification doesn't include file based output so this is our extension.

          To support the differing behaviour here I'd expect we'd want to see a FORCE or similar SQL that translates to O_TRUNC used in opening the file.

          patching create_file in sql/sql_class.cc seems the right way to do it, but checking the existing filetype not at all. Not sure how the original bug expects to work with sockets, you don't write to them, you connect.

          danblack Daniel Black added a comment - - edited Looking at SQL-2008 on SELECT INTO the target-specification doesn't include file based output so this is our extension. To support the differing behaviour here I'd expect we'd want to see a FORCE or similar SQL that translates to O_TRUNC used in opening the file. patching create_file in sql/sql_class.cc seems the right way to do it, but checking the existing filetype not at all. Not sure how the original bug expects to work with sockets , you don't write to them, you connect .

          I'm not sure about sockets, but it seems like it would be very easy to implement the patch I linked to and at least have named pipes working. That doesn't require FORCE or O_TRUNC or anything.

          xan@biblionix.com Xan Charbonnet added a comment - I'm not sure about sockets, but it seems like it would be very easy to implement the patch I linked to and at least have named pipes working. That doesn't require FORCE or O_TRUNC or anything.

          I have submitted a pull request:
          https://github.com/MariaDB/server/pull/3063

          xan@biblionix.com Xan Charbonnet added a comment - I have submitted a pull request: https://github.com/MariaDB/server/pull/3063

          As I said in the comment in the pull request, I do not especially like potentially taking infinite time, unkillable file writes, and it can be a source to too many problems. Either writes should be made killable, or this feature would need a guard option for "I know what I'm doing, I really am not scared by unkillable connections, let me use those funny pipes".

          wlad Vladislav Vaintroub added a comment - As I said in the comment in the pull request, I do not especially like potentially taking infinite time, unkillable file writes, and it can be a source to too many problems. Either writes should be made killable, or this feature would need a guard option for "I know what I'm doing, I really am not scared by unkillable connections, let me use those funny pipes".

          People

            wlad Vladislav Vaintroub
            xan@biblionix.com Xan Charbonnet
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.