Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tHJ5S-005rA4-4a for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Nov 2024 08:44:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tHJ5N-00Exwf-WC for pgsql-hackers@arkaria.postgresql.org; Sat, 30 Nov 2024 08:44:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tHJ5N-00ExuB-IC for pgsql-hackers@lists.postgresql.org; Sat, 30 Nov 2024 08:44:18 +0000 Received: from mail-qk1-x729.google.com ([2607:f8b0:4864:20::729]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tHJ5I-000Idr-5e for pgsql-hackers@lists.postgresql.org; Sat, 30 Nov 2024 08:44:17 +0000 Received: by mail-qk1-x729.google.com with SMTP id af79cd13be357-7b66d08d529so230600485a.1 for ; Sat, 30 Nov 2024 00:44:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732956251; x=1733561051; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JDi0vOl2aA+pu3iNPDK1j0ncd/4x8XA5tztPVRoz04s=; b=XSiLNkwXCbYG0x49isR529aE8Y1YvktbvKBB9mJvRI9d/azktlmE5j/6CrAyN5UX5G n2qaVlF8Jt3HndBDvc9hB4ufzIRi+AFiMasJ7e3yz0cd2AAeeXpVfcZFBpGdHruGQAlc R4ixfGkvyVHlyNVgMJ5XN6llpcIZX3W3MNUQU0Kh3KrCA6LOwO95C9Up2WPQhvUAQiTg yyHjb7rb4FlLpb/fDXEqLG3xzG4XkBePX9wdC509ca3gEK78iz4eleI3M1W9SfncgtZb ZOurLFkkIpzjrM68cD4jDxg/YPjAYrGLHtESPAbdcLHLHwkyoDQZKlqNzfxi5FlEeSHu JGkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732956251; x=1733561051; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JDi0vOl2aA+pu3iNPDK1j0ncd/4x8XA5tztPVRoz04s=; b=U7yq6HSaAgWNUF0iEuGA8F5G0ZLzb07Vcu3ZOR5icIBSoACn41tyUCxuvbg7/EvCMe dymDwP08ZFIxOcdQLmcYuus1jU9+3pL1KLAeIlatzuUDJHuLGxnoNByrvV7HfEc17uHs 2ziXgSerD+QDtt2njG51FWXdgRMDKO54c3faLyeswul7DbOdimv+74bHvOdsU7OEN3jR kn6XtMET+amP3eY/NPJqvHM9UC+QaMqaDU86ILVus+SL+oPEGQMGdg2tH4FACFCR1xEc gRBzMz6QUAWFtIsGZOvVpniyCYGLeD973wj/sdC2r8EyZXC4tKU9UmYxMl9S4Q1WLbcE xxVA== X-Forwarded-Encrypted: i=1; AJvYcCWPCdB+ZkEs4rF2j25/arlxsKkqyOqtx/22FGBS49xOsrGY7Ohw+6UFwRjPWt7DkbPT617rJQpqxorhtzhP@lists.postgresql.org X-Gm-Message-State: AOJu0Ywgr07wP1OTed9vw7HFhOGex4ij870oDsVsv/YCCQprvnAhhD7x QxnGdgzEUoVIXYfWF2lJRrtfeA/SYYhZT/Q2MsTOkHfYDktgNADsW5lZmx71D5xF3f3zf/PRnPY 2aa+eElGPeSPqJ/SNqK6lYNeP0is= X-Gm-Gg: ASbGncvp9dxNrm2yitl6mKWKPxwmm5dRZhLiHk2btbD8+FVCT71+fvpOP1VRoKQBgJ7 7FctqRjLUbsklwNFjSu5XPrx0mJrIV1iIia7mZkmGDjY= X-Google-Smtp-Source: AGHT+IEvYi528lZ9t+0fsxS+Zk2DMEAPqKaDexyR0QV24VQVCa8nIepC1f/xG3Leqah9Qwfa6Eix0YMkcse52NBJt2s= X-Received: by 2002:a05:620a:2a03:b0:7a9:b2f4:42e0 with SMTP id af79cd13be357-7b6839f95b4mr1871484985a.15.1732956251221; Sat, 30 Nov 2024 00:44:11 -0800 (PST) MIME-Version: 1.0 References: <94d53a41-d1f5-4fd1-8d1e-ff36ac569848@app.fastmail.com> <4DA5A159-39FD-47DB-95E5-A4F65BC5782A@yandex-team.ru> <53e96b5a-cc77-4afa-8103-79c69afef1a6@uni-muenster.de> <748a7ec0-9126-4f27-a2a7-e3e449d6fdd7@uni-muenster.de> <8a240667-de9e-455b-b3e2-62f34ec80154@uni-muenster.de> <3f1b817f-6e7a-4e01-bfc5-50ea3724225e@uni-muenster.de> In-Reply-To: From: Kirill Gavrilov Date: Sat, 30 Nov 2024 11:44:00 +0300 Message-ID: Subject: Re: Truncate logs by max_log_size To: Kirill Reshke Cc: Jim Jones , "Andrey M. Borodin" , Euler Taveira , pgsql-hackers@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000c3f3d006281d51a5" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c3f3d006281d51a5 Content-Type: text/plain; charset="UTF-8" > > > Hi > > > +for (my $attempts = 0; $attempts < $max_attempts; $attempts++) > > +{ > > + eval { > > + $current_logfiles = slurp_file($node->data_dir . '/current_logfiles'); > > + }; > > + last unless $@; > > + usleep(100_000); > > +} > > > `usleep` in tap tests is usually a bad pattern. Do we have a chance to > test this using `wait_for_log` or similar? > I'm not sure we can use `wait_for_log` because it checks for only one logfile. But even if it's possible, I don't think it's a good idea to use different checks in the same file or to change tests for another feature. I used test case from above as an example for mine. --000000000000c3f3d006281d51a5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Hi

> +for (my $attempts =3D 0; $attempts < $max_attempts; $attempts++) > +{
> + eval {
> + $current_logfiles =3D slurp_file($node->data_dir . '/current_= logfiles');
> + };
> + last unless $@;
> + usleep(100_000);
> +}


`usleep` in tap tests is usually a bad pattern. Do we have a chance to
test this using `wait_for_log` or similar?
=C2=A0
I'm not sure we can use `wait_for_log` because it checks for only= one logfile. But even if it's possible, I don't think it's a g= ood idea to use different checks in the same file or to change tests for an= other feature. I used test case from above as an example for mine.
--000000000000c3f3d006281d51a5--