diff --git a/cmd/server/go.mod b/cmd/server/go.mod index 3a8c6c92438..e85790739f2 100644 --- a/cmd/server/go.mod +++ b/cmd/server/go.mod @@ -26,7 +26,7 @@ require ( github.com/gocql/gocql v0.0.0-20211015133455-b225f9b53fa1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/mock v1.6.0 // indirect - github.com/google/uuid v1.5.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/hashicorp/go-version v1.2.0 // indirect github.com/iancoleman/strcase v0.2.0 // indirect github.com/jmoiron/sqlx v1.2.1-0.20200615141059-0794cb1f47ee // indirect @@ -57,7 +57,7 @@ require ( go.uber.org/yarpc v1.70.3 // indirect go.uber.org/zap v1.13.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sync v0.7.0 // indirect + golang.org/x/sync v0.10.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.22.0 // indirect gonum.org/v1/gonum v0.7.0 // indirect @@ -146,14 +146,14 @@ require ( go.opencensus.io v0.24.0 // indirect go.uber.org/dig v1.10.0 // indirect go.uber.org/net/metrics v1.3.0 // indirect - golang.org/x/crypto v0.24.0 // indirect + golang.org/x/crypto v0.32.0 // indirect golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect golang.org/x/mod v0.18.0 // indirect golang.org/x/oauth2 v0.11.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.128.0 // indirect google.golang.org/appengine v1.6.7 // indirect diff --git a/cmd/server/go.sum b/cmd/server/go.sum index a7d6d5d535c..6b3e52fb107 100644 --- a/cmd/server/go.sum +++ b/cmd/server/go.sum @@ -201,8 +201,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= @@ -495,8 +495,8 @@ golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -563,8 +563,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -598,8 +598,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -611,8 +611,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20170927054726-6dc17368e09b/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= diff --git a/common/archiver/gcloud/go.mod b/common/archiver/gcloud/go.mod index 3b436c68183..ea57ff09add 100644 --- a/common/archiver/gcloud/go.mod +++ b/common/archiver/gcloud/go.mod @@ -22,7 +22,7 @@ require ( github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/mock v1.6.0 // indirect - github.com/google/uuid v1.5.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/m3db/prometheus_client_golang v0.8.1 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709 // indirect @@ -41,7 +41,7 @@ require ( go.uber.org/yarpc v1.70.3 // indirect go.uber.org/zap v1.13.0 // indirect golang.org/x/net v0.26.0 // indirect - golang.org/x/sync v0.7.0 // indirect + golang.org/x/sync v0.10.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.22.0 // indirect google.golang.org/grpc v1.59.0 // indirect @@ -95,12 +95,12 @@ require ( github.com/uber-go/mapdecode v1.0.0 // indirect go.opencensus.io v0.24.0 // indirect go.uber.org/net/metrics v1.3.0 // indirect - golang.org/x/crypto v0.24.0 // indirect + golang.org/x/crypto v0.32.0 // indirect golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect golang.org/x/mod v0.18.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect diff --git a/common/archiver/gcloud/go.sum b/common/archiver/gcloud/go.sum index 44103006388..e82daf86fc7 100644 --- a/common/archiver/gcloud/go.sum +++ b/common/archiver/gcloud/go.sum @@ -138,8 +138,8 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/s2a-go v0.1.4 h1:1kZ/sQM3srePvKs3tXAvQzo66XfcReoqFpIpIccE7Oc= github.com/google/s2a-go v0.1.4/go.mod h1:Ej+mSEMGRnqRzjc7VtF+jdBwYG5fuJfiZ8ELkjEwM0A= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.2.4 h1:uGy6JWR/uMIILU8wbf+OkstIrNiMjGpEIyhx8f6W7s4= github.com/googleapis/enterprise-certificate-proxy v0.2.4/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.12.0 h1:A+gCJKdRfqXkr+BIRGtZLibNXf0m1f9E4HG56etFpas= @@ -346,8 +346,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20231226003508-02704c960a9b h1:kLiC65FbiHWFAOu+lxwNPujcsl8VYyTYYEZnsOO1WK4= golang.org/x/exp v0.0.0-20231226003508-02704c960a9b/go.mod h1:iRJReGqOEeBhDZGkGbynYwcHlctCvnjTYIamk7uXpHI= @@ -408,8 +408,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -437,8 +437,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -450,8 +450,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20170927054726-6dc17368e09b/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= diff --git a/common/persistence/sql/sqlplugin/sqlite/admin.go b/common/persistence/sql/sqlplugin/sqlite/admin.go new file mode 100644 index 00000000000..99b68df3a0f --- /dev/null +++ b/common/persistence/sql/sqlplugin/sqlite/admin.go @@ -0,0 +1,37 @@ +// The MIT License (MIT) + +// Copyright (c) 2017-2020 Uber Technologies Inc. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package sqlite + +import "errors" + +// CreateDatabase is not supported by sqlite +// each sqlite file is a database +func (mdb *DB) CreateDatabase(name string) error { + return errors.New("sqlite doesn't support creating database") +} + +// DropDatabase is not supported by sqlite +// each sqlite file is a database +func (mdb *DB) DropDatabase(name string) error { + return errors.New("sqlite doesn't support dropping database") +} diff --git a/common/persistence/sql/sqlplugin/sqlite/db.go b/common/persistence/sql/sqlplugin/sqlite/db.go index 2eadb6f12d2..e78d8933a1d 100644 --- a/common/persistence/sql/sqlplugin/sqlite/db.go +++ b/common/persistence/sql/sqlplugin/sqlite/db.go @@ -29,6 +29,11 @@ import ( "github.com/uber/cadence/common/persistence/sql/sqlplugin" "github.com/uber/cadence/common/persistence/sql/sqlplugin/mysql" + + // import sqlite driver + _ "github.com/ncruces/go-sqlite3/driver" + // import embed sqlite db + _ "github.com/ncruces/go-sqlite3/embed" ) var ( diff --git a/common/persistence/sql/sqlplugin/sqlite/dsn.go b/common/persistence/sql/sqlplugin/sqlite/dsn.go new file mode 100644 index 00000000000..0df683d2e1a --- /dev/null +++ b/common/persistence/sql/sqlplugin/sqlite/dsn.go @@ -0,0 +1,188 @@ +// The MIT License (MIT) + +// Copyright (c) 2017-2020 Uber Technologies Inc. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package sqlite + +import ( + "bytes" + "fmt" + "sort" + "strings" + + "github.com/uber/cadence/common/config" +) + +// buildDSN builds the data source name for sqlite from config.SQL +// If DatabaseName is not provided, then sqlite will use in-memory database, otherwise it will use the file as the database +// All dsn attributes can be set up in the ConnectAttributes field of the config.SQL +// Available attributes can be found here: https://github.com/ncruces/go-sqlite3/blob/main/driver/driver.go +// PRAGMA attributes should start with "_pragma." prefix +// example: "_pragma.journal_mode":"wal" will be transformed to "_pragma=journal_mode(wal)" +// More about PRAGMA attributes: https://sqlite.org/pragma.html +// Default PRAGMA values if not provided: +// - journal_mode: WAL (file only) - https://sqlite.org/pragma.html#pragma_journal_mode +// - busy_timeout: 60 seconds - https://sqlite.org/pragma.html#pragma_busy_timeout +func buildDSN(cfg *config.SQL) string { + + // by default, we use in-memory database if no database name is provided + var dsn = "file::memory:" + + // if database name is provided, then sqlite will use the file as the database + if cfg.DatabaseName != "" { + dsn = fmt.Sprintf("file:%s", cfg.DatabaseName) + + } + + if dsnAttrs := buildDSNAttrs(cfg); dsnAttrs != "" { + dsn += "?" + dsnAttrs + } + + return dsn +} + +const ( + // if journal mode is not provided, we set it to WAL by default + // WAL mode allows readers and writers from different processes + // to access the database concurrently by default + // https://sqlite.org/pragma.html#pragma_journal_mode + // https://www.sqlite.org/wal.html + pragmaJournalModeAttrName = "_pragma.journal_mode" + pragmaJournalModeDefaultValue = "WAL" + + // if busy_timeout is not provided, we set it to 60 seconds by default + // https://sqlite.org/pragma.html#pragma_busy_timeout + pragmaBusyTimeoutAttrName = "_pragma.busy_timeout" + pragmaBusyTimeoutDefault = "60000" +) + +// buildDSNAttrs builds the data source name attributes for sqlite from config.SQL +func buildDSNAttrs(cfg *config.SQL) string { + + sanitizedAttrs := sanitizeDSNAttrs(cfg.ConnectAttributes) + + if cfg.DatabaseName != "" { + defaultIfEmpty(sanitizedAttrs, pragmaJournalModeAttrName, pragmaJournalModeDefaultValue) + } + + defaultIfEmpty(sanitizedAttrs, pragmaBusyTimeoutAttrName, pragmaBusyTimeoutDefault) + return joinDSNAttrs(sanitizedAttrs) +} + +// defaultIfEmpty sets the value to the key if the key is not present in the attributes +func defaultIfEmpty(attrs map[string]string, key, value string) { + if hasAttr(attrs, key) { + return + } + attrs[key] = value +} + +// hasAttr checks if the attributes map has any of the keys +func hasAttr(attrs map[string]string, keys ...string) bool { + for key := range attrs { + for _, k := range keys { + if key == k { + return true + } + } + } + return false +} + +// sanitizeDSNAttrs sanitizes the attributes by trimming the keys and values +func sanitizeDSNAttrs(attrs map[string]string) map[string]string { + sanitized := make(map[string]string, len(attrs)) + + for k, v := range attrs { + k, v = sanitizeDSNAttrKey(k), sanitizeDSNAttrValue(v) + sanitized[k] = v + } + + return sanitized +} + +const ( + // pragmaKey is the key is used to set pragma arguments in the DSN + pragmaKey = "_pragma" + + // pragmaPrefix is the prefix used to identify pragma arguments in the config + pragmaPrefix = "_pragma." +) + +// isPragmaKey checks if the key is a pragma key +func isPragmaKey(key string) bool { + return strings.HasPrefix(key, pragmaPrefix) +} + +// transformPragmaArgument transforms the pragma argument to the format that can be used in the DSN +// example: "_pragma.journal_mode":"wal" -> "_pragma=journal_mode(wal)" +func transformPragmaArgument(key, value string) (newKey, newValue string) { + return pragmaKey, fmt.Sprintf("%s(%s)", strings.TrimPrefix(key, pragmaPrefix), value) +} + +// sanitizeDSNAttrElem trims the value, lowercases it +func sanitizeDSNAttrKey(v string) string { + return strings.TrimSpace(strings.ToLower(v)) +} + +// sanitizeDSNAttrElem trims the value, lowercases it +func sanitizeDSNAttrValue(v string) string { + return strings.TrimSpace(v) +} + +// sortedKeys returns the sorted keys of the map +func sortMapKeys(m map[string]string) []string { + keys := make([]string, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + + sort.Strings(keys) + return keys +} + +// joinDSNAttrs joins the attributes into a single string +// with key=value pairs separated by & and escaped +func joinDSNAttrs(attrs map[string]string) string { + first := true + var buf bytes.Buffer + + // sort the keys to make the order of the attributes deterministic + sortedKeys := sortMapKeys(attrs) + + for _, k := range sortedKeys { + v := attrs[k] + + // pragma arguments should be transformed to the format that can be used in the DSN + if isPragmaKey(k) { + k, v = transformPragmaArgument(k, v) + } + + if !first { + buf.WriteString("&") + } + first = false + buf.WriteString(k) + buf.WriteString("=") + buf.WriteString(v) + } + return buf.String() +} diff --git a/common/persistence/sql/sqlplugin/sqlite/dsn_test.go b/common/persistence/sql/sqlplugin/sqlite/dsn_test.go new file mode 100644 index 00000000000..217c6aba8d1 --- /dev/null +++ b/common/persistence/sql/sqlplugin/sqlite/dsn_test.go @@ -0,0 +1,85 @@ +// The MIT License (MIT) + +// Copyright (c) 2017-2020 Uber Technologies Inc. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package sqlite + +import ( + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/uber/cadence/common/config" +) + +func Test_buildDSN(t *testing.T) { + for name, c := range map[string]struct { + cfg *config.SQL + want string + }{ + "empty": { + cfg: &config.SQL{}, + want: "file::memory:?_pragma=busy_timeout(10000)", + }, + "database name only": { + cfg: &config.SQL{ + DatabaseName: "cadence.db", + }, + want: "file:cadence.db?_pragma=busy_timeout(10000)&_pragma=journal_mode(WAL)", + }, + } { + t.Run(name, func(t *testing.T) { + dsn := buildDSN(c.cfg) + assert.Equal(t, c.want, dsn) + }) + } +} + +func Test_buildDSN_attrs(t *testing.T) { + for name, c := range map[string]struct { + cfg *config.SQL + want string + }{ + "only connection attrs": { + cfg: &config.SQL{ + ConnectAttributes: map[string]string{ + "_busy_timeout": "10000", + "_FK": "true", + }, + }, + want: "file::memory:?_busy_timeout=10000&_fk=true&_pragma=busy_timeout(10000)", + }, + "database name and connection attrs": { + cfg: &config.SQL{ + DatabaseName: "cadence.db", + ConnectAttributes: map[string]string{ + "cache1 ": "NONe ", + }, + }, + want: "file:cadence.db?_pragma=busy_timeout(10000)&_pragma=journal_mode(WAL)&cache1=NONe", + }, + } { + t.Run(name, func(t *testing.T) { + dsn := buildDSN(c.cfg) + assert.Contains(t, c.want, dsn) + }) + } +} diff --git a/common/persistence/sql/sqlplugin/sqlite/plugin.go b/common/persistence/sql/sqlplugin/sqlite/plugin.go index daa3781b3e5..0f0b4bdb7a6 100644 --- a/common/persistence/sql/sqlplugin/sqlite/plugin.go +++ b/common/persistence/sql/sqlplugin/sqlite/plugin.go @@ -22,6 +22,72 @@ package sqlite +import ( + "github.com/iancoleman/strcase" + "github.com/jmoiron/sqlx" + + "github.com/uber/cadence/common/config" + "github.com/uber/cadence/common/persistence/sql" + "github.com/uber/cadence/common/persistence/sql/sqldriver" + "github.com/uber/cadence/common/persistence/sql/sqlplugin" +) + const ( PluginName = "sqlite" ) + +// SQLite plugin provides an sql persistence storage implementation for sqlite database +// Mostly the implementation reuses the mysql implementation +// The plugin supports only in-memory sqlite database for now +type plugin struct{} + +var _ sqlplugin.Plugin = (*plugin)(nil) + +func init() { + sql.RegisterPlugin(PluginName, &plugin{}) +} + +// CreateDB wraps createDB to return an instance of sqlplugin.DB +func (p *plugin) CreateDB(cfg *config.SQL) (sqlplugin.DB, error) { + return p.createDB(cfg) +} + +// CreateAdminDB wraps createDB to return an instance of sqlplugin.AdminDB +func (p *plugin) CreateAdminDB(cfg *config.SQL) (sqlplugin.AdminDB, error) { + return p.createDB(cfg) +} + +// createDB create a new instance of DB +func (p *plugin) createDB(cfg *config.SQL) (*DB, error) { + conns, err := sqldriver.CreateDBConnections(cfg, func(cfg *config.SQL) (*sqlx.DB, error) { + return p.createSingleDBConn(cfg) + }) + if err != nil { + return nil, err + } + return NewDB(conns, nil, sqlplugin.DbShardUndefined, cfg.NumShards) +} + +// createSingleDBConn creates a single database connection for sqlite +// Plugin respects the following arguments MaxConns, MaxIdleConns, MaxConnLifetime +// Other arguments are used and described in buildDSN function +func (p *plugin) createSingleDBConn(cfg *config.SQL) (*sqlx.DB, error) { + db, err := sqlx.Connect("sqlite3", buildDSN(cfg)) + if err != nil { + return nil, err + } + + if cfg.MaxConns > 0 { + db.SetMaxOpenConns(cfg.MaxConns) + } + if cfg.MaxIdleConns > 0 { + db.SetMaxIdleConns(cfg.MaxIdleConns) + } + if cfg.MaxConnLifetime > 0 { + db.SetConnMaxLifetime(cfg.MaxConnLifetime) + } + + // Maps struct names in CamelCase to snake without need for DB struct tags. + db.MapperFunc(strcase.ToSnake) + return db, nil +} diff --git a/common/persistence/sql/sqlplugin/sqlite/plugin_test.go b/common/persistence/sql/sqlplugin/sqlite/plugin_test.go new file mode 100644 index 00000000000..0350904925f --- /dev/null +++ b/common/persistence/sql/sqlplugin/sqlite/plugin_test.go @@ -0,0 +1,64 @@ +// The MIT License (MIT) + +// Copyright (c) 2017-2020 Uber Technologies Inc. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package sqlite + +import ( + "os" + "path" + "testing" + + "github.com/google/uuid" + "github.com/stretchr/testify/assert" + + "github.com/uber/cadence/common/config" +) + +func TestPlugin_CreateDB(t *testing.T) { + for name, cfg := range map[string]*config.SQL{ + "in-memory": {}, + "temp file": {DatabaseName: path.Join(os.TempDir(), uuid.New().String())}, + } { + t.Run(name, func(t *testing.T) { + p := &plugin{} + db, err := p.CreateDB(cfg) + + assert.NoError(t, err) + assert.NotNil(t, db) + }) + } +} + +func TestPlugin_CreateAdminDB(t *testing.T) { + for name, cfg := range map[string]*config.SQL{ + "in-memory": {}, + "temp file": {DatabaseName: path.Join(os.TempDir(), uuid.New().String())}, + } { + t.Run(name, func(t *testing.T) { + p := &plugin{} + db, err := p.CreateAdminDB(cfg) + + assert.NoError(t, err) + assert.NotNil(t, db) + }) + } +} diff --git a/go.mod b/go.mod index 8da9b0ef3b4..7f4fc44ac6d 100644 --- a/go.mod +++ b/go.mod @@ -22,7 +22,7 @@ require ( github.com/golang-jwt/jwt/v5 v5.2.0 github.com/golang/mock v1.6.0 github.com/google/go-cmp v0.6.0 - github.com/google/uuid v1.5.0 + github.com/google/uuid v1.6.0 github.com/hashicorp/go-version v1.2.0 github.com/iancoleman/strcase v0.2.0 github.com/jmespath/go-jmespath v0.4.0 @@ -60,7 +60,7 @@ require ( go.uber.org/zap v1.13.0 golang.org/x/exp v0.0.0-20231226003508-02704c960a9b golang.org/x/net v0.26.0 - golang.org/x/sync v0.7.0 + golang.org/x/sync v0.10.0 golang.org/x/time v0.5.0 golang.org/x/tools v0.22.0 gonum.org/v1/gonum v0.7.0 @@ -72,10 +72,15 @@ require ( require ( github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 github.com/google/gofuzz v1.0.0 + github.com/ncruces/go-sqlite3 v0.22.0 go.uber.org/mock v0.5.0 ) -require github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect +require ( + github.com/ncruces/julianday v1.0.0 // indirect + github.com/tetratelabs/wazero v1.8.2 // indirect + github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect +) require ( github.com/BurntSushi/toml v1.3.2 // indirect @@ -139,12 +144,12 @@ require ( go.uber.org/dig v1.10.0 // indirect go.uber.org/goleak v1.0.0 go.uber.org/net/metrics v1.3.0 // indirect - golang.org/x/crypto v0.24.0 // indirect + golang.org/x/crypto v0.32.0 // indirect golang.org/x/exp/typeparams v0.0.0-20220218215828-6cf2b201936e // indirect golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect golang.org/x/mod v0.18.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index b1fd2ad5839..72db2b9aa35 100644 --- a/go.sum +++ b/go.sum @@ -209,8 +209,8 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/pprof v0.0.0-20181127221834-b4f47329b966/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= -github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= @@ -322,6 +322,10 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/ncruces/go-sqlite3 v0.22.0 h1:FkGSBhd0TY6e66k1LVhyEpA+RnG/8QkQNed5pjIk4cs= +github.com/ncruces/go-sqlite3 v0.22.0/go.mod h1:ueXOZXYZS2OFQirCU3mHneDwJm5fGKHrtccYBeGEV7M= +github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= +github.com/ncruces/julianday v1.0.0/go.mod h1:Dusn2KvZrrovOMJuOt0TNXL6tB7U2E8kvza5fFc9G7g= github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8= github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= github.com/olivere/elastic v6.2.37+incompatible h1:UfSGJem5czY+x/LqxgeCBgjDn6St+z8OnsCuxwD3L0U= @@ -436,6 +440,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tetratelabs/wazero v1.8.2 h1:yIgLR/b2bN31bjxwXHD8a3d+BogigR952csSDdLYEv4= +github.com/tetratelabs/wazero v1.8.2/go.mod h1:yAI0XTsMBhREkM/YDAK/zNou3GoiAce1P6+rp/wQhjs= github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/uber-common/bark v1.2.1 h1:cREJ9b7CpTjwZr0/5wV82fXlitoCIEHHnt9WkQ4lIk0= @@ -539,8 +545,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -604,8 +610,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -643,8 +649,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -656,8 +662,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20170927054726-6dc17368e09b/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= diff --git a/go.work.sum b/go.work.sum index 2d8fc4fec63..19933e77854 100644 --- a/go.work.sum +++ b/go.work.sum @@ -329,6 +329,8 @@ github.com/dave/gopackages v0.0.0-20170318123100-46e7023ec56e h1:l99YKCdrK4Lvb/z github.com/dave/jennifer v1.2.0 h1:S15ZkFMRoJ36mGAQgWL1tnr0NQJh9rZ8qatseX/VbBc= github.com/dave/kerr v0.0.0-20170318121727-bc25dd6abe8e h1:xURkGi4RydhyaYR6PzcyHTueQudxY4LgxN1oYEPJHa0= github.com/dave/rebecca v0.9.1 h1:jxVfdOxRirbXL28vXMvUvJ1in3djwkVKXCq339qhBL0= +github.com/dchest/siphash v1.2.3 h1:QXwFc8cFOR2dSa/gE6o/HokBMWtLUaNDVd+22aKHeEA= +github.com/dchest/siphash v1.2.3/go.mod h1:0NvQU092bT0ipiFN++/rXm69QG9tVxLAlQHIXMPAkHc= github.com/denis-tingajkin/go-header v0.4.2 h1:jEeSF4sdv8/3cT/WY8AgDHUoItNSoEZ7qg9dX7pc218= github.com/denis-tingajkin/go-header v0.4.2/go.mod h1:eLRHAVXzE5atsKAnNRDB90WHCFFnBUn4RN0nRcs1LJA= github.com/denisenkom/go-mssqldb v0.9.0 h1:RSohk2RsiZqLZ0zCjtfn3S4Gp4exhpBWHyQ7D0yGjAk= @@ -393,7 +395,6 @@ github.com/google/go-pkcs11 v0.2.0 h1:5meDPB26aJ98f+K9G21f0AqZwo/S5BJMJh8nuhMbds github.com/google/go-pkcs11 v0.2.0/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY= github.com/google/go-pkcs11 v0.2.1-0.20230907215043-c6f79328ddf9 h1:OF1IPgv+F4NmqmJ98KTjdN97Vs1JxDPB3vbmYzV2dpk= github.com/google/go-pkcs11 v0.2.1-0.20230907215043-c6f79328ddf9/go.mod h1:6eQoGcuNJpa7jnd5pMGdkSaQpNDYvPlXWMcjXXThLlY= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/pprof v0.0.0-20181127221834-b4f47329b966 h1:zpjeU3rN5R22t0iguDarIAL75+2acLnDqGLOiPttMjk= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= @@ -405,6 +406,7 @@ github.com/google/trillian v1.3.11 h1:pPzJPkK06mvXId1LHEAJxIegGgHzzp/FUnycPYfoCM github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/googleapis/enterprise-certificate-proxy v0.2.5 h1:UR4rDjcgpgEnqpIEvkiqTYKBCKLNmlge2eVjoZfySzM= github.com/googleapis/enterprise-certificate-proxy v0.2.5/go.mod h1:RxW0N9901Cko1VOCW3SXCpWP+mlIEkk2tP7jnHy9a3w= github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= @@ -506,6 +508,8 @@ github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8= github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-proto-validators v0.2.0 h1:F6LFfmgVnfULfaRsQWBbe7F7ocuHCr9+7m+GAeDzNbQ= +github.com/ncruces/sort v0.1.2 h1:zKQ9CA4fpHPF6xsUhRTfi5EEryspuBpe/QA4VWQOV1U= +github.com/ncruces/sort v0.1.2/go.mod h1:vEJUTBJtebIuCMmXD18GKo5GJGhsay+xZFOoBEIXFmE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= @@ -523,6 +527,8 @@ github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXq github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw= github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/prometheus/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= +github.com/psanford/httpreadat v0.1.0 h1:VleW1HS2zO7/4c7c7zNl33fO6oYACSagjJIyMIwZLUE= +github.com/psanford/httpreadat v0.1.0/go.mod h1:Zg7P+TlBm3bYbyHTKv/EdtSJZn3qwbPwpfZ/I9GKCRE= github.com/pseudomuto/protoc-gen-doc v1.3.2 h1:61vWZuxYa8D7Rn4h+2dgoTNqnluBmJya2MgbqO32z6g= github.com/pseudomuto/protokit v0.2.0 h1:hlnBDcy3YEDXH7kc9gV+NLaN0cDzhDvD1s7Y6FZ8RpM= github.com/quasilyte/go-ruleguard/dsl v0.3.19 h1:5+KTKb2YREUYiqZFEIuifFyBxlcCUPWgNZkWy71XS0Q= @@ -624,47 +630,45 @@ golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0 golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 h1:00VmoueYNlNz/aHIilyyQz/MHSqGoWJzpFv/HW8xpzI= golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4= golang.org/x/mobile v0.0.0-20200801112145-973feb4309de h1:OVJ6QQUBAesB8CZijKDSsXX7xYVtUhrkY0gwMfbi4p4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw= golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457 h1:zf5N6UOrA487eEFacMePxjXAJctxKmyjKUsjA11Uzuk= golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0= golang.org/x/term v0.15.0 h1:y/Oo/a/q3IXu26lQgl04j/gjuBDOBlx7X6Om1j2CPW4= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b h1:Qh4dB5D/WpoUUp3lSod7qgoyEHbDGPUWjIbnqdqqe1k= google.golang.org/api v0.139.0 h1:A1TrCPgMmOiYu0AiNkvQIpIx+D8blHTDcJ5EogkP7LI= @@ -707,6 +711,8 @@ gopkg.in/gcfg.v1 v1.2.3 h1:m8OOJ4ccYHnx2f4gQwpno8nAX5OGOh7RLaaz0pj3Ogs= gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI= gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= +lukechampine.com/adiantum v1.1.1 h1:4fp6gTxWCqpEbLy40ExiYDDED3oUNWx5cTqBCtPdZqA= +lukechampine.com/adiantum v1.1.1/go.mod h1:LrAYVnTYLnUtE/yMp5bQr0HstAf060YUF8nM0B6+rUw= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= diff --git a/schema/sqlite/cadence/schema.sql b/schema/sqlite/cadence/schema.sql new file mode 100644 index 00000000000..72bc00f9c10 --- /dev/null +++ b/schema/sqlite/cadence/schema.sql @@ -0,0 +1,302 @@ +CREATE TABLE domains +( + shard_id INT NOT NULL DEFAULT 54321, + id BINARY(16) NOT NULL, + name VARCHAR(255) UNIQUE NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + is_global TINYINT(1) NOT NULL, + PRIMARY KEY (shard_id, id) +); + +CREATE TABLE domain_metadata +( + id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + notification_version BIGINT NOT NULL +); + +INSERT INTO domain_metadata (notification_version) +VALUES (1); + +CREATE TABLE shards +( + shard_id INT NOT NULL, + -- + range_id BIGINT NOT NULL, + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id) +); + +CREATE TABLE transfer_tasks +( + shard_id INT NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, task_id) +); + +CREATE TABLE cross_cluster_tasks +( + target_cluster VARCHAR(255) NOT NULL, + shard_id INT NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (target_cluster, shard_id, task_id) +); + +CREATE TABLE executions +( + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY(16) NOT NULL, + -- + next_event_id BIGINT NOT NULL, + last_write_version BIGINT NOT NULL, + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id) +); + +CREATE TABLE current_executions +( + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + -- + run_id BINARY(16) NOT NULL, + create_request_id VARCHAR(64) NOT NULL, + state INT NOT NULL, + close_status INT NOT NULL, + start_version BIGINT NOT NULL, + last_write_version BIGINT NOT NULL, + PRIMARY KEY (shard_id, domain_id, workflow_id) +); + +CREATE TABLE buffered_events +( + id BIGINT AUTO_INCREMENT NOT NULL, + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY(16) NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (id) +); + +CREATE INDEX buffered_events_by_events_ids ON buffered_events (shard_id, domain_id, workflow_id, run_id); + +CREATE TABLE tasks +( + domain_id BINARY(16) NOT NULL, + task_list_name VARCHAR(255) NOT NULL, + task_type TINYINT NOT NULL, -- {Activity, Decision} + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (domain_id, task_list_name, task_type, task_id) +); + +CREATE TABLE task_lists +( + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + name VARCHAR(255) NOT NULL, + task_type TINYINT NOT NULL, -- {Activity, Decision} + -- + range_id BIGINT NOT NULL, + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, domain_id, name, task_type) +); + +CREATE TABLE replication_tasks +( + shard_id INT NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, task_id) +); + +CREATE TABLE replication_tasks_dlq +( + source_cluster_name VARCHAR(255) NOT NULL, + shard_id INT NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (source_cluster_name, shard_id, task_id) +); + +CREATE TABLE timer_tasks +( + shard_id INT NOT NULL, + visibility_timestamp DATETIME(6) NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, visibility_timestamp, task_id) +); + +CREATE TABLE activity_info_maps +( +-- each row corresponds to one key of one map + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY(16) NOT NULL, + schedule_id BIGINT NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + last_heartbeat_details BLOB, + last_heartbeat_updated_time DATETIME(6) NOT NULL, + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, schedule_id) +); + +CREATE TABLE timer_info_maps +( + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY(16) NOT NULL, + timer_id VARCHAR(255) NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, timer_id) +); + +CREATE TABLE child_execution_info_maps +( + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY(16) NOT NULL, + initiated_id BIGINT NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, initiated_id) +); + +CREATE TABLE request_cancel_info_maps +( + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY(16) NOT NULL, + initiated_id BIGINT NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, initiated_id) +); + +CREATE TABLE signal_info_maps +( + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY(16) NOT NULL, + initiated_id BIGINT NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, initiated_id) +); + +CREATE TABLE buffered_replication_task_maps +( + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY(16) NOT NULL, + first_event_id BIGINT NOT NULL, +-- + version BIGINT NOT NULL, + next_event_id BIGINT NOT NULL, + history MEDIUMBLOB, + history_encoding VARCHAR(16) NOT NULL, + new_run_history MEDIUMBLOB, + new_run_history_encoding VARCHAR(16) NOT NULL DEFAULT 'json', + event_store_version INT NOT NULL, -- indicates which version of event store to query + new_run_event_store_version INT NOT NULL, -- indicates which version of event store to query for new run(continueAsNew) + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, first_event_id) +); + +CREATE TABLE signals_requested_sets +( + shard_id INT NOT NULL, + domain_id BINARY(16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY(16) NOT NULL, + signal_id VARCHAR(64) NOT NULL, + -- + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, signal_id) +); + +-- history eventsV2: history_node stores history event data +CREATE TABLE history_node +( + shard_id INT NOT NULL, + tree_id BINARY(16) NOT NULL, + branch_id BINARY(16) NOT NULL, + node_id BIGINT NOT NULL, + txn_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, tree_id, branch_id, node_id, txn_id) +); + +-- history eventsV2: history_tree stores branch metadata +CREATE TABLE history_tree +( + shard_id INT NOT NULL, + tree_id BINARY(16) NOT NULL, + branch_id BINARY(16) NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, tree_id, branch_id) +); + +CREATE TABLE queue +( + queue_type INT NOT NULL, + message_id BIGINT NOT NULL, + message_payload MEDIUMBLOB NOT NULL, + PRIMARY KEY (queue_type, message_id) +); + +CREATE TABLE queue_metadata +( + queue_type INT NOT NULL, + data MEDIUMBLOB NOT NULL, + PRIMARY KEY (queue_type) +); + +CREATE TABLE cluster_config +( + row_type INT NOT NULL, + version BIGINT NOT NULL, + -- + timestamp DATETIME(6) NOT NULL, + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (row_type, version) +); diff --git a/schema/sqlite/cadence/versioned/v0.1/base.sql b/schema/sqlite/cadence/versioned/v0.1/base.sql new file mode 100644 index 00000000000..d898a589820 --- /dev/null +++ b/schema/sqlite/cadence/versioned/v0.1/base.sql @@ -0,0 +1,302 @@ +CREATE TABLE domains +( + shard_id INT NOT NULL DEFAULT 54321, + id BINARY (16) NOT NULL, + name VARCHAR(255) UNIQUE NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + is_global TINYINT(1) NOT NULL, + PRIMARY KEY (shard_id, id) +); + +CREATE TABLE domain_metadata +( + id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + notification_version BIGINT NOT NULL +); + +INSERT INTO domain_metadata (notification_version) +VALUES (1); + +CREATE TABLE shards +( + shard_id INT NOT NULL, + -- + range_id BIGINT NOT NULL, + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id) +); + +CREATE TABLE transfer_tasks +( + shard_id INT NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, task_id) +); + +CREATE TABLE cross_cluster_tasks +( + target_cluster VARCHAR(255) NOT NULL, + shard_id INT NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (target_cluster, shard_id, task_id) +); + +CREATE TABLE executions +( + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY (16) NOT NULL, + -- + next_event_id BIGINT NOT NULL, + last_write_version BIGINT NOT NULL, + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id) +); + +CREATE TABLE current_executions +( + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + -- + run_id BINARY (16) NOT NULL, + create_request_id VARCHAR(64) NOT NULL, + state INT NOT NULL, + close_status INT NOT NULL, + start_version BIGINT NOT NULL, + last_write_version BIGINT NOT NULL, + PRIMARY KEY (shard_id, domain_id, workflow_id) +); + +CREATE TABLE buffered_events +( + id BIGINT AUTO_INCREMENT NOT NULL, + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY (16) NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (id) +); + +CREATE INDEX buffered_events_by_events_ids ON buffered_events (shard_id, domain_id, workflow_id, run_id); + +CREATE TABLE tasks +( + domain_id BINARY (16) NOT NULL, + task_list_name VARCHAR(255) NOT NULL, + task_type TINYINT NOT NULL, -- {Activity, Decision} + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (domain_id, task_list_name, task_type, task_id) +); + +CREATE TABLE task_lists +( + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + name VARCHAR(255) NOT NULL, + task_type TINYINT NOT NULL, -- {Activity, Decision} + -- + range_id BIGINT NOT NULL, + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, domain_id, name, task_type) +); + +CREATE TABLE replication_tasks +( + shard_id INT NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, task_id) +); + +CREATE TABLE replication_tasks_dlq +( + source_cluster_name VARCHAR(255) NOT NULL, + shard_id INT NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (source_cluster_name, shard_id, task_id) +); + +CREATE TABLE timer_tasks +( + shard_id INT NOT NULL, + visibility_timestamp DATETIME(6) NOT NULL, + task_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, visibility_timestamp, task_id) +); + +CREATE TABLE activity_info_maps +( +-- each row corresponds to one key of one map + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY (16) NOT NULL, + schedule_id BIGINT NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + last_heartbeat_details BLOB, + last_heartbeat_updated_time DATETIME(6) NOT NULL, + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, schedule_id) +); + +CREATE TABLE timer_info_maps +( + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY (16) NOT NULL, + timer_id VARCHAR(255) NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, timer_id) +); + +CREATE TABLE child_execution_info_maps +( + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY (16) NOT NULL, + initiated_id BIGINT NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, initiated_id) +); + +CREATE TABLE request_cancel_info_maps +( + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY (16) NOT NULL, + initiated_id BIGINT NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, initiated_id) +); + +CREATE TABLE signal_info_maps +( + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY (16) NOT NULL, + initiated_id BIGINT NOT NULL, +-- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16), + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, initiated_id) +); + +CREATE TABLE buffered_replication_task_maps +( + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY (16) NOT NULL, + first_event_id BIGINT NOT NULL, +-- + version BIGINT NOT NULL, + next_event_id BIGINT NOT NULL, + history MEDIUMBLOB, + history_encoding VARCHAR(16) NOT NULL, + new_run_history MEDIUMBLOB, + new_run_history_encoding VARCHAR(16) NOT NULL DEFAULT 'json', + event_store_version INT NOT NULL, -- indicates which version of event store to query + new_run_event_store_version INT NOT NULL, -- indicates which version of event store to query for new run(continueAsNew) + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, first_event_id) +); + +CREATE TABLE signals_requested_sets +( + shard_id INT NOT NULL, + domain_id BINARY (16) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + run_id BINARY (16) NOT NULL, + signal_id VARCHAR(64) NOT NULL, + -- + PRIMARY KEY (shard_id, domain_id, workflow_id, run_id, signal_id) +); + +-- history eventsV2: history_node stores history event data +CREATE TABLE history_node +( + shard_id INT NOT NULL, + tree_id BINARY (16) NOT NULL, + branch_id BINARY (16) NOT NULL, + node_id BIGINT NOT NULL, + txn_id BIGINT NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, tree_id, branch_id, node_id, txn_id) +); + +-- history eventsV2: history_tree stores branch metadata +CREATE TABLE history_tree +( + shard_id INT NOT NULL, + tree_id BINARY (16) NOT NULL, + branch_id BINARY (16) NOT NULL, + -- + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (shard_id, tree_id, branch_id) +); + +CREATE TABLE queue +( + queue_type INT NOT NULL, + message_id BIGINT NOT NULL, + message_payload MEDIUMBLOB NOT NULL, + PRIMARY KEY (queue_type, message_id) +); + +CREATE TABLE queue_metadata +( + queue_type INT NOT NULL, + data MEDIUMBLOB NOT NULL, + PRIMARY KEY (queue_type) +); + +CREATE TABLE cluster_config +( + row_type INT NOT NULL, + version BIGINT NOT NULL, + -- + timestamp DATETIME(6) NOT NULL, + data MEDIUMBLOB NOT NULL, + data_encoding VARCHAR(16) NOT NULL, + PRIMARY KEY (row_type, version) +); diff --git a/schema/sqlite/cadence/versioned/v0.1/manifest.json b/schema/sqlite/cadence/versioned/v0.1/manifest.json new file mode 100644 index 00000000000..789002c0eef --- /dev/null +++ b/schema/sqlite/cadence/versioned/v0.1/manifest.json @@ -0,0 +1,8 @@ +{ + "CurrVersion": "0.1", + "MinCompatibleVersion": "0.1", + "Description": "base version of schema", + "SchemaUpdateCqlFiles": [ + "base.sql" + ] +} diff --git a/schema/sqlite/embed.go b/schema/sqlite/embed.go new file mode 100644 index 00000000000..dbf235be575 --- /dev/null +++ b/schema/sqlite/embed.go @@ -0,0 +1,26 @@ +// Copyright (c) 2019 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package sqlite + +import "embed" + +//go:embed cadence/* visibility/* +var SchemaFS embed.FS diff --git a/schema/sqlite/version.go b/schema/sqlite/version.go new file mode 100644 index 00000000000..1cf54302f27 --- /dev/null +++ b/schema/sqlite/version.go @@ -0,0 +1,29 @@ +// Copyright (c) 2019 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package sqlite + +// NOTE: whenever there is a new data base schema update, plz update the following versions + +// Version is the SQLite database release version +const Version = "0.1" + +// VisibilityVersion is the SQLite visibility database release version +const VisibilityVersion = "0.1" diff --git a/schema/sqlite/visibility/schema.sql b/schema/sqlite/visibility/schema.sql new file mode 100644 index 00000000000..7cedfdf7c86 --- /dev/null +++ b/schema/sqlite/visibility/schema.sql @@ -0,0 +1,26 @@ +CREATE TABLE executions_visibility +( + domain_id CHAR(64) NOT NULL, + run_id CHAR(64) NOT NULL, + start_time DATETIME(6) NOT NULL, + execution_time DATETIME(6) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + workflow_type_name VARCHAR(255) NOT NULL, + close_status INT, -- enum WorkflowExecutionCloseStatus {COMPLETED, FAILED, CANCELED, TERMINATED, CONTINUED_AS_NEW, TIMED_OUT} + close_time DATETIME(6) NULL, + history_length BIGINT, + memo BLOB, + encoding VARCHAR(64) NOT NULL, + task_list VARCHAR(255) DEFAULT '' NOT NULL, + is_cron BOOLEAN DEFAULT false NOT NULL, + num_clusters INT NULL, + update_time DATETIME(6) NULL, + shard_id INT NULL, + + PRIMARY KEY (domain_id, run_id) +); + +CREATE INDEX by_type_start_time ON executions_visibility (domain_id, workflow_type_name, close_status, start_time DESC, run_id); +CREATE INDEX by_workflow_id_start_time ON executions_visibility (domain_id, workflow_id, close_status, start_time DESC, run_id); +CREATE INDEX by_status_by_close_time ON executions_visibility (domain_id, close_status, start_time DESC, run_id); +CREATE INDEX by_close_time_by_status ON executions_visibility (domain_id, close_time DESC, run_id, close_status); diff --git a/schema/sqlite/visibility/versioned/v0.1/base.sql b/schema/sqlite/visibility/versioned/v0.1/base.sql new file mode 100644 index 00000000000..7cedfdf7c86 --- /dev/null +++ b/schema/sqlite/visibility/versioned/v0.1/base.sql @@ -0,0 +1,26 @@ +CREATE TABLE executions_visibility +( + domain_id CHAR(64) NOT NULL, + run_id CHAR(64) NOT NULL, + start_time DATETIME(6) NOT NULL, + execution_time DATETIME(6) NOT NULL, + workflow_id VARCHAR(255) NOT NULL, + workflow_type_name VARCHAR(255) NOT NULL, + close_status INT, -- enum WorkflowExecutionCloseStatus {COMPLETED, FAILED, CANCELED, TERMINATED, CONTINUED_AS_NEW, TIMED_OUT} + close_time DATETIME(6) NULL, + history_length BIGINT, + memo BLOB, + encoding VARCHAR(64) NOT NULL, + task_list VARCHAR(255) DEFAULT '' NOT NULL, + is_cron BOOLEAN DEFAULT false NOT NULL, + num_clusters INT NULL, + update_time DATETIME(6) NULL, + shard_id INT NULL, + + PRIMARY KEY (domain_id, run_id) +); + +CREATE INDEX by_type_start_time ON executions_visibility (domain_id, workflow_type_name, close_status, start_time DESC, run_id); +CREATE INDEX by_workflow_id_start_time ON executions_visibility (domain_id, workflow_id, close_status, start_time DESC, run_id); +CREATE INDEX by_status_by_close_time ON executions_visibility (domain_id, close_status, start_time DESC, run_id); +CREATE INDEX by_close_time_by_status ON executions_visibility (domain_id, close_time DESC, run_id, close_status); diff --git a/schema/sqlite/visibility/versioned/v0.1/manifest.json b/schema/sqlite/visibility/versioned/v0.1/manifest.json new file mode 100644 index 00000000000..442e3af5ce4 --- /dev/null +++ b/schema/sqlite/visibility/versioned/v0.1/manifest.json @@ -0,0 +1,8 @@ +{ + "CurrVersion": "0.1", + "MinCompatibleVersion": "0.1", + "Description": "base version of visibility schema", + "SchemaUpdateCqlFiles": [ + "base.sql" + ] +} \ No newline at end of file diff --git a/tools/common/schema/updatetask_test.go b/tools/common/schema/updatetask_test.go index c58a23b86bb..25819e9bdf4 100644 --- a/tools/common/schema/updatetask_test.go +++ b/tools/common/schema/updatetask_test.go @@ -38,6 +38,7 @@ import ( "github.com/uber/cadence/schema/cassandra" "github.com/uber/cadence/schema/mysql" "github.com/uber/cadence/schema/postgres" + "github.com/uber/cadence/schema/sqlite" ) type UpdateTaskTestSuite struct { @@ -110,6 +111,7 @@ func (s *UpdateTaskTestSuite) TestReadSchemaDir() { } func (s *UpdateTaskTestSuite) TestReadSchemaDirFromEmbeddings() { + // Cassandra fsys, err := fs.Sub(cassandra.SchemaFS, "cadence/versioned") s.NoError(err) ans, err := readSchemaDir(fsys, "0.30", "") @@ -122,6 +124,7 @@ func (s *UpdateTaskTestSuite) TestReadSchemaDirFromEmbeddings() { s.NoError(err) s.Equal([]string{"v0.7", "v0.8", "v0.9"}, ans) + // MySQL fsys, err = fs.Sub(mysql.SchemaFS, "v8/cadence/versioned") s.NoError(err) ans, err = readSchemaDir(fsys, "0.3", "") @@ -134,6 +137,20 @@ func (s *UpdateTaskTestSuite) TestReadSchemaDirFromEmbeddings() { s.NoError(err) s.Equal([]string{"v0.6", "v0.7"}, ans) + // SQLite + fsys, err = fs.Sub(sqlite.SchemaFS, "cadence/versioned") + s.NoError(err) + ans, err = readSchemaDir(fsys, "0.1", "") + s.NoError(err) + s.Nil(ans, "no version dirs found after 0.1") + + fsys, err = fs.Sub(sqlite.SchemaFS, "visibility/versioned") + s.NoError(err) + ans, err = readSchemaDir(fsys, "0.1", "") + s.NoError(err) + s.Nil(ans, "no version dirs found after 0.1") + + // Postgres fsys, err = fs.Sub(postgres.SchemaFS, "cadence/versioned") s.NoError(err) ans, err = readSchemaDir(fsys, "0.3", "") diff --git a/tools/sql/sqlite/sqlite_test.go b/tools/sql/sqlite/sqlite_test.go new file mode 100644 index 00000000000..09dfccece31 --- /dev/null +++ b/tools/sql/sqlite/sqlite_test.go @@ -0,0 +1,82 @@ +// The MIT License (MIT) + +// Copyright (c) 2017-2020 Uber Technologies Inc. + +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +package sqlite + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + + "github.com/uber/cadence/common/config" + sqliteplugin "github.com/uber/cadence/common/persistence/sql/sqlplugin/sqlite" + "github.com/uber/cadence/schema/sqlite" + "github.com/uber/cadence/tools/common/schema" + "github.com/uber/cadence/tools/sql" +) + +// Test_SetupSchema test that setup schema works for all database sqlite schemas +// in-memory sqlite database is used for testing +func Test_SetupSchema(t *testing.T) { + for _, dbName := range listDatabaseNames(t) { + t.Run(dbName, func(t *testing.T) { + conn := newInMemoryDB(t) + + err := schema.SetupFromConfig(&schema.SetupConfig{ + SchemaFilePath: fmt.Sprintf("../../../schema/sqlite/%s/schema.sql", dbName), + InitialVersion: "0.1", + Overwrite: false, + DisableVersioning: false, + }, conn) + + assert.NoError(t, err) + }) + } +} + +// newInMemoryDB returns a new in-memory sqlite connection +func newInMemoryDB(t *testing.T) *sql.Connection { + t.Helper() + + conn, err := sql.NewConnection(&config.SQL{ + PluginName: sqliteplugin.PluginName, + }) + require.NoError(t, err) + return conn +} + +// listDatabaseSchemaFilePaths returns a list of database schema file paths +func listDatabaseNames(t *testing.T) []string { + t.Helper() + + dirs, err := sqlite.SchemaFS.ReadDir(".") + require.NoError(t, err) + + var databaseNames = make([]string, len(dirs)) + for i, dir := range dirs { + databaseNames[i] = dir.Name() + } + + return databaseNames +}