:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(s3): Use resolved endpoint_url for checksum algorithm (#73839)
Tomás Farías Santana44d1a890f7fe
diff --git a/products/batch_exports/backend/temporal/destinations/redshift_batch_export.py b/products/batch_exports/backend/temporal/destinations/redshift_batch_export.pyindex c81017f70b64..ed336fea6197 100644--- a/products/batch_exports/backend/temporal/destinations/redshift_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/redshift_batch_export.py@@ -1402,6 +1402,7 @@ async def copy_into_redshift_activity_from_stage(inputs: RedshiftCopyActivityInpdata_interval_end=inputs.batch_export.data_interval_end,batch_export_model=inputs.batch_export.batch_export_model,file_format="Parquet",+ checksum_algorithm="CRC64NVME",compression="zstd",encryption=None,s3_client=client,diff --git a/products/batch_exports/backend/temporal/destinations/s3_batch_export.py b/products/batch_exports/backend/temporal/destinations/s3_batch_export.pyindex 6c649c3524dd..ac208817416e 100644--- a/products/batch_exports/backend/temporal/destinations/s3_batch_export.py+++ b/products/batch_exports/backend/temporal/destinations/s3_batch_export.py@@ -708,6 +708,7 @@ async def insert_into_s3_activity_from_stage(inputs: S3InsertInputs) -> S3BatchEs3_inputs=inputs,part_size=settings.BATCH_EXPORT_S3_UPLOAD_CHUNK_SIZE_BYTES,max_concurrent_uploads=settings.BATCH_EXPORT_S3_MAX_CONCURRENT_UPLOADS,+ checksum_algorithm="CRC64NVME" if endpoint_url is None else None,)result = await run_consumer_from_stage(@@ -750,11 +751,11 @@ class ConcurrentS3Consumer(Consumer):data_interval_end: str,batch_export_model: BatchExportModel | None,file_format: str,+ checksum_algorithm: str | None = None,kms_key_id: str | None = None,max_file_size_mb: int | None = None,compression: str | None = None,encryption: str | None = None,- endpoint_url: str | None = None,use_virtual_style_addressing: bool = False,part_size: int = 50 * 1024 * 1024, # 50MB partsmax_concurrent_uploads: int = 5,@@ -769,6 +770,8 @@ class ConcurrentS3Consumer(Consumer):self.data_interval_end = data_interval_endself.batch_export_model = batch_export_model+ self.checksum_algorithm = checksum_algorithm+self.file_format = file_formatself.compression = compressionself.encryption = encryption@@ -778,7 +781,6 @@ class ConcurrentS3Consumer(Consumer):self.max_file_size_mb = max_file_size_mbself.kms_key_id = kms_key_id- self.endpoint_url = endpoint_urlself.use_virtual_style_addressing = use_virtual_style_addressingself.part_size = part_size@@ -810,6 +812,7 @@ class ConcurrentS3Consumer(Consumer):s3_inputs: S3InsertInputs,part_size: int = 50 * 1024 * 1024,max_concurrent_uploads: int = 5,+ checksum_algorithm: str | None = None,):return cls(s3_client=s3_client,@@ -819,12 +822,12 @@ class ConcurrentS3Consumer(Consumer):data_interval_start=s3_inputs.data_interval_start,data_interval_end=s3_inputs.data_interval_end,batch_export_model=s3_inputs.batch_export_model,+ checksum_algorithm=checksum_algorithm,file_format=s3_inputs.file_format,compression=s3_inputs.compression,encryption=s3_inputs.encryption,max_file_size_mb=s3_inputs.max_file_size_mb,kms_key_id=s3_inputs.kms_key_id,- endpoint_url=s3_inputs.endpoint_url,use_virtual_style_addressing=s3_inputs.use_virtual_style_addressing,part_size=part_size,max_concurrent_uploads=max_concurrent_uploads,@@ -913,8 +916,8 @@ class ConcurrentS3Consumer(Consumer):raise NoUploadInProgressError()optional_kwargs = {}- if self.endpoint_url is None:- optional_kwargs["ChecksumAlgorithm"] = "CRC64NVME"+ if self.checksum_algorithm:+ optional_kwargs["ChecksumAlgorithm"] = self.checksum_algorithmtry:self.logger.debug(@@ -1104,8 +1107,8 @@ class ConcurrentS3Consumer(Consumer):optional_kwargs["ServerSideEncryption"] = self.encryptionif self.kms_key_id:optional_kwargs["SSEKMSKeyId"] = self.kms_key_id- if self.endpoint_url is None:- optional_kwargs["ChecksumAlgorithm"] = "CRC64NVME"+ if self.checksum_algorithm:+ optional_kwargs["ChecksumAlgorithm"] = self.checksum_algorithmcurrent_key = self._get_current_key()with TRACER.start_as_current_span(@@ -1158,8 +1161,8 @@ class ConcurrentS3Consumer(Consumer):manifest_key: str,):optional_kwargs = {}- if self.endpoint_url is None:- optional_kwargs["ChecksumAlgorithm"] = "CRC64NVME"+ if self.checksum_algorithm:+ optional_kwargs["ChecksumAlgorithm"] = self.checksum_algorithmwith TRACER.start_as_current_span("batch_export.s3.upload_manifest"):await self.s3_client.put_object(