Skip to content

Conversation

@a-nogikh
Copy link
Collaborator

Split URI generation and write operation of the blob storage.

This allows to do quick "if URI does not exist, generate and save it" operation within DB transactions and do the actual write at a later point.

Since we don't use two-stage commits here, there's a risk of inconsistency between the blob storage and the DB, and we can only pick one that'd be more affected.

In the current scheme:

  1. For crash artifacts, we store artifacts before saving an entry to the
    DB, so we risk having garbage in the blob storage.
  2. For logs/debugging info, we first update the DB and then write the
    logs. We risk not serving the latest logs from the dashboard.

These choices can be changed any time.

Split URI generation and write operation of the blob storage.

This allows to do quick "if URI does not exist, generate and save it"
operation within DB transactions and do the actual write at a later
point.

Since we don't use two-stage commits here, there's a risk of
inconsistency between the blob storage and the DB, and we can only
pick one that'd be more affected.

In the current scheme:
1) For crash artifacts, we store artifacts before saving an entry to the
   DB, so we risk having garbage in the blob storage.
2) For logs/debugging info, we first update the DB and then write the
   logs. We risk not serving the latest logs from the dashboard.

These choices can be changed any time.
@a-nogikh a-nogikh requested a review from tarasmadan May 13, 2025 11:03
var stmts []*spanner.Mutation

_, iterErr := iter.Next()
if iterErr == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reordering this if->else if->else you can merge 2 beforeSave calls and shift left some code

Copy link
Collaborator

@tarasmadan tarasmadan May 16, 2025

Choose a reason for hiding this comment

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

if iterErr != iterator.Done {
	return iterErr
}
if beforeSave != nil {
	err := beforeSave(test)
	if err != nil {
		return err
	}
}
...
if iterErr == nil {
	...
}

@a-nogikh
Copy link
Collaborator Author

Deprecated in favor of #6082

@a-nogikh a-nogikh closed this Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants