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 SQL election module #3318

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update to use mysql module, fix factory invocation
  • Loading branch information
evankanderson committed Jan 30, 2024
commit 05b113dc57b3c166c310552e3b49e4d9e3e64b8a
7 changes: 3 additions & 4 deletions cmd/trillian_log_signer/main.go
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@
"github.com/google/trillian/util/election"
"github.com/google/trillian/util/election2"
etcdelect "github.com/google/trillian/util/election2/etcd"
"github.com/google/trillian/util/election2/sql"
mysqlElection "github.com/google/trillian/util/election2/mysql"
clientv3 "go.etcd.io/etcd/client/v3"
"google.golang.org/grpc"
"k8s.io/klog/v2"
@@ -56,7 +56,6 @@
_ "github.com/google/trillian/storage/cloudspanner"
_ "github.com/google/trillian/storage/crdb"
"github.com/google/trillian/storage/mysql"
_ "github.com/google/trillian/storage/mysql"

// Load quota providers
_ "github.com/google/trillian/quota/crdbqm"
@@ -73,7 +72,7 @@
numSeqFlag = flag.Int("num_sequencers", 10, "Number of sequencer workers to run in parallel")
sequencerGuardWindowFlag = flag.Duration("sequencer_guard_window", 0, "If set, the time elapsed before submitted leaves are eligible for sequencing")
forceMaster = flag.Bool("force_master", false, "If true, assume master for all logs")
electionBackend = flag.String("election_backend", "etcd", fmt.Sprintf("Election backend to use. One of: mysql, etcd, noop"))
electionBackend = flag.String("election_backend", "etcd", "Election backend to use. One of: mysql, etcd, noop")
etcdHTTPService = flag.String("etcd_http_service", "trillian-logsigner-http", "Service name to announce our HTTP endpoint under")
lockDir = flag.String("lock_file_path", "/test/multimaster", "etcd lock file directory path")
healthzTimeout = flag.Duration("healthz_timeout", time.Second*5, "Timeout used during healthz checks")
@@ -154,9 +153,9 @@
case *storageSystem == "mysql" && *electionBackend == "mysql":
db, err := mysql.GetDatabase()
if err != nil {
klog.Exit("Failed to get MySQL database when reuested: %v", err)

Check failure on line 156 in cmd/trillian_log_signer/main.go

GitHub Actions / lint

printf: k8s.io/klog/v2.Exit call has possible Printf formatting directive %v (govet)
}
electionFactory, err = sql.NewFactory(instanceID)
electionFactory, err = mysqlElection.NewFactory(instanceID, db)
if err != nil {
klog.Exitf("Failed to create MySQL election factory: %v", err)
}
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package etcd provides an implementation of leader election based on a SQL database.
package sql
// Package mysql provides an implementation of leader election based on a SQL database.
package mysql

import (
"context"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package etcd provides an implementation of leader election based on a SQL database.
package sql
// Package mysql provides an implementation of leader election based on a SQL database.
package mysql

import (
"context"
Loading