Skip to content

Conversation

@arzonus
Copy link
Contributor

@arzonus arzonus commented Nov 17, 2025

What changed?

  • RFC3339Nano has been introduced for time storing to increase precision for time
  • etcdtypes package has been created for data structures stored in etcd
  • etcdkeys package has been updated, redundant error returns have been removed from build functions, comments have been added, new constants have been added

Why?

  • Previously, int64 was used to save time in Unix seconds format. However, this precision was not enough for measuring latencies. A new time type uses RFC3339Nano 2006-01-02T15:04:05.999999999Z07:00 and has been introduced to keep consistency during time handling in etcd.

How did you test it?

  • Unit tests
  • Integration tests

Potential risks

Release notes

Documentation Changes

@arzonus arzonus force-pushed the CDNC-16878-sd-refactor-time-in-storage branch 2 times, most recently from 283bbac to 105d4a5 Compare November 18, 2025 08:47
@arzonus arzonus changed the title feat(shard-distributor): introduce milliseconds and dtos to etcd store feat(shard-distributor): introduce rfc3339nano and dtos to etcd store Nov 18, 2025
@arzonus arzonus changed the title feat(shard-distributor): introduce rfc3339nano and dtos to etcd store feat(shard-distributor): refactor time handling and data store structures in etcd Nov 18, 2025
@arzonus arzonus force-pushed the CDNC-16878-sd-refactor-time-in-storage branch from cd6edde to f1dc7cb Compare November 18, 2025 11:58
@arzonus arzonus changed the title feat(shard-distributor): refactor time handling and data store structures in etcd feat(shard-distributor): refactor time handling, data store structures, key building in etcd Nov 18, 2025
@arzonus arzonus force-pushed the CDNC-16878-sd-refactor-time-in-storage branch from f1dc7cb to 00b2219 Compare November 18, 2025 12:11
@arzonus arzonus force-pushed the CDNC-16878-sd-refactor-time-in-storage branch from ffeb52c to 66ce47e Compare November 18, 2025 15:00
Copy link
Member

@jakobht jakobht left a comment

Choose a reason for hiding this comment

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

Looks good, left a few questions

import "fmt"

//go:generate enumer -type=ExecutorStatus,ShardStatus,AssignmentStatus,MigrationMode -json -output sharddistributor_statuses_enumer_generated.go
//go:generate enumer -type=ExecutorStatus,ShardStatus,AssignmentStatus,MigrationMode -trimprefix=ExecutorStatus,ShardStatus,AssignmentStatus,MigrationMode -json -output sharddistributor_statuses_enumer_generated.go
Copy link
Member

Choose a reason for hiding this comment

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

I guess this changes the DB data, is there something we should be cautious about when deploying (we are still prototyping, so now is the time to do it, but is there anything we need to do?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's going to change the DB data, and I agree it's the best time to do it :)
One of the reasons that all our data stored in ETCD contains a type prefix, for example: AssignmentStatusREADY was stored as AssignmentStatusREADY, but not like READY. For me, it was a bit confusing, so I assumed it wasn't done in purpose and was just a typ,o and we should fix it now.

I haven't tested this in terms of backward compatibility, so I assume that SD may fail and it will not work with the existing data stored in etcd, so perhaps we need to clean up the database before deploying.

}

isActive := executor.Status == types.ExecutorStatusACTIVE
isNotStale := (now - executor.LastHeartbeat) <= shardStatsTTL
Copy link
Member

Choose a reason for hiding this comment

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

I see we are changing shardStatsTTL to hearbeatTTL - I think the shardStatsTTL was introduced to ensure we didn't do it too often. Just want to make sure this is changed on purpose :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I just removed the conversion from Time to seconds. Don't think we need to keep a copy of cfg.HeartbeatTTL :)

@arzonus arzonus merged commit 6a4ab3d into cadence-workflow:master Nov 24, 2025
43 checks passed
@arzonus arzonus deleted the CDNC-16878-sd-refactor-time-in-storage branch November 24, 2025 10:51
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