Commit 7efd3012 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 39bd3660
This diff is collapsed.
......@@ -130,15 +130,16 @@ type PartitionCell struct {
}
// Operational returns whether all object space is covered by at least some ready-to-serve nodes
// NOTE XXX operational here means only pt itself is operational
// for cluster to be really operational it has to be checked whether
// nodes referenced by pt are up and running
// OperationalWith returns whether all object space is covered by at least some ready-to-serve nodes
//
// XXX or keep not only NodeUUID in PartitionCell - add *Node ?
// for all partitions it checks both:
// - whether there are up-to-date entries in the partition table, and
// - whether there are corresponding storage nodes that are up
//
// information about nodes being up or down is obtained from supplied NodeTable
//
// XXX -> add `nt *NodeTable` as argument and check real node states there ?
func (pt *PartitionTable) Operational() bool {
// XXX or keep not only NodeUUID in PartitionCell - add *Node ?
func (pt *PartitionTable) OperationalWith(nt *NodeTable) bool {
for _, ptEntry := range pt.ptTab {
if len(ptEntry) == 0 {
return false
......@@ -149,6 +150,12 @@ func (pt *PartitionTable) Operational() bool {
for _, cell := range ptEntry {
switch cell.CellState {
case UP_TO_DATE, FEEDING: // XXX cell.isReadble in py
// cell says it is readable. let's check whether corresponding node is up
node := nt.Get(cell.NodeUUID)
if node == nil || node.Info.NodeState != RUNNING { // XXX PENDING is also ok ?
continue
}
ok = true
break cellLoop
}
......
......@@ -448,8 +448,8 @@ func (p *AnswerRecovery) NEOEncodedInfo() (uint16, int) {
func (p *AnswerRecovery) NEOEncode(data []byte) {
binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
binary.BigEndian.PutUint64(data[8:], uint64(p.BackupTID))
binary.BigEndian.PutUint64(data[16:], uint64(p.TruncateTID))
binary.BigEndian.PutUint64(data[8:], uint64(p.BackupTid))
binary.BigEndian.PutUint64(data[16:], uint64(p.TruncateTid))
}
func (p *AnswerRecovery) NEODecode(data []byte) (int, error) {
......@@ -457,8 +457,8 @@ func (p *AnswerRecovery) NEODecode(data []byte) (int, error) {
goto overflow
}
p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
p.BackupTID = zodb.Tid(binary.BigEndian.Uint64(data[8:]))
p.TruncateTID = zodb.Tid(binary.BigEndian.Uint64(data[16:]))
p.BackupTid = zodb.Tid(binary.BigEndian.Uint64(data[8:]))
p.TruncateTid = zodb.Tid(binary.BigEndian.Uint64(data[16:]))
return 24, nil
overflow:
......@@ -485,16 +485,16 @@ func (p *AnswerLastIDs) NEOEncodedInfo() (uint16, int) {
}
func (p *AnswerLastIDs) NEOEncode(data []byte) {
binary.BigEndian.PutUint64(data[0:], uint64(p.LastOID))
binary.BigEndian.PutUint64(data[8:], uint64(p.LastTID))
binary.BigEndian.PutUint64(data[0:], uint64(p.LastOid))
binary.BigEndian.PutUint64(data[8:], uint64(p.LastTid))
}
func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) {
if uint32(len(data)) < 16 {
goto overflow
}
p.LastOID = zodb.Oid(binary.BigEndian.Uint64(data[0:]))
p.LastTID = zodb.Tid(binary.BigEndian.Uint64(data[8:]))
p.LastOid = zodb.Oid(binary.BigEndian.Uint64(data[0:]))
p.LastTid = zodb.Tid(binary.BigEndian.Uint64(data[8:]))
return 16, nil
overflow:
......
......@@ -308,8 +308,8 @@ type Recovery struct {
type AnswerRecovery struct {
PTid
BackupTID zodb.Tid
TruncateTID zodb.Tid
BackupTid zodb.Tid
TruncateTid zodb.Tid
}
// Ask the last OID/TID so that a master can initialize its TransactionManager.
......@@ -318,8 +318,8 @@ type LastIDs struct {
}
type AnswerLastIDs struct {
LastOID zodb.Oid
LastTID zodb.Tid
LastOid zodb.Oid
LastTid zodb.Tid
}
// Ask the full partition table. PM -> S.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment