Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a processor for the archival queue #3560

Closed

Conversation

MichaelSnowden
Copy link
Contributor

@MichaelSnowden MichaelSnowden commented Nov 4, 2022

What changed?
Added a processor which executes tasks on the archival queue. A followup PR will actually enable the queue factory.

Why?
I made these changes to enable the archival queue.

How did you test it?
I tested this using unit tests because it's not actually hooked into prod yet.

Potential risks
No--it's not wired into main yet.

Is hotfix candidate?
No.

@MichaelSnowden MichaelSnowden changed the base branch from master to durable-archival November 7, 2022 02:21
@MichaelSnowden MichaelSnowden changed the base branch from durable-archival to master November 7, 2022 02:21
@@ -506,6 +508,7 @@ func NewConfig(dc *dynamicconfig.Collection, numberOfShards int32, isAdvancedVis

// Archival related
ArchivalTaskBatchSize: dc.GetIntProperty(dynamicconfig.ArchivalTaskBatchSize, 100),
ArchivalTaskMaxRetryCount: dc.GetIntProperty(dynamicconfig.ArchivalTaskMaxRetryCount, math.MaxInt32),
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this use? and the maxInt32 doesn't make sense

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use it in a downstream PR, but I'll remove it from this one.

shardContext shard.Context
workflowCache workflow.Cache
logger log.Logger
metricsClient metrics.MetricsHandler
Copy link
Contributor

Choose a reason for hiding this comment

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

metricsHandler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

metricsClient metrics.MetricsHandler
}

func newArchivalQueueTaskExecutor(archiver archival.Archiver, shardContext shard.Context, workflowCache workflow.Cache,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: one argument per line could be cleaner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines +62 to +63
func (e *archivalQueueTaskExecutor) Execute(ctx context.Context, executable queues.Executable) (tags []metrics.Tag,
isActive bool, err error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

func (e *archivalQueueTaskExecutor) Execute(
    ctx context.Context,
    executable queues.Executable,
) (tags []metrics.Tag,isActive bool, err error) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

if err != nil {
return err
}
if mutableState == nil || mutableState.IsWorkflowExecutionRunning() {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the mutable state is nil, I think we should return nil to ack this task. If the workflow is deleted manually prior to archival.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

if retention == 0 {
retention = 7 * 24 * time.Hour
}
deleteTime := closeTime.Add(retention)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a jitter for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in #3565

}
retention := namespaceEntry.Retention()
if retention == 0 {
retention = 7 * 24 * time.Hour
Copy link
Contributor

Choose a reason for hiding this comment

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

make it a const?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines +135 to +137
StartTime: *startTime,
ExecutionTime: *executionTime,
CloseTime: *closeTime,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the archival takes in an optional of those fields so you don't need those sanity check? And if those sanity check need to be there, I think it belongs to archiver.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, fixed

@MichaelSnowden MichaelSnowden marked this pull request as draft November 8, 2022 23:54
@MichaelSnowden MichaelSnowden marked this pull request as ready for review November 25, 2022 00:50
@MichaelSnowden
Copy link
Contributor Author

Moved to #3663

@MichaelSnowden MichaelSnowden deleted the da-q-processors branch December 29, 2022 23:00
@MichaelSnowden MichaelSnowden restored the da-q-processors branch December 29, 2022 23:00
@MichaelSnowden MichaelSnowden deleted the da-q-processors branch December 29, 2022 23:00
@MichaelSnowden MichaelSnowden restored the da-q-processors branch December 29, 2022 23:00
@MichaelSnowden MichaelSnowden deleted the da-q-processors branch December 29, 2022 23:00
@MichaelSnowden MichaelSnowden restored the da-q-processors branch December 29, 2022 23:00
@MichaelSnowden MichaelSnowden deleted the da-q-processors branch December 29, 2022 23:00
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.

None yet

2 participants