mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
Fix compilation errors, add deps.
This commit is contained in:
parent
1d6a63283c
commit
5f496df0bc
5 changed files with 17 additions and 12 deletions
|
|
@ -26,7 +26,7 @@ func (self *Nexter) countloop(ch chan uint64, id int, client *etcd.Client) {
|
|||
var end uint64
|
||||
for {
|
||||
path := "nexter/" + strconv.Itoa(id)
|
||||
node, err := client.Get(path)
|
||||
node, err := client.Get(path, false)
|
||||
if err != nil {
|
||||
ee, ok := err.(etcd.EtcdError)
|
||||
if ok && ee.ErrorCode == 100 { // node does not exist
|
||||
|
|
@ -37,21 +37,18 @@ func (self *Nexter) countloop(ch chan uint64, id int, client *etcd.Client) {
|
|||
log.Fatal(err)
|
||||
}
|
||||
} else { // No error, get start of series from etcd node
|
||||
start, err = strconv.ParseUint(node[0].Value, 10, 0)
|
||||
start, err = strconv.ParseUint(node.Kvs[0].Value, 10, 0)
|
||||
end = start + blocksize
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
for {
|
||||
newval, ok, err := client.TestAndSet(path, strconv.FormatUint(start, 10), strconv.FormatUint(end, 10), 0)
|
||||
newval, err := client.CompareAndSwap(path, strconv.FormatUint(end, 10), 0, strconv.FormatUint(start, 10), 0)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if ok {
|
||||
break
|
||||
} else {
|
||||
log.Println("Error with TestAndSet! Trying again in 1 second...")
|
||||
log.Println("Error with CompareAndSet! Trying again in 1 second...")
|
||||
time.Sleep(time.Second)
|
||||
start, err = strconv.ParseUint(newval.Value, 10, 0)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ func (service *Service) SetupEtcd() {
|
|||
defer service.NodeMapMutex.Unlock()
|
||||
service.NodeMap = db.NodeMap{}
|
||||
|
||||
nodes, err := service.Etcd.Get("nodes")
|
||||
nodes, err := service.Etcd.Get("nodes", false)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, node := range nodes {
|
||||
for _, node := range nodes.Kvs {
|
||||
nodestring := strings.Split(node.Key, "/")[2]
|
||||
location, err := db.NewLocation(nodestring)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package db
|
|||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"lru"
|
||||
"github.com/golang/groupcache/lru"
|
||||
"pilosa/index"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,11 @@
|
|||
"version": "87bcc4729f2c5a08d2513ad10684c6bbd256380f",
|
||||
"type": "git"
|
||||
},
|
||||
"lru": {
|
||||
"repo": "github.com/golang/groupcache/lru",
|
||||
"version": "d781998583680cda80cf61e0b37dd0cd8da2eb52",
|
||||
"type": "git"
|
||||
},
|
||||
"rbtree": {
|
||||
"repo": "github.com/yasushi-saito/rbtree",
|
||||
"version": "571e2538414bf914c7e2909b61217b4e3e5508f4",
|
||||
|
|
|
|||
|
|
@ -17,8 +17,11 @@ func NewCassStorage() Storage{
|
|||
cluster.Consistency = gocql.Quorum
|
||||
//cluster.ProtoVersion = 1
|
||||
// cluster.CQLVersion = "3.0.0"
|
||||
session := cluster.CreateSession()
|
||||
if err := session.Query("USE hotbox").Exec(); err != nil {
|
||||
session, err := cluster.CreateSession()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err = session.Query("USE hotbox").Exec(); err != nil {
|
||||
}
|
||||
obj.db = session
|
||||
return obj
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue