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 1jhIZm-000233-Iy for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2020 20:04:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jhIZk-0006pe-HJ for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2020 20:04:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhIZk-0006o6-7B for pgsql-hackers@lists.postgresql.org; Fri, 05 Jun 2020 20:04:24 +0000 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jhIZh-0007s5-5u for pgsql-hackers@postgresql.org; Fri, 05 Jun 2020 20:04:23 +0000 Received: by mail-ej1-x642.google.com with SMTP id n24so11431114ejd.0 for ; Fri, 05 Jun 2020 13:04:20 -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=C17ENRU1U333PbGWxFx0dhJT0RUZ8Ody01Y/66LUIp8=; b=PgTFZlZz1b8fRk5SMM2zSHGs8KDfkyIK+eBqw4VDaRP8JDIoH3n9Inwiat5WlrvY8P GvHFllcMDXibPaWBQw8voX61gMJuRrW3b+gK6cRG826ymmBWVFTIdWVqt9FmksIz4byc ++6lstqjCe54GdFLQV2/JqSrx02gzQzwEAQnOf+Cixa5PrrarF/zn0yR/6JS79Q0uOym jeat77ImEtXXLY+nJzuIhJS4uW+5tkfUWfTZ+QCGDxAlThhFVV49KzQNmdKNA08yDM5u FI8jidizoXmG3mbBgF/CxSgnjuFwtG0+on8m/yO0IxI9rqN6ovfVDmzR+GOL0St4uTWA Yx6g== 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=C17ENRU1U333PbGWxFx0dhJT0RUZ8Ody01Y/66LUIp8=; b=hI+jGidFqYL7e5MEmKmTzGBpspTxsImjN6NgREir9VX/1K3TV1LGFUBlaerbtLzArC w8lzIAKXUqHpXaiMFrieqc5UNnsDfCePt+QAcRvRyGCIrKdfdA+Y7R03WqlS2M//i3pv cNuaz6C4HB//5As+oDTGRbIBvGW8Ayss6DlpYIaTvWoX+qx0sravuNEFwkKnOu4DKAsz Llhx4jiCQogGuvzMgAcvUX/vOGHIeLxfTLomBH0OfxiW/dmhskP1qbYQGoskv+Te+QRJ 6rMCxkxQOvpQWYhYKqnySmDCZGXHJAkjFPWNnxEM5SZRkm5oR/USA92/3It8ZJ8c0Wnq dmvQ== X-Gm-Message-State: AOAM530pID7SbKQVt06eEJ/S4GaUpGAqrgHpkdHQ55KE4GCAOe0GFJuV 2Ur+0BjHKIH/Xlxd2bTv3WAQBw== X-Google-Smtp-Source: ABdhPJxe17YyCi0EwxPAtOz1UD55f4GgLqvmg5Nw72/lpnypNGea+xnxRCayK1KhhfCQ4MSXZ+OfIg== X-Received: by 2002:a17:906:6457:: with SMTP id l23mr10022439ejn.188.1591387459731; Fri, 05 Jun 2020 13:04:19 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id l1sm5123035ejd.114.2020.06.05.13.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2020 13:04:17 -0700 (PDT) Date: Fri, 5 Jun 2020 22:04:14 +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: <20200605200414.kp24q5yznzln74hl@development> References: <226b5950-7404-a51d-8dc7-53895b363a38@pgmasters.net> <20200419114820.h62ryte7uwu46e2x@localhost> <20200425191935.4p6qxzzu5bklodwk@localhost> <20200502151423.yf52i63u232fdfrg@localhost> <20200605152052.pe6ql7nxzrpbrit7@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20200605152052.pe6ql7nxzrpbrit7@development> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 ... regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services