> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-parallel-read-in-order-multi-part.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# s3_upload_* 会话设置

> ClickHouse 在 s3_upload_* 生成组中的会话设置。

export const VersionHistory = ({rows = []}) => {
  if (rows.length === 0) {
    return null;
  }
  const headers = ["版本", "默认值", "注释"];
  const border = "1px solid rgba(128, 128, 128, 0.3)";
  const cell = {
    border,
    padding: "0.25rem 0.5rem",
    textAlign: "start",
    verticalAlign: "top"
  };
  return <details className="not-prose" style={{
    border,
    borderRadius: "0.5rem",
    margin: "0.5rem 0",
    padding: "0.5rem 0.75rem",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <summary style={{
    cursor: "pointer",
    fontWeight: 600,
    opacity: 0.72
  }}>
        版本历史
      </summary>
      <table style={{
    borderCollapse: "collapse",
    width: "100%",
    margin: "0.5rem 0 0"
  }}>
        <thead>
          <tr>
            {headers.map(header => <th key={header} style={{
    ...cell,
    fontWeight: 600,
    opacity: 0.72
  }}>
                {header}
              </th>)}
          </tr>
        </thead>
        <tbody>
          {rows.map((row, row_index) => <tr key={row.id ?? row_index}>
              {(row.items ?? []).map((item, item_index) => <td key={item_index} style={{
    ...cell,
    overflowWrap: "anywhere"
  }}>
                  {item?.label}
                </td>)}
            </tr>)}
        </tbody>
      </table>
    </details>;
};

export const SettingsInfoBlock = ({type, default_value, changeable_without_restart}) => {
  return <div className="not-prose" style={{
    display: "flex",
    flexWrap: "wrap",
    alignItems: "baseline",
    columnGap: "0.5rem",
    rowGap: "0.125rem",
    margin: "0.375rem 0",
    fontSize: "0.8125rem",
    lineHeight: "1.125rem"
  }}>
      <div style={{
    fontWeight: 600,
    opacity: 0.72
  }}>类型</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{type}</div>
      <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>默认值</div>
      <div style={{
    overflowWrap: "anywhere"
  }}>{default_value}</div>
      {changeable_without_restart && <div style={{
    fontWeight: 600,
    opacity: 0.72,
    marginInlineStart: "0.5rem"
  }}>
          无需重启即可更改
        </div>}
      {changeable_without_restart && <div style={{
    overflowWrap: "anywhere"
  }}>
          {changeable_without_restart}
        </div>}
    </div>;
};

这些设置可在 [system.settings](/zh/reference/system-tables/settings) 中查看，并根据 [源代码](https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/Settings.cpp) 自动生成。

## s3\_upload\_checksum\_algorithm

<VersionHistory rows={[{"id": "row-1","items": [{"label": "26.9"},{"label": ""},{"label": "用于选择 S3 上传校验和算法的新设置。"}]}]} />

ClickHouse 将数据上传到 `S3` 时使用的校验和算法。`CRC32` 和 `SHA256` 作为灵活的 `x-amz-checksum-*` 请求头发送，`MD5` 则作为 `Content-MD5` 请求头发送。

默认情况下，该值为空，ClickHouse 会让 AWS SDK 计算 `Content-MD5`。在 FIPS 模式下，`MD5` 不可用，因此 SDK 会静默省略它，导致上传内容完全不含校验和：请改为设置 `CRC32` 或 `SHA256`，以附加灵活校验和。在适用此设置的场景中，显式指定 `MD5` 会被拒绝。

该设置在创建 `S3` 客户端时生效，因此适用于查询作用域的场景，例如 `s3` 表函数和 `BACKUP ... TO S3`；后续按查询执行的 `SET` 不会重新配置已经创建的长期运行客户端，例如 `S3` 磁盘。

`S3Express` 桶要求使用灵活校验和，且不接受 `Content-MD5`：显式指定的 `CRC32` 或 `SHA256` 会生效，空值会使用 `CRC32`，显式指定的 `MD5` 则会被拒绝。

`GCS` 端点 (`storage.googleapis.com`) 会完全忽略此设置，并保留 SDK 的 `Content-MD5` 行为，因为 `GCS` 会拒绝携带 AWS `x-amz-checksum-*` 请求头且使用 `SigV4` 签名的请求。

服务器端复制会忽略此设置。

## s3\_upload\_part\_size\_multiply\_factor

<SettingsInfoBlock type="UInt64" default_value="2" />

当单次写入 S3 上传的分片数达到 s3\_multiply\_parts\_count\_threshold 时，就将 s3\_min\_upload\_part\_size 乘以该因子。

## s3\_upload\_part\_size\_multiply\_parts\_count\_threshold

<SettingsInfoBlock type="UInt64" default_value="500" />

每当上传到 S3 的分片数达到该值时，s3\_min\_upload\_part\_size 都会乘以 s3\_upload\_part\_size\_multiply\_factor。
