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 1sfeZy-008z1u-HV for pgsql-hackers@arkaria.postgresql.org; Sun, 18 Aug 2024 12:00:14 +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 1sfeZu-008yen-EC for pgsql-hackers@arkaria.postgresql.org; Sun, 18 Aug 2024 12:00:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sfeZu-008yef-4e for pgsql-hackers@lists.postgresql.org; Sun, 18 Aug 2024 12:00:10 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sfeZo-000H9K-9N for pgsql-hackers@lists.postgresql.org; Sun, 18 Aug 2024 12:00:10 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-5314c6dbaa5so4614077e87.2 for ; Sun, 18 Aug 2024 05:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723982403; x=1724587203; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=kNjQmzP32xkiiF4MZP+GORxLuvf+INQMAZ3z2ync1Qs=; b=c0byDU6n1dkqT+/J9hHtdd0/o6u/WA3XfJoyukXAzg0SmETc3RxrzdAS3jyyktbhBU o91OGioQ+DFWrqomtM9YI/Dn2qaFY9pIRL5yfxzRGpdG6lxpyHloca5nuGekD+Lz4AV1 zt4HqTp174YBzVig6Zw9vYIu9WVecT4vWJgJFAmElHkFM/9OJp0ZWzT2j384P+0NlVQw jkFENcx49qZzXeZqE3zLsRc+b9Jbcz0KNeXeyFlUt2SHrvDE3wLgoImesdbqX6ND0mPE SB7xdSl6oLl2sHA9/ox8Y3ohxaQ0w4780b3HMmebe+KOKv4ZMf8BAeKJZ6jP6p/OVvO/ v30Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723982403; x=1724587203; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kNjQmzP32xkiiF4MZP+GORxLuvf+INQMAZ3z2ync1Qs=; b=GdMbo613LDrClhEEM5PMzoqPiYj/7rVa6bL5C4nxGGORQjVF4NlUphWG3paqsGkS9b KZpYhhgrl3IlI+dpvbXpMu8gwE08Yz8cF9TTdo8Az3P0GnFV4+DHEuxAhCdIfoxNkpTU cDI82o3P2CUqn06J6RwuzT/UTzTB8DBJM4fayMZCMefWzUw/x8Rz6LaWl+oKbhrFUcXn A49IC9sU8rIexwMU3IFe+GCcCUBGOOsteW0OJa8Lm8I4H8hsWTR5bvuzZYNUm1abDuCK oPprRW1VjYDCKqcjuChAtbTFx+KCcLKqUUs5pdRllD027fvIYSj7tljlXrW+n9EW0OCI 8lew== X-Forwarded-Encrypted: i=1; AJvYcCWoXxip/ON2a9jmCc5kjt3dXSMIL0ajZZmHFDY9R9CNgJXyA/LhlRcar77JZHEKGtG7Qs0z9tCzi1hS9R2P/ly4mTwIIirw1aOsGRpWQEQfAacS X-Gm-Message-State: AOJu0YyyAzOKHX3Fvn8x7kDICrV1Lk+eAoygm1f6MToMby9TDY43+q1f 4I8vhHJW4k/8s/XV9aYaJVEQCnCywDv17Abkv6ivK4kRlBCJfLzv X-Google-Smtp-Source: AGHT+IFzT2cQsdNZHnudZVEKX1RT+Ty9+mrgIsPA5hH9dcbVGlgl5yZh30wsenXBvahGx0v9XSaa9A== X-Received: by 2002:a05:6512:ad2:b0:52c:e4bf:d55d with SMTP id 2adb3069b0e04-5331c692a05mr6612610e87.8.1723982402477; Sun, 18 Aug 2024 05:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.25.122]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5330d3afa2fsm1173732e87.53.2024.08.18.05.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Aug 2024 05:00:01 -0700 (PDT) Message-ID: Date: Sun, 18 Aug 2024 15:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Remove dependence on integer wrapping Content-Language: en-US To: Joseph Koshakow , Nathan Bossart Cc: jian he , Heikki Linnakangas , Matthew Kim , Tom Lane , PostgreSQL Hackers , Andres Freund References: From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 18.08.2024 00:52, Joseph Koshakow wrote: > The largest possible (theoretical) value for `nbuckets` is > `1073741824`, the largest power of 2 that fits into an `int`. So, the > largest possible value for `nbuckets << 1` is `2147483648`. This can > fully fit in a `uint32`, so the simple fix for this case is to cast > `nbuckets` to a `uint32` before shifting. I've attached this fix, > Alexander if you have time I would appreciate if you were able to test > it. > Yes, I've tested v25-0002-*.patch and can confirm that this fix works as well. Best regards, Alexander