Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jccvz-0001VX-FH for pgsql-hackers@arkaria.postgresql.org; Sat, 23 May 2020 22:48:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jccvw-0000Q0-LI for pgsql-hackers@arkaria.postgresql.org; Sat, 23 May 2020 22:48:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jccvw-0000Pt-Am for pgsql-hackers@lists.postgresql.org; Sat, 23 May 2020 22:48:00 +0000 Received: from mail-il1-x142.google.com ([2607:f8b0:4864:20::142]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jccvs-00048C-AF for pgsql-hackers@lists.postgresql.org; Sat, 23 May 2020 22:47:59 +0000 Received: by mail-il1-x142.google.com with SMTP id c20so14322538ilk.6 for ; Sat, 23 May 2020 15:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8zXDbRh80hv5QgDFIom/ppfRDvkQnuaz0h6aSC+5p4g=; b=heGdGoPqlnWeIfSLCb3UiRdTkR6VDtbzn3aDdbLDWOIR02pHQkZjGu1HbOY3l+3pit WAacQSQf/pYYbpzMmvpJ4sY/OMvT506vjjRpXYdjq+wT6IUdY4FdfcfWLovgn3bkE8rd Pyhlh0h+Iumfd1maI9Z41312JEz8Fj8nrq/BP30HGEfbsL47O1PGVlW/H911ukkhS9dW Te/Z3/9WtNhcwFOqWWpqHz9y3Hfd16e8PqhzA98C+gr9+K9a+EyRIeB83TBquoKbdvy5 FVuTCfZKYLn9/+i5cpFu0YuDpu+OZdAERjFm7RV/4JeBGtyNRhmhz554zoNzwsJeNwmE O5Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8zXDbRh80hv5QgDFIom/ppfRDvkQnuaz0h6aSC+5p4g=; b=cowfbrzk9zo+9prrph1G51WFusPwXBRCElWUSe1zVaGqgkcuMzTAH3fc73d6YZ9/Zv UMrQNk+60DGIxYy1h89kL459FAGp67aCSa/iCDl1mY5ErSc28iRbEmGmfwlE2qS1GZ/v EKFcevZeRAla688erOvq18m3S/R4WlG/gd5TDswWxTS7VMnbeYqYjClFwd1HDCdrmPle ZJ/sjZk5ughtvLXc7O7ResU1wxb5licm70VibFLzfRTX+C65j+GUzDWXq1ncQCSZbmnP ytSGUR+36YPaGry7IsrRwQ+vlJNwMMlAWCCZT/xAuBlK4wWJv4150HatjOC2fRl681LM 80LQ== X-Gm-Message-State: AOAM533XPT3eTYIR14AtAy1VAs7EOdBVPXBAkvgsjXFVHAj35e5P+zgo AzouQDLgbmTnlFxM5oTeF1nebg== X-Google-Smtp-Source: ABdhPJydmyUIXRzuUbhH2JCuTw+IhK8bpPAtArxBgUFGP5TZNMSSPxN2D+/CV9H9LPbNPimNAmdDnA== X-Received: by 2002:a92:3556:: with SMTP id c83mr17310190ila.218.1590274074270; Sat, 23 May 2020 15:47:54 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id t18sm7126513ili.24.2020.05.23.15.47.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 23 May 2020 15:47:53 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id EA09080042A; Sat, 23 May 2020 17:47:51 -0500 (CDT) Date: Sat, 23 May 2020 17:47:51 -0500 From: Justin Pryzby To: David Gilman Cc: Tom Lane , pgsql-hackers@lists.postgresql.org, thomas.munro@gmail.com Subject: Re: Warn when parallel restoring a custom dump without data offsets Message-ID: <20200523224751.GP4472@telsasoft.com> References: <20200519130740.GO18456@telsasoft.com> <25161.1589986110@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, May 23, 2020 at 03:54:30PM -0400, David Gilman wrote: > I've rounded this patch out with a test and I've set up the commitfest > website for this thread. The latest patches are attached and I think > they are ready for review. Thanks. https://commitfest.postgresql.org/28/2568/ I'm not sure this will be considered a bugfix, since the behavior is known. Maybe eligible for backpatch though (?) Your patch was encoded, so this is failing: http://cfbot.cputube.org/david-gilman.html Ideally CFBOT would deal with that (maybe by using git-am - adding Thomas), but I think you sent using gmail web interface, which also reordered the patches. (CFBOT *does* sort them, but it's a known annoyance). > dump file was written with data offsets pg_restore can seek directly to offsets COMMA > pg_restore would only find the TOC if it happened to be immediately "immediately" is wrong, no ? I thought the problem was if we seeked to D and then looked for C, we wouldn't attempt to go backwards. > read request only when restoring a custom dump file without data offsets. remove "only" > of a bunch of extra tiny reads when pg_restore starts up. I would have thought to mention the seeks() ; but it's true that the read()s now grow quadratically. I did run a test, but I don't know how many objects would be unreasonable or how many it'd take to show a problem. Maybe we should avoid fseeko(0, SEEK_SET) unless we need to wrap around after EOF - I'm not sure. Maybe the cleanest way would be to pre-populate a structure with all the TOC data and loop around that instead of seeking around the file ? Can we use the same structure as pg_dump ? Otherwise, that makes me think of commit 42f70cd9c. Make it's not a good parallel or example for this case, though. + The custom archive format may not work with the + option if the archive was originally created by writing the archive + to an unseekable output file. For the best concurrent restoration Can I suggest something like: pg_restore with parallel jobs may fail if the archive dump was written to an unseekable output stream, like stdout. + * If the input file can't be seeked we're at the mercy of the seeked COMMA >Subject: [PATCH 3/3] Add integration test for out-of-order TOC requests in pg_restore Well done - thanks for that. >Also add undocumented --disable-seeking argument to pg_dump to emulate >writing to an unseekable output file. Remove "also". Is it possible to dump to stdout (or pipe to cat or dd) to avoid a new option ? Maybe that would involve changing the test process to use the shell (system() vs execve()), or maybe you could write: /* sh handles output redirection and arg splitting */ 'sh', '-c', 'pg_dump -Fc -Z6 --no-sync --disable-seeking postgres > $tempdir/defaults_custom_format_no_seek_parallel_restore.dump', But I think that would need to then separately handle WIN32, so maybe it's not worth it.