Skip to content

Enable mirror hammer to use an existing log as a source.#1062

Merged
AlCutter merged 3 commits into
transparency-dev:mainfrom
AlCutter:hammer_source_log
Jul 21, 2026
Merged

Enable mirror hammer to use an existing log as a source.#1062
AlCutter merged 3 commits into
transparency-dev:mainfrom
AlCutter:hammer_source_log

Conversation

@AlCutter

Copy link
Copy Markdown
Collaborator

This PR enables an existing log to optionally be used as the source of entries when hammering a mirror.

Towards #945

@AlCutter
AlCutter force-pushed the hammer_source_log branch 4 times, most recently from 4bcece9 to 6bd2c30 Compare July 16, 2026 12:04
@AlCutter
AlCutter requested a review from roger2hk July 16, 2026 12:05
@AlCutter
AlCutter force-pushed the hammer_source_log branch 2 times, most recently from 7ff34d8 to 8dbbd65 Compare July 16, 2026 12:06
@AlCutter
AlCutter marked this pull request as ready for review July 16, 2026 12:06
@AlCutter
AlCutter requested a review from a team as a code owner July 16, 2026 12:06
@AlCutter
AlCutter force-pushed the hammer_source_log branch from 8dbbd65 to a6990d7 Compare July 16, 2026 16:12
c.hammer.randomReaders.Shrink(ctx)
c.hammer.fullReaders.Shrink(ctx)
c.hammer.writers.Shrink(ctx)
if c.hammer != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it mean there will be no way to control the QPS copying entries from the existing log to the mirror server?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Correct - AFAIK the mirror client has been implemented to send requests as quickly as possible :)

These rate controls never controlled the client send rate, they only ever controlled the rate at which the hammer adds things to the source log; if the mirroring process pauses for a while, then the moment it resumes it'll go as fast as possible.

Comment thread internal/mirror/hammer/hammer.go Outdated
return nil, nil, nil, fmt.Errorf("failed to create HTTP fetcher: %v", err)
}
default:
lr = client.FileFetcher{Root: logURL}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would the logURL := strings.ToLower(logURL) on L392 cause any issue if the logURL contains some uppercase value?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good spot, restructured.

Comment thread internal/mirror/hammer/hammer.go Outdated
mirrorURL multiStringFlag

sourceLogURL = flag.String("source_log_url", "", "URL of the log to mirror, or empty if using a locally created log.")
sourceLogPubKeyPath = flag.String("source_log_pubkey_path", "", "Path to the public key of the log to mirror. Required if --source_log_url is set.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shall we align the naming of this flag with the log_private_key flag below? Maybe call it source_log_public_key?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've made them consistent, and also renamed the local log flags such that it's a little clearer they relate to this and not some other usage.

@AlCutter
AlCutter force-pushed the hammer_source_log branch from a6990d7 to bfc1f23 Compare July 17, 2026 10:42
@AlCutter
AlCutter force-pushed the hammer_source_log branch from bfc1f23 to 8cde6e5 Compare July 20, 2026 11:20
Comment thread internal/mirror/hammer/hammer.go Outdated
Comment on lines +164 to +167
if appender != nil {
hammer, ha = newHammer(ctx, appender, logReader, tracker)
ha.Run(ctx)
hammer.Run(ctx)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Only "Standalone Hammer Log mode" will call hammer.Run, so the tracker checkpoint size is never updated in the "Replication mode".

If --leaf_write_goal flag is provided in the replication mode, the hammer will never stop.

The TUI tracker information will not be updated in the replication mode. Is that intended? If so, we can add the logic to enforce replication mode to non-TUI.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've added a workaround to the TUI mode, it can probably be improved, but at least it'll show the checkpoint size now.

@AlCutter
AlCutter merged commit d2d9eaa into transparency-dev:main Jul 21, 2026
19 of 20 checks passed
@AlCutter
AlCutter deleted the hammer_source_log branch July 21, 2026 12:06
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