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 1jhJ9L-0003Cl-0P for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2020 20:41:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jhJ9J-0004JN-L0 for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2020 20:41:09 +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 1jhJ9J-0004JF-DW for pgsql-hackers@lists.postgresql.org; Fri, 05 Jun 2020 20:41:09 +0000 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jhJ9C-0006RP-7c for pgsql-hackers@postgresql.org; Fri, 05 Jun 2020 20:41:08 +0000 Received: by mail-ej1-x642.google.com with SMTP id f7so11512935ejq.6 for ; Fri, 05 Jun 2020 13:41:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SIWnod4WJ1/1ntiNiSYuxORYmLJ88X6mknacmJs88VU=; b=KqubzMCawI2ynWJp4UvBkMTwmbqC8HS/P7zbPJJruQ/BSjq8vPOcpq1do0+16nKipg BJpApNqJIqOIUS+8A0Fag/RAUETv9px3Zce/UUav+1S+hr11SWZ+J9GU/cOtj3Ywqv1D K9XSAJy9GpD+DroM+T2Jg+t3rigTQcPjnKIKUISElpupUjHlTjhQYKz+JUul+hT35f8G Ra4J475a7D+jTpzqPfZMwYVtSa35Gcg78w+cy1dKT91GIQLoWKBrhXNQpUERi3wmuRYi 5AnDwt+CxJwg9MNy17KZfj/Wq8ThhnLf4mQGciqUDYSiGAhahXlLWE2LO6IyYovzwAcx cm2A== 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; bh=SIWnod4WJ1/1ntiNiSYuxORYmLJ88X6mknacmJs88VU=; b=HlvpbLfyxb/HDo6sAcw4Ai80F4eZs9Xvb4/KwXm1GiB4daoJp+D3rJEtLzCaPAuzBu q02T6efnDWv6T4xksd9WMOTy0B2c9WZSPUtXaQsnwUvOhvjWMtyDSPVHaKRBvngcuwt+ c9fTwGIBjv4F8O8MZmelfPPYuJNF8jqTW+yG9um4zsrYhg1DwaUl4bTYcrGWiPI3aNUH gOQkU75MStT8LFDAT3lHkLiIzLC4QLQ7TWeYTa/VdP16hqF2GKeD45yNmxOtrjGga9+p W15b2f+VBxXf2U6nTvm6kU0Z62gJG/90JWoybsJIIJ2Y7dYHdEcWscCT43tVJBLSwGiP k0Jw== X-Gm-Message-State: AOAM532KIbeF9eNVkBe13nRPkd2KomeNiRKgRaE1Yk6E5OehHlGGofIA 463eHNYHbeJPosDYpGTytxw4MQ== X-Google-Smtp-Source: ABdhPJzaobdQlczioz6eRh85w2cPm12QyQK4a+egxv4ziv1woLwLFgHurSuHZ2oQyA2pAFYTtVO72A== X-Received: by 2002:a17:906:d973:: with SMTP id rp19mr3238618ejb.475.1591389661256; Fri, 05 Jun 2020 13:41:01 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id j11sm5227487ejf.53.2020.06.05.13.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 13:40:59 -0700 (PDT) Date: Fri, 5 Jun 2020 22:40:57 +0200 From: Tomas Vondra To: Thomas Munro Cc: Dmitry Dolgov <9erthalion6@gmail.com>, David Steele , Andres Freund , Alvaro Herrera , pgsql-hackers Subject: Re: WIP: WAL prefetch (another approach) Message-ID: <20200605204057.anopw4rntkg6hsag@development> References: <226b5950-7404-a51d-8dc7-53895b363a38@pgmasters.net> <20200419114820.h62ryte7uwu46e2x@localhost> <20200425191935.4p6qxzzu5bklodwk@localhost> <20200502151423.yf52i63u232fdfrg@localhost> <20200605152052.pe6ql7nxzrpbrit7@development> <20200605200414.kp24q5yznzln74hl@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200605200414.kp24q5yznzln74hl@development> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Jun 05, 2020 at 10:04:14PM +0200, Tomas Vondra wrote: >On Fri, Jun 05, 2020 at 05:20:52PM +0200, Tomas Vondra wrote: >> >>... >> >>which is not particularly great, I guess. There however seems to be >>something wrong, because with the prefetching I see this in the log: >> >>prefetch: >>2020-06-05 02:47:25.970 CEST 1591318045.970 [22961] LOG: recovery no >>longer prefetching: unexpected pageaddr 108/E8000000 in log segment >>0000000100000108000000FF, offset 0 >> >>prefetch2: >>2020-06-05 15:29:23.895 CEST 1591363763.895 [26676] LOG: recovery no >>longer prefetching: unexpected pageaddr 108/E8000000 in log segment >>000000010000010900000001, offset 0 >> >>Which seems pretty suspicious, but I have no idea what's wrong. I admit >>the archive/restore commands are a bit hacky, but I've only seen this >>with prefetching on the SATA storage, while all other cases seem to be >>just fine. I haven't seen in on NVME (which processes much more WAL). >>And the SATA baseline (no prefetching) also worked fine. >> >>Moreover, the pageaddr value is the same in both cases, but the WAL >>segments are different (but just one segment apart). Seems strange. >> > >I suspected it might be due to a somewhat hackish restore_command that >prefetches some of the WAL segments, so I tried again with a much >simpler restore_command - essentially just: > > restore_command = 'cp /archive/%f %p.tmp && mv %p.tmp %p' > >which I think should be fine for testing purposes. And I got this: > > LOG: recovery no longer prefetching: unexpected pageaddr 108/57000000 > in log segment 0000000100000108000000FF, offset 0 > LOG: restored log file "0000000100000108000000FF" from archive > >which is the same segment as in the earlier examples, but with a >different pageaddr value. Of course, there's no such pageaddr in the WAL >segment (and recovery of that segment succeeds). > >So I think there's something broken ... > BTW in all three cases it happens right after the first restart point in the WAL stream: LOG: restored log file "0000000100000108000000FD" from archive LOG: restartpoint starting: time LOG: restored log file "0000000100000108000000FE" from archive LOG: restartpoint complete: wrote 236092 buffers (22.5%); 0 WAL ... LOG: recovery restart point at 108/FC000028 DETAIL: Last completed transaction was at log time 2020-06-04 15:27:00.95139+02. LOG: recovery no longer prefetching: unexpected pageaddr 108/57000000 in log segment 0000000100000108000000FF, offset 0 LOG: restored log file "0000000100000108000000FF" from archive It looks exactly like this in case of all 3 failures ... regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services