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 task list partition config #6343

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Add task list partition config #6343

merged 1 commit into from
Oct 18, 2024

Conversation

Shaddoll
Copy link
Contributor

@Shaddoll Shaddoll commented Oct 9, 2024

Detailed Description

  • Update Cassandra schema with new task_list_partition_config type and add the type as a new field to task_list type.
  • Pull the latest idl update.
  • Update persistence layer to store task_list_partition_config in database.

Impact Analysis

  • Backward Compatibility: It's backward compatible.
  • Forward Compatibility: It's forward compatible. Old binaries will ignore the new field introduced in this PR when reading data.

Testing Plan

  • Unit Tests: Yes
  • Persistence Tests: Yes
  • Integration Tests: Yes
  • Compatibility Tests: Backward/Forward compatibility has been checked on laptop.

Rollout Plan

  • What is the rollout plan? We need to update cassandra schema before rollout.
  • Does the order of deployment matter? No.
  • Is it safe to rollback? Does the order of rollback matter? It's safe to rollback.
  • Is there a kill switch to mitigate the impact immediately? No.

@Shaddoll Shaddoll changed the title wip: Add task list partition config to schema Add task list partition config Oct 14, 2024
Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 93.71069% with 10 lines in your changes missing coverage. Please review.

Project coverage is 74.51%. Comparing base (a32159c) to head (7695348).
Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
...n/persistence/nosql/nosqlplugin/cassandra/tasks.go 85.71% 2 Missing and 2 partials ⚠️
common/persistence/nosql/nosql_task_store.go 95.55% 1 Missing and 1 partial ⚠️
common/persistence/sql/sql_task_store.go 96.55% 1 Missing and 1 partial ⚠️
common/persistence/taskManager.go 0.00% 2 Missing ⚠️
Additional details and impacted files
Files with missing lines Coverage Δ
common/persistence/data_manager_interfaces.go 96.03% <ø> (ø)
common/persistence/data_store_interfaces.go 100.00% <ø> (ø)
common/persistence/serialization/thrift_mapper.go 89.64% <100.00%> (+0.28%) ⬆️
...ommon/persistence/wrappers/errorinjectors/utils.go 91.56% <100.00%> (+0.06%) ⬆️
common/persistence/nosql/nosql_task_store.go 72.97% <95.55%> (+1.90%) ⬆️
common/persistence/sql/sql_task_store.go 82.75% <96.55%> (+1.86%) ⬆️
common/persistence/taskManager.go 0.00% <0.00%> (ø)
...n/persistence/nosql/nosqlplugin/cassandra/tasks.go 97.79% <85.71%> (-1.40%) ⬇️

... and 5 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a32159c...7695348. Read the comment docs.

CREATE TYPE task_list (
domain_id uuid,
name text,
type int, -- enum TaskRowType {ActivityTask, DecisionTask}
ack_level bigint, -- task_id of the last acknowledged message
kind int, -- enum TaskListKind {Normal, Sticky}
last_updated timestamp
last_updated timestamp,
adaptive_partition_config frozen<task_list_partition_config>
Copy link
Contributor

Choose a reason for hiding this comment

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

the use of the word adaptive here precludes it for being used in other contexts. What do you think about just partition_config in case it isn't set to be adaptive for some reason?

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 don't want to confuse this config with the partition_config for zonal isolation.

@@ -66,6 +66,11 @@ func TestSelectTaskList(t *testing.T) {
(*tlDB)["ack_level"] = int64(1000)
(*tlDB)["kind"] = 2
(*tlDB)["last_updated"] = now
(*tlDB)["adaptive_partition_config"] = map[string]interface{}{
Copy link
Contributor

Choose a reason for hiding this comment

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

Nonblocking/Nit: It might be be worth doing a round-trip test on the to and from mapping functions to ensure that no fields get dropped in the future.

CREATE TYPE task_list (
domain_id uuid,
name text,
type int, -- enum TaskRowType {ActivityTask, DecisionTask}
ack_level bigint, -- task_id of the last acknowledged message
kind int, -- enum TaskListKind {Normal, Sticky}
last_updated timestamp
last_updated timestamp,
adaptive_partition_config frozen<task_list_partition_config>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should make this a byte array representing a thrift serialized blob. This way further iterations on this adaptive_partition_config (e.g. adding zone info or other metadata) will not require DB schema change

Copy link
Contributor Author

@Shaddoll Shaddoll Oct 18, 2024

Choose a reason for hiding this comment

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

My argument is if we want to use serialized blob, we should do it for task_list and task type. And that's what temporal does.

Copy link
Contributor

@taylanisikdemir taylanisikdemir Oct 18, 2024

Choose a reason for hiding this comment

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

I think any future structs like this (no-need-to-query-fields) that we introduce going forward should be modeled as binary blob for flexibility purposes, therefore no more new DB types. Migrating away from existing DB types to blob approach is not P0 in my mind. We can consider a major schema at some point and that would the good time to get model such structs as blob.
However if you think extending this DB type with a few more fields in the near future is not going to be too much work (including the schema rollout) then let's go ahead with this.

Comment on lines +418 to +419
_, ok = err.(*p.ConditionFailedError)
s.True(ok)
Copy link
Contributor

Choose a reason for hiding this comment

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

these 3 lines can be replaces by s.ErrorAs

@@ -260,13 +260,21 @@ CREATE TYPE task (
partition_config map<text, text>
);

CREATE TYPE task_list_partition_config (
Copy link
Contributor

Choose a reason for hiding this comment

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

@natemort can you check this type and give feedback on what fields you would need for upcoming zonal isolation improvements?
It's better to avoid extra schema changes but if we don't know the shape of it then it's fine. We can come back and change this later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed with Zijian, this approach is fine and isn't incompatible. We'll make additional changes in the future since things are a little up in the air still.

@Shaddoll Shaddoll merged commit 9b75b7d into uber:master Oct 18, 2024
21 checks passed
@Shaddoll Shaddoll deleted the schema branch October 18, 2024 19:22
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.

4 participants