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

*: build phony etcd server binary for unsupported architectures #4721

Merged
merged 1 commit into from
Mar 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ The `v2` API responses should not change after the 2.0.0 release but new feature

etcd has known issues on 32-bit systems due to a bug in the Go runtime. See #[358][358] for more information.

To avoid inadvertantly producing an unstable etcd server, 32-bit builds emit an `etcd` that prints
a warning message and immediately exits.

[358]: https://github.com/coreos/etcd/issues/358

### License
Expand Down
3 changes: 3 additions & 0 deletions etcdmain/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// TODO: support arm64
// +build amd64
Copy link
Contributor

Choose a reason for hiding this comment

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

todo: support arm64?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure


package etcdmain

import (
Expand Down
31 changes: 31 additions & 0 deletions etcdmain/etcd_phony.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2016 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !amd64

package etcdmain

import (
"fmt"
"os"

"github.com/coreos/etcd/Godeps/_workspace/src/github.com/coreos/pkg/capnslog"
)

var plog = capnslog.NewPackageLogger("github.com/coreos/etcd", "etcdmain")

func Main() {
fmt.Println("unsupported architecture; unreliable, unstable")
os.Exit(-1)
}
2 changes: 1 addition & 1 deletion storage/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (
// InitialMmapSize is the initial size of the mmapped region. Setting this larger than
// the potential max db size can prevent writer from blocking reader.
// This only works for linux.
InitialMmapSize = 10 * 1024 * 1024 * 1024
InitialMmapSize = int64(10 * 1024 * 1024 * 1024)
)

type Backend interface {
Expand Down
2 changes: 1 addition & 1 deletion storage/backend/boltoption_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ import (
// silently ignore this flag. Please update your kernel to prevent this.
var boltOpenOptions = &bolt.Options{
MmapFlags: syscall.MAP_POPULATE,
InitialMmapSize: InitialMmapSize,
InitialMmapSize: int(InitialMmapSize),
Copy link
Contributor

Choose a reason for hiding this comment

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

This will make etcd unreliable for amd64, and was the cause to the #4715 (comment) failure. If you merge this etcd won't work. See https://play.golang.org/p/3Slqmtf9JC

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, that was not the reason for the test failure. I tested it with a 256MB mmap reservation and it still failed.

Likewise, go playground compiles with arch "amd64p32", which is why the ints are getting truncated. I tested on an amd64 arch and it gives the correct 64-bit value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you changing this anyway? AFAIU it worked fine on amd64 before.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bolt.Options expects an int; declaring InitialMmapSize as int64 so that arm builds won't complain causes a type error without the int cast

}