@@ -1420,7 +1420,8 @@ func (a *Archiver) processSinglePartitionSlice(partition PartitionInfo, _ *tea.P
14201420 }
14211421 // Save cache metadata to indicate this slice was checked and had no data
14221422 // This prevents re-checking empty slices on subsequent runs
1423- cache .setFileMetadataWithETagAndStartTime (partition .TableName , objectKey , 0 , 0 , "" , "" , false , sliceStartTime )
1423+ // Use objectKey as cache key for slices so each slice has its own entry
1424+ cache .setFileMetadataWithETagAndStartTime (objectKey , objectKey , 0 , 0 , "" , "" , false , sliceStartTime )
14241425 if err := cache .save (a .config .CacheScope ); err != nil {
14251426 a .logger .Debug (fmt .Sprintf (" ⚠️ Failed to save cache metadata for empty slice: %v" , err ))
14261427 }
@@ -1444,8 +1445,8 @@ func (a *Archiver) processSinglePartitionSlice(partition PartitionInfo, _ *tea.P
14441445 result .Stage = StageSkipped
14451446 // Clean up temp file
14461447 cleanupTempFile (tempFilePath )
1447- // Save to cache immediately
1448- cache .setFileMetadataWithETagAndStartTime (partition . TableName , objectKey , fileSize , uncompressedSize , md5Hash , "" , true , sliceStartTime )
1448+ // Save to cache immediately - use objectKey as cache key for slices
1449+ cache .setFileMetadataWithETagAndStartTime (objectKey , objectKey , fileSize , uncompressedSize , md5Hash , "" , true , sliceStartTime )
14491450 if err := cache .save (a .config .CacheScope ); err != nil {
14501451 a .logger .Warn (fmt .Sprintf (" ⚠️ Failed to save cache metadata: %v" , err ))
14511452 }
@@ -1462,8 +1463,8 @@ func (a *Archiver) processSinglePartitionSlice(partition PartitionInfo, _ *tea.P
14621463 result .Stage = StageSkipped
14631464 // Clean up temp file
14641465 cleanupTempFile (tempFilePath )
1465- // Save to cache immediately with multipart ETag
1466- cache .setFileMetadataWithETagAndStartTime (partition . TableName , objectKey , fileSize , uncompressedSize , md5Hash , multipartETag , true , sliceStartTime )
1466+ // Save to cache immediately with multipart ETag - use objectKey as cache key for slices
1467+ cache .setFileMetadataWithETagAndStartTime (objectKey , objectKey , fileSize , uncompressedSize , md5Hash , multipartETag , true , sliceStartTime )
14671468 if err := cache .save (a .config .CacheScope ); err != nil {
14681469 a .logger .Warn (fmt .Sprintf (" ⚠️ Failed to save cache metadata: %v" , err ))
14691470 }
@@ -1508,7 +1509,8 @@ func (a *Archiver) processSinglePartitionSlice(partition PartitionInfo, _ *tea.P
15081509 }
15091510
15101511 // Save metadata to cache immediately after successful upload
1511- cache .setFileMetadataWithETagAndStartTime (partition .TableName , objectKey , fileSize , uncompressedSize , md5Hash , multipartETag , true , sliceStartTime )
1512+ // Use objectKey as cache key for slices so each slice has its own entry
1513+ cache .setFileMetadataWithETagAndStartTime (objectKey , objectKey , fileSize , uncompressedSize , md5Hash , multipartETag , true , sliceStartTime )
15121514 if err := cache .save (a .config .CacheScope ); err != nil {
15131515 a .logger .Warn (fmt .Sprintf (" ⚠️ Failed to save cache metadata: %v" , err ))
15141516 }
@@ -1534,7 +1536,14 @@ func (a *Archiver) checkCachedMetadata(partition PartitionInfo, objectKey string
15341536 Partition : partition ,
15351537 }
15361538
1537- cachedSize , cachedMD5 , cachedMultipartETag , hasCached := cache .getFileMetadataWithETag (partition .TableName , objectKey , partition .Date )
1539+ // For slices (custom range partitions), use objectKey as cache key so each slice has its own entry
1540+ // For regular partitions, use partition.TableName
1541+ cacheKey := partition .TableName
1542+ if partition .HasCustomRange () {
1543+ cacheKey = objectKey
1544+ }
1545+
1546+ cachedSize , cachedMD5 , cachedMultipartETag , hasCached := cache .getFileMetadataWithETag (cacheKey , objectKey , partition .Date )
15381547 if ! hasCached {
15391548 return false , result
15401549 }
0 commit comments