Skip to content

[Storage] [STG 104] Unique Put Block IDs#47821

Open
weirongw23-msft wants to merge 3 commits into
Azure:feature/storage/stg103-104from
weirongw23-msft:weirongw23/unique-put-block-ids
Open

[Storage] [STG 104] Unique Put Block IDs#47821
weirongw23-msft wants to merge 3 commits into
Azure:feature/storage/stg103-104from
weirongw23-msft:weirongw23/unique-put-block-ids

Conversation

@weirongw23-msft

Copy link
Copy Markdown
Member

No description provided.

@weirongw23-msft weirongw23-msft marked this pull request as ready for review July 2, 2026 19:11
@github-actions github-actions Bot added the Storage Storage Service (Queues, Blobs, Files) label Jul 2, 2026
# still returned so the block list can be committed in the correct order.
index = f"{chunk_offset:032d}"
block_id = encode_base64(url_quote(encode_base64(index)))
block_id = encode_base64(uuid4().bytes)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double check if encode_base64 always produces same amount of bytes given the same length string.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure the length of the left and right matches.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look into how to pad this correctly

def _upload_substream_block(self, index, block_stream):
try:
block_id = f"BlockId{(index//self.chunk_size):05}"
block_id = encode_base64(uuid4().bytes)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be breaking if we change to anything but 12 characters so make sure it's 12 characters.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lowest collision rate with 12 characters when truncatting

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use random

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random.randomint(12) characters...we need to have a seed (os.urandom cryptographically safe random)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guids? (12 chars)

)
add_uri_regex_sanitizer(
regex=r"(?<=[?&]blockid=)[^&#]+",
value="00000000-0000-0000-0000-000000000000",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this base 64 encoded? does it need to be?
maybe can put anything here...

can just put sanitized or japan or anything you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant