Skip to content

Commit

Permalink
Domain V1 deprecation cleanup (#2639)
Browse files Browse the repository at this point in the history
* Remove domain V1 schema
* Fix cadence-system domain migration issue
  • Loading branch information
wxing1292 authored Oct 5, 2019
1 parent ef14cb2 commit 6d70d9a
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 38 deletions.
1 change: 1 addition & 0 deletions common/domain/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ func (s *domainHandlerCommonSuite) TestListDomain() {
domains[resp.Domains[0].DomainInfo.GetName()] = resp.Domains[0]
}
}
delete(domains, common.SystemLocalDomainName)
s.Equal(map[string]*shared.DescribeDomainResponse{
domainName1: &shared.DescribeDomainResponse{
DomainInfo: &shared.DomainInfo{
Expand Down
32 changes: 15 additions & 17 deletions schema/cassandra/cadence/schema.cql
Original file line number Diff line number Diff line change
Expand Up @@ -402,20 +402,6 @@ CREATE TABLE domains (
'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'
};

CREATE TABLE domains_by_name (
name text,
domain frozen<domain>,
config frozen<domain_config>,
replication_config frozen<domain_replication_config>, -- indicating active cluster and standby cluster used for replication
is_global_domain boolean, -- indicating whether a domain is a global domain
config_version bigint, -- indicating the version of domain config, excluding the failover / change of active cluster name
failover_version bigint, -- indicating the version of active domain only, used for domain failover
db_version bigint, -- indicate the version of the record, used for update
PRIMARY KEY (name)
) WITH COMPACTION = {
'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'
};

CREATE TABLE domains_by_name_v2 (
domains_partition int,
name text,
Expand All @@ -432,11 +418,18 @@ CREATE TABLE domains_by_name_v2 (
'class': 'org.apache.cassandra.db.compaction.LeveledCompactionStrategy'
};

INSERT INTO domains_by_name (
INSERT INTO domains_by_name_v2 (
domains_partition,
name,
domain,
config
config,
is_global_domain,
config_version,
failover_version,
failover_notification_version,
notification_version
) VALUES (
0,
'cadence-system',
{
id: 32049b68-7872-4094-8e63-d0dd59896a83,
Expand All @@ -447,7 +440,12 @@ INSERT INTO domains_by_name (
{
retention:3,
emit_metric:False
}
},
False,
0,
-24,
-1,
-1
) IF NOT EXISTS;

INSERT INTO domains (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
INSERT INTO domains_by_name (
name,
domain,
config
) VALUES (
'cadence-system',
{
id: 32049b68-7872-4094-8e63-d0dd59896a83,
name: 'cadence-system',
description: 'cadence system workflow domain',
owner_email: 'cadence-dev-group@uber.com'
},
{
retention:3,
emit_metric:False
}
) IF NOT EXISTS;

INSERT INTO domains (
id,
domain
Expand Down
3 changes: 2 additions & 1 deletion schema/cassandra/cadence/versioned/v0.23/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"Description": "Add queue table and version history",
"SchemaUpdateCqlFiles": [
"version_histories.cql",
"queue.cql"
"queue.cql",
"system_domain.cql"
]
}
29 changes: 29 additions & 0 deletions schema/cassandra/cadence/versioned/v0.23/system_domain.cql
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
INSERT INTO domains_by_name_v2 (
domains_partition,
name,
domain,
config,
is_global_domain,
config_version,
failover_version,
failover_notification_version,
notification_version
) VALUES (
0,
'cadence-system',
{
id: 32049b68-7872-4094-8e63-d0dd59896a83,
name: 'cadence-system',
description: 'cadence system workflow domain',
owner_email: 'cadence-dev-group@uber.com'
},
{
retention:3,
emit_metric:False
},
False,
0,
-24,
-1,
-1
) IF NOT EXISTS;
5 changes: 3 additions & 2 deletions service/worker/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ import (
"sync/atomic"
"time"

cshared "go.uber.org/cadence/.gen/go/shared"
cclient "go.uber.org/cadence/client"

"github.com/uber/cadence/.gen/go/shared"
"github.com/uber/cadence/common"
carchiver "github.com/uber/cadence/common/archiver"
Expand All @@ -46,8 +49,6 @@ import (
"github.com/uber/cadence/service/worker/parentclosepolicy"
"github.com/uber/cadence/service/worker/replicator"
"github.com/uber/cadence/service/worker/scanner"
cshared "go.uber.org/cadence/.gen/go/shared"
cclient "go.uber.org/cadence/client"
)

type (
Expand Down

0 comments on commit 6d70d9a

Please sign in to comment.