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

.

parent 39bd3660
This diff is collapsed.
...@@ -130,15 +130,16 @@ type PartitionCell struct { ...@@ -130,15 +130,16 @@ type PartitionCell struct {
} }
// Operational returns whether all object space is covered by at least some ready-to-serve nodes // OperationalWith 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
// //
// 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 ? // XXX or keep not only NodeUUID in PartitionCell - add *Node ?
func (pt *PartitionTable) Operational() bool { func (pt *PartitionTable) OperationalWith(nt *NodeTable) bool {
for _, ptEntry := range pt.ptTab { for _, ptEntry := range pt.ptTab {
if len(ptEntry) == 0 { if len(ptEntry) == 0 {
return false return false
...@@ -149,6 +150,12 @@ func (pt *PartitionTable) Operational() bool { ...@@ -149,6 +150,12 @@ func (pt *PartitionTable) Operational() bool {
for _, cell := range ptEntry { for _, cell := range ptEntry {
switch cell.CellState { switch cell.CellState {
case UP_TO_DATE, FEEDING: // XXX cell.isReadble in py 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 ok = true
break cellLoop break cellLoop
} }
......
...@@ -448,8 +448,8 @@ func (p *AnswerRecovery) NEOEncodedInfo() (uint16, int) { ...@@ -448,8 +448,8 @@ func (p *AnswerRecovery) NEOEncodedInfo() (uint16, int) {
func (p *AnswerRecovery) NEOEncode(data []byte) { func (p *AnswerRecovery) NEOEncode(data []byte) {
binary.BigEndian.PutUint64(data[0:], uint64(p.PTid)) binary.BigEndian.PutUint64(data[0:], uint64(p.PTid))
binary.BigEndian.PutUint64(data[8:], uint64(p.BackupTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.BackupTid))
binary.BigEndian.PutUint64(data[16:], uint64(p.TruncateTID)) binary.BigEndian.PutUint64(data[16:], uint64(p.TruncateTid))
} }
func (p *AnswerRecovery) NEODecode(data []byte) (int, error) { func (p *AnswerRecovery) NEODecode(data []byte) (int, error) {
...@@ -457,8 +457,8 @@ func (p *AnswerRecovery) NEODecode(data []byte) (int, error) { ...@@ -457,8 +457,8 @@ func (p *AnswerRecovery) NEODecode(data []byte) (int, error) {
goto overflow goto overflow
} }
p.PTid = PTid(binary.BigEndian.Uint64(data[0:])) p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
p.BackupTID = zodb.Tid(binary.BigEndian.Uint64(data[8:])) p.BackupTid = zodb.Tid(binary.BigEndian.Uint64(data[8:]))
p.TruncateTID = zodb.Tid(binary.BigEndian.Uint64(data[16:])) p.TruncateTid = zodb.Tid(binary.BigEndian.Uint64(data[16:]))
return 24, nil return 24, nil
overflow: overflow:
...@@ -485,16 +485,16 @@ func (p *AnswerLastIDs) NEOEncodedInfo() (uint16, int) { ...@@ -485,16 +485,16 @@ func (p *AnswerLastIDs) NEOEncodedInfo() (uint16, int) {
} }
func (p *AnswerLastIDs) NEOEncode(data []byte) { func (p *AnswerLastIDs) NEOEncode(data []byte) {
binary.BigEndian.PutUint64(data[0:], uint64(p.LastOID)) binary.BigEndian.PutUint64(data[0:], uint64(p.LastOid))
binary.BigEndian.PutUint64(data[8:], uint64(p.LastTID)) binary.BigEndian.PutUint64(data[8:], uint64(p.LastTid))
} }
func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) { func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) {
if uint32(len(data)) < 16 { if uint32(len(data)) < 16 {
goto overflow goto overflow
} }
p.LastOID = zodb.Oid(binary.BigEndian.Uint64(data[0:])) p.LastOid = zodb.Oid(binary.BigEndian.Uint64(data[0:]))
p.LastTID = zodb.Tid(binary.BigEndian.Uint64(data[8:])) p.LastTid = zodb.Tid(binary.BigEndian.Uint64(data[8:]))
return 16, nil return 16, nil
overflow: overflow:
......
...@@ -308,8 +308,8 @@ type Recovery struct { ...@@ -308,8 +308,8 @@ type Recovery struct {
type AnswerRecovery struct { type AnswerRecovery struct {
PTid PTid
BackupTID zodb.Tid BackupTid zodb.Tid
TruncateTID zodb.Tid TruncateTid zodb.Tid
} }
// Ask the last OID/TID so that a master can initialize its TransactionManager. // Ask the last OID/TID so that a master can initialize its TransactionManager.
...@@ -318,8 +318,8 @@ type LastIDs struct { ...@@ -318,8 +318,8 @@ type LastIDs struct {
} }
type AnswerLastIDs struct { type AnswerLastIDs struct {
LastOID zodb.Oid LastOid zodb.Oid
LastTID zodb.Tid LastTid zodb.Tid
} }
// Ask the full partition table. PM -> S. // 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