Skip to content
Browse files

Added shard server priority feature. Higher priority shard servers wi…

…ll take the primaryship from lower ones. A priority of 0 means the shard server will never become primary. Also added to webadmin. Set using /setPriority&quorumID&nodeID&priority on the Master.

Fixes #275
  • Loading branch information...
1 parent 89e51d3 commit 793a3a8d76a1ca917178886ef44aeddc30a2df0d @mtrencseni mtrencseni committed Oct 24, 2011
View
12 src/Application/Common/ClientRequest.cpp
@@ -21,6 +21,7 @@ void ClientRequest::Init()
nodeID = 0;
paxosID = 0;
configPaxosID = 0;
+ priority = 0;
number = 0;
count = 0;
changeTimeout = 0;
@@ -59,6 +60,7 @@ bool ClientRequest::IsControllerRequest()
type == CLIENTREQUEST_ADD_SHARDSERVER_TO_QUORUM ||
type == CLIENTREQUEST_REMOVE_SHARDSERVER_FROM_QUORUM ||
type == CLIENTREQUEST_ACTIVATE_SHARDSERVER ||
+ type == CLIENTREQUEST_SET_PRIORITY ||
type == CLIENTREQUEST_CREATE_DATABASE ||
type == CLIENTREQUEST_RENAME_DATABASE ||
type == CLIENTREQUEST_DELETE_DATABASE ||
@@ -202,6 +204,16 @@ bool ClientRequest::ActivateShardServer(uint64_t commandID_, uint64_t nodeID_)
return true;
}
+bool ClientRequest::SetPriority(uint64_t commandID_, uint64_t quorumID_, uint64_t nodeID_, uint64_t priority_)
+{
+ type = CLIENTREQUEST_SET_PRIORITY;
+ commandID = commandID_;
+ quorumID = quorumID_;
+ nodeID = nodeID_;
+ priority = priority_;
+ return true;
+}
+
bool ClientRequest::CreateDatabase(
uint64_t commandID_, ReadBuffer& name_)
{
View
4 src/Application/Common/ClientRequest.h
@@ -17,6 +17,7 @@
#define CLIENTREQUEST_ADD_SHARDSERVER_TO_QUORUM 'n'
#define CLIENTREQUEST_REMOVE_SHARDSERVER_FROM_QUORUM 'b'
#define CLIENTREQUEST_ACTIVATE_SHARDSERVER 'N'
+#define CLIENTREQUEST_SET_PRIORITY 'P'
#define CLIENTREQUEST_CREATE_DATABASE 'C'
#define CLIENTREQUEST_RENAME_DATABASE 'R'
#define CLIENTREQUEST_DELETE_DATABASE 'D'
@@ -95,6 +96,8 @@ class ClientRequest
uint64_t commandID, uint64_t quorumID, uint64_t nodeID);
bool ActivateShardServer(
uint64_t commandID, uint64_t nodeID);
+ bool SetPriority(
+ uint64_t commandID, uint64_t quorumID, uint64_t nodeID, uint64_t priority);
// Database management
bool CreateDatabase(
@@ -190,6 +193,7 @@ class ClientRequest
uint64_t nodeID;
uint64_t paxosID;
uint64_t configPaxosID;
+ uint64_t priority;
int64_t number;
uint64_t count;
Buffer name;
View
19 src/Application/ConfigServer/ConfigHTTPClientSession.cpp
@@ -619,6 +619,8 @@ ClientRequest* ConfigHTTPClientSession::ProcessConfigCommand(ReadBuffer& cmd)
return ProcessAddShardServerToQuorum();
if (HTTP_MATCH_COMMAND(cmd, "removeShardserverFromQuorum"))
return ProcessRemoveShardServerFromQuorum();
+ if (HTTP_MATCH_COMMAND(cmd, "setPriority"))
+ return ProcessSetPriority();
if (HTTP_MATCH_COMMAND(cmd, "createDatabase"))
return ProcessCreateDatabase();
if (HTTP_MATCH_COMMAND(cmd, "renameDatabase"))
@@ -796,6 +798,23 @@ ClientRequest* ConfigHTTPClientSession::ProcessRemoveShardServerFromQuorum()
return request;
}
+ClientRequest* ConfigHTTPClientSession::ProcessSetPriority()
+{
+ ClientRequest* request;
+ uint64_t quorumID;
+ uint64_t nodeID;
+ uint64_t priority;
+
+ HTTP_GET_U64_PARAM(params, "quorumID", quorumID);
+ HTTP_GET_U64_PARAM(params, "nodeID", nodeID);
+ HTTP_GET_U64_PARAM(params, "priority", priority);
+
+ request = new ClientRequest;
+ request->SetPriority(0, quorumID, nodeID, priority);
+
+ return request;
+}
+
ClientRequest* ConfigHTTPClientSession::ProcessCreateDatabase()
{
ClientRequest* request;
View
1 src/Application/ConfigServer/ConfigHTTPClientSession.h
@@ -59,6 +59,7 @@ class ConfigHTTPClientSession : public ClientSession
ClientRequest* ProcessDeleteQuorum();
ClientRequest* ProcessAddShardServerToQuorum();
ClientRequest* ProcessRemoveShardServerFromQuorum();
+ ClientRequest* ProcessSetPriority();
ClientRequest* ProcessCreateDatabase();
ClientRequest* ProcessRenameDatabase();
ClientRequest* ProcessDeleteDatabase();
View
19 src/Application/ConfigServer/ConfigMessage.cpp
@@ -89,6 +89,16 @@ bool ConfigMessage::DeactivateShardServer(
return true;
}
+bool ConfigMessage::SetPriority(
+ uint64_t quorumID_, uint64_t nodeID_, uint64_t priority_)
+{
+ type = CONFIGMESSAGE_SET_PRIORITY;
+ quorumID = quorumID_;
+ nodeID = nodeID_;
+ priority = priority_;
+ return true;
+}
+
bool ConfigMessage::CreateDatabase(
ReadBuffer& name_)
{
@@ -267,6 +277,11 @@ bool ConfigMessage::Read(ReadBuffer& buffer)
read = buffer.Readf("%c:%U:%U:%b",
&type, &quorumID, &nodeID, &force);
break;
+ case CONFIGMESSAGE_SET_PRIORITY:
+ read = buffer.Readf("%c:%U:%U:%U",
+ &type, &quorumID, &nodeID, &priority);
+ break;
+
// Database management
case CONFIGMESSAGE_CREATE_DATABASE:
@@ -390,6 +405,10 @@ bool ConfigMessage::Write(Buffer& buffer)
buffer.Writef("%c:%U:%U:%b",
type, quorumID, nodeID, force);
break;
+ case CONFIGMESSAGE_SET_PRIORITY:
+ buffer.Writef("%c:%U:%U:%U",
+ type, quorumID, nodeID, priority);
+ break;
// Database management
case CONFIGMESSAGE_CREATE_DATABASE:
View
4 src/Application/ConfigServer/ConfigMessage.h
@@ -18,6 +18,7 @@
#define CONFIGMESSAGE_REMOVE_SHARDSERVER_FROM_QUORUM 'b'
#define CONFIGMESSAGE_ACTIVATE_SHARDSERVER 'p'
#define CONFIGMESSAGE_DEACTIVATE_SHARDSERVER 'm'
+#define CONFIGMESSAGE_SET_PRIORITY 'P'
#define CONFIGMESSAGE_CREATE_DATABASE 'C'
#define CONFIGMESSAGE_RENAME_DATABASE 'R'
@@ -64,6 +65,7 @@ class ConfigMessage : public Message
uint64_t newShardID;
uint64_t srcShardID;
uint64_t dstShardID;
+ uint64_t priority;
ReadBuffer name;
ReadBuffer firstKey;
Buffer splitKey;
@@ -95,6 +97,8 @@ class ConfigMessage : public Message
uint64_t quorumID, uint64_t nodeID, bool force);
bool DeactivateShardServer(
uint64_t quorumID, uint64_t nodeID, bool force);
+ bool SetPriority(
+ uint64_t quorumID, uint64_t nodeID, uint64_t priority);
// Database management
bool CreateDatabase(
View
58 src/Application/ConfigServer/ConfigPrimaryLeaseManager.cpp
@@ -5,6 +5,8 @@
#include "ConfigQuorumProcessor.h"
#include "ConfigActivationManager.h"
+#define CONFIG_STATE (configServer->GetDatabaseManager()->GetConfigState())
+
void ConfigPrimaryLeaseManager::Init(ConfigServer* configServer_)
{
configServer = configServer_;
@@ -19,38 +21,35 @@ void ConfigPrimaryLeaseManager::Shutdown()
void ConfigPrimaryLeaseManager::OnPrimaryLeaseTimeout()
{
uint64_t now;
- ConfigState* configState;
ConfigQuorum* quorum;
ConfigShard* shard;
- PrimaryLease* itLease;
+ PrimaryLease* primaryLease;
now = EventLoop::Now();
- configState = configServer->GetDatabaseManager()->GetConfigState();
-
shard = NULL;
- if (configState->isMigrating)
- shard = configState->GetShard(configState->migrateSrcShardID);
+ if (CONFIG_STATE->isMigrating)
+ shard = CONFIG_STATE->GetShard(CONFIG_STATE->migrateSrcShardID);
- for (itLease = primaryLeases.First(); itLease != NULL; /* advanced in body */)
+ for (primaryLease = primaryLeases.First(); primaryLease != NULL; /* advanced in body */)
{
- if (itLease->expireTime < now)
+ if (primaryLease->expireTime < now)
{
- quorum = configState->GetQuorum(itLease->quorumID);
+ quorum = CONFIG_STATE->GetQuorum(primaryLease->quorumID);
Log_Debug("Node %U lost the primary lease for quorum %U",
- itLease->nodeID, itLease->quorumID);
+ primaryLease->nodeID, primaryLease->quorumID);
// look for migration
- if (configState->isMigrating)
+ if (CONFIG_STATE->isMigrating)
{
ASSERT(shard != NULL);
- if (configState->migrateQuorumID == quorum->quorumID || // migration dst
- shard->quorumID == quorum->quorumID) // migration src
+ if (CONFIG_STATE->migrateQuorumID == quorum->quorumID || // migration dst
+ shard->quorumID == quorum->quorumID) // migration src
{
Log_Message("Aborting shard migration...");
- configState->OnAbortShardMigration();
+ CONFIG_STATE->OnAbortShardMigration();
}
}
@@ -59,7 +58,7 @@ void ConfigPrimaryLeaseManager::OnPrimaryLeaseTimeout()
quorum->hasPrimary = false;
quorum->primaryID = 0;
}
- itLease = primaryLeases.Delete(itLease);
+ primaryLease = primaryLeases.Delete(primaryLease);
}
else
break;
@@ -72,8 +71,11 @@ void ConfigPrimaryLeaseManager::OnPrimaryLeaseTimeout()
void ConfigPrimaryLeaseManager::OnRequestPrimaryLease(ClusterMessage& message)
{
- ConfigQuorum* quorum;
- PrimaryLease* primaryLease;
+ uint64_t priority;
+ uint64_t* itNodeID;
+ ConfigQuorum* quorum;
+ ConfigShardServer* shardServer;
+ PrimaryLease* primaryLease;
Log_Trace("nodeID %U requesting lease %U for quorum %U",
message.nodeID, message.proposalID, message.quorumID);
@@ -92,11 +94,28 @@ void ConfigPrimaryLeaseManager::OnRequestPrimaryLease(ClusterMessage& message)
if (!quorum->IsActiveMember(message.nodeID))
{
- Log_Trace("nodeID %U requesting lease but not active member or quorum %U",
+ Log_Trace("nodeID %U requesting lease but not active member of quorum %U",
message.nodeID, message.quorumID);
return;
}
+ shardServer = CONFIG_STATE->GetShardServer(message.nodeID);
+ priority = shardServer->GetQuorumPriority(message.quorumID);
+ if (priority == 0)
+ {
+ Log_Trace("nodeID %U requesting lease but priority is 0 in quorum %U",
+ message.nodeID, message.quorumID);
+ return;
+ }
+ FOREACH(itNodeID, quorum->activeNodes)
+ {
+ if (!configServer->GetHeartbeatManager()->HasHeartbeat(*itNodeID))
+ continue;
+ shardServer = CONFIG_STATE->GetShardServer(*itNodeID);
+ if (shardServer->GetQuorumPriority(message.quorumID) > priority)
+ return; // a higher priority shard server is active
+ }
+
FOREACH(primaryLease, primaryLeases)
{
if (primaryLease->quorumID == message.quorumID && primaryLease->nodeID != message.nodeID)
@@ -160,9 +179,6 @@ void ConfigPrimaryLeaseManager::ExtendPrimaryLease(ConfigQuorum& quorum, Cluster
ClusterMessage response;
SortedList<uint64_t> activeNodes;
- if (!configServer->GetQuorumProcessor()->IsMaster())
- return;
-
FOREACH (it, primaryLeases)
{
if (it->quorumID == quorum.quorumID)
View
9 src/Application/ConfigServer/ConfigQuorumProcessor.cpp
@@ -822,6 +822,12 @@ void ConfigQuorumProcessor::ConstructMessage(ClientRequest* request, ConfigMessa
message->quorumID = request->quorumID;
message->nodeID = request->nodeID;
return;
+ case CLIENTREQUEST_SET_PRIORITY:
+ message->type = CONFIGMESSAGE_SET_PRIORITY;
+ message->quorumID = request->quorumID;
+ message->nodeID = request->nodeID;
+ message->priority = request->priority;
+ return;
case CLIENTREQUEST_CREATE_DATABASE:
message->type = CONFIGMESSAGE_CREATE_DATABASE;
message->name.Wrap(request->name);
@@ -899,6 +905,9 @@ void ConfigQuorumProcessor::ConstructResponse(ConfigMessage* message, ClientResp
case CLIENTREQUEST_REMOVE_SHARDSERVER_FROM_QUORUM:
response->OK();
return;
+ case CLIENTREQUEST_SET_PRIORITY:
+ response->OK();
+ return;
case CLIENTREQUEST_CREATE_DATABASE:
response->Number(message->databaseID);
return;
View
25 src/Application/ConfigServer/JSONConfigState.cpp
@@ -302,6 +302,7 @@ void JSONConfigState::WriteShardServer(ConfigShardServer* server)
{
QuorumInfo* quorumInfo;
QuorumShardInfo* quorumShardInfo;
+ QuorumPriority* quorumPriority;
json->PrintObjectStart();
@@ -340,7 +341,18 @@ void JSONConfigState::WriteShardServer(ConfigShardServer* server)
WriteQuorumShardInfo(quorumShardInfo);
json->PrintArrayEnd();
-
+
+ json->PrintComma();
+
+ json->PrintString("quorumPriorities");
+ json->PrintColon();
+ json->PrintArrayStart();
+
+ FOREACH (quorumPriority, server->quorumPriorities)
+ WriteQuorumPriority(quorumPriority);
+
+ json->PrintArrayEnd();
+
json->PrintObjectEnd();
}
@@ -392,6 +404,17 @@ void JSONConfigState::WriteQuorumShardInfo(QuorumShardInfo* info)
json->PrintObjectEnd();
}
+void JSONConfigState::WriteQuorumPriority(QuorumPriority* prio)
+{
+ json->PrintObjectStart();
+
+ JSON_NUMBER(prio, quorumID);
+ json->PrintComma();
+ JSON_NUMBER(prio, priority);
+
+ json->PrintObjectEnd();
+}
+
template<typename List>
void JSONConfigState::WriteIDList(List& list)
{
View
1 src/Application/ConfigServer/JSONConfigState.h
@@ -41,6 +41,7 @@ class JSONConfigState
void WriteShardServer(ConfigShardServer* server);
void WriteQuorumInfo(QuorumInfo* info);
void WriteQuorumShardInfo(QuorumShardInfo* info);
+ void WriteQuorumPriority(QuorumPriority* priority);
template<typename List>
void WriteIDList(List& list);
View
19 src/Application/ConfigState/ConfigShardServer.cpp
@@ -119,6 +119,12 @@ bool QuorumShardInfo::WriteList(Buffer& buffer, List<QuorumShardInfo>& quorumSha
return true;
}
+QuorumPriority::QuorumPriority()
+{
+ quorumID = 0;
+ priority = 0;
+}
+
ConfigShardServer::ConfigShardServer()
{
prev = next = this;
@@ -144,9 +150,22 @@ ConfigShardServer& ConfigShardServer::operator=(const ConfigShardServer& other)
quorumInfos = other.quorumInfos;
quorumShardInfos = other.quorumShardInfos;
+ quorumPriorities = other.quorumPriorities;
prev = next = this;
return *this;
}
+uint64_t ConfigShardServer::GetQuorumPriority(uint64_t quorumID)
+{
+ QuorumPriority* quorumPriority;
+
+ FOREACH(quorumPriority, quorumPriorities)
+ {
+ if (quorumPriority->quorumID == quorumID)
+ return quorumPriority->priority;
+ }
+
+ return 1;
+}
View
19 src/Application/ConfigState/ConfigShardServer.h
@@ -67,6 +67,23 @@ class QuorumShardInfo
/*
===============================================================================================
+ QuorumPriority
+
+===============================================================================================
+*/
+
+class QuorumPriority
+{
+public:
+ QuorumPriority();
+
+ uint64_t quorumID;
+ uint64_t priority;
+};
+
+/*
+===============================================================================================
+
ConfigShardServer
===============================================================================================
@@ -79,9 +96,11 @@ class ConfigShardServer
ConfigShardServer(const ConfigShardServer& other);
ConfigShardServer& operator=(const ConfigShardServer& other);
+ uint64_t GetQuorumPriority(uint64_t quorumID);
uint64_t nodeID;
Endpoint endpoint;
+ List<QuorumPriority> quorumPriorities;
// ========================================================================================
//
View
90 src/Application/ConfigState/ConfigState.cpp
@@ -177,6 +177,8 @@ bool ConfigState::CompleteMessage(ConfigMessage& message)
return CompleteActivateShardServer(message);
case CONFIGMESSAGE_DEACTIVATE_SHARDSERVER:
return CompleteDeactivateShardServer(message);
+ case CONFIGMESSAGE_SET_PRIORITY:
+ return CompleteSetPriority(message);
/* Database management */
case CONFIGMESSAGE_CREATE_DATABASE:
@@ -380,6 +382,8 @@ void ConfigState::OnMessage(ConfigMessage& message)
return OnActivateShardServer(message);
case CONFIGMESSAGE_DEACTIVATE_SHARDSERVER:
return OnDeactivateShardServer(message);
+ case CONFIGMESSAGE_SET_PRIORITY:
+ return OnSetPriority(message);
/* Database management */
case CONFIGMESSAGE_CREATE_DATABASE:
@@ -708,6 +712,25 @@ bool ConfigState::CompleteDeactivateShardServer(ConfigMessage& message)
return false;
}
+bool ConfigState::CompleteSetPriority(ConfigMessage& message)
+{
+ ConfigQuorum* quorum;
+ ConfigShardServer* shardServer;
+
+ quorum = GetQuorum(message.quorumID);
+ if (quorum == NULL)
+ return false; // no such quorum
+
+ shardServer = GetShardServer(message.nodeID);
+ if (shardServer == NULL)
+ return false; // no such shard server
+
+ if (!quorum->IsActiveMember(message.nodeID) && !quorum->IsInactiveMember(message.nodeID))
+ return false;
+
+ return true;
+}
+
bool ConfigState::CompleteCreateDatabase(ConfigMessage& message)
{
ConfigDatabase* database;
@@ -1082,7 +1105,30 @@ void ConfigState::OnDeactivateShardServer(ConfigMessage& message)
quorum->inactiveNodes.Add(message.nodeID);
Log_Message("Deactivating shard server %U in quorum %U...", message.nodeID, message.quorumID);
+}
+void ConfigState::OnSetPriority(ConfigMessage& message)
+{
+ QuorumPriority quorumPriority;
+ QuorumPriority* itQuorumPriority;
+ ConfigShardServer* shardServer;
+
+ shardServer = GetShardServer(message.nodeID);
+ // make sure shard server exists
+ ASSERT(shardServer != NULL);
+
+ FOREACH(itQuorumPriority, shardServer->quorumPriorities)
+ {
+ if (itQuorumPriority->quorumID == message.quorumID)
+ {
+ itQuorumPriority->priority = message.priority;
+ return;
+ }
+ }
+
+ quorumPriority.quorumID = message.quorumID;
+ quorumPriority.priority = message.priority;
+ shardServer->quorumPriorities.Append(quorumPriority);
}
void ConfigState::OnCreateDatabase(ConfigMessage& message)
@@ -1776,10 +1822,37 @@ bool ConfigState::ReadShardServer(ConfigShardServer& shardServer, ReadBuffer& bu
&shardServer.httpPort, &shardServer.sdbpPort, &shardServer.hasHeartbeat);
CHECK_ADVANCE(6);
READ_SEPARATOR();
- return QuorumInfo::ReadList(buffer, shardServer.quorumInfos);
+ if (!QuorumInfo::ReadList(buffer, shardServer.quorumInfos))
+ return false;
}
- else
+
+ return ReadQuorumPriorities(shardServer, buffer);
+}
+
+bool ConfigState::ReadQuorumPriorities(ConfigShardServer& shardServer, ReadBuffer& buffer)
+{
+ unsigned i, num;
+ int read;
+ QuorumPriority quorumPriority;
+
+ if (buffer.GetLength() == 0 || buffer.GetCharAt(0) != 'O')
+ {
+ // QuorumPriorities not present
return true;
+ }
+
+ num = 0;
+ read = buffer.Readf("O:%u", &num);
+ CHECK_ADVANCE(3);
+
+ for (i = 0; i < num; i++)
+ {
+ read = buffer.Readf(":%U:%U", &quorumPriority.quorumID, &quorumPriority.priority);
+ CHECK_ADVANCE(4);
+ shardServer.quorumPriorities.Append(quorumPriority);
+ }
+
+ return true;
}
void ConfigState::WriteShardServer(ConfigShardServer& shardServer, Buffer& buffer, bool withVolatile)
@@ -1788,14 +1861,25 @@ void ConfigState::WriteShardServer(ConfigShardServer& shardServer, Buffer& buffe
endpoint = shardServer.endpoint.ToReadBuffer();
buffer.Appendf("%U:%#R", shardServer.nodeID, &endpoint);
-
+
if (withVolatile)
{
buffer.Appendf(":%u:%u:%b",
shardServer.httpPort, shardServer.sdbpPort, shardServer.hasHeartbeat);
buffer.Appendf(":");
QuorumInfo::WriteList(buffer, shardServer.quorumInfos);
}
+
+ WriteQuorumPriorities(shardServer, buffer);
+}
+
+void ConfigState::WriteQuorumPriorities(ConfigShardServer& shardServer, Buffer& buffer)
+{
+ QuorumPriority* quorumPriority;
+
+ buffer.Appendf("O:%u", shardServer.quorumPriorities.GetLength());
+ FOREACH(quorumPriority, shardServer.quorumPriorities)
+ buffer.Appendf(":%U:%U", quorumPriority->quorumID, quorumPriority->priority);
}
bool ConfigState::ReadNextIDs(ReadBuffer& buffer)
View
4 src/Application/ConfigState/ConfigState.h
@@ -112,6 +112,7 @@ class ConfigState
bool CompleteRemoveShardServerFromQuorum(ConfigMessage& message);
bool CompleteActivateShardServer(ConfigMessage& message);
bool CompleteDeactivateShardServer(ConfigMessage& message);
+ bool CompleteSetPriority(ConfigMessage& message);
bool CompleteCreateDatabase(ConfigMessage& message);
bool CompleteRenameDatabase(ConfigMessage& message);
bool CompleteDeleteDatabase(ConfigMessage& message);
@@ -136,6 +137,7 @@ class ConfigState
void OnRemoveNode(ConfigMessage& message);
void OnActivateShardServer(ConfigMessage& message);
void OnDeactivateShardServer(ConfigMessage& message);
+ void OnSetPriority(ConfigMessage& message);
void OnCreateDatabase(ConfigMessage& message);
void OnRenameDatabase(ConfigMessage& message);
void OnDeleteDatabase(ConfigMessage& message);
@@ -184,8 +186,10 @@ class ConfigState
bool ReadShardServer(ConfigShardServer& database,
ReadBuffer& buffer, bool withVolatile);
+ bool ReadQuorumPriorities(ConfigShardServer& database, ReadBuffer& buffer);
void WriteShardServer(ConfigShardServer& shardServer,
Buffer& buffer, bool withVolatile);
+ void WriteQuorumPriorities(ConfigShardServer& shardServer, Buffer& buffer);
bool ReadNextIDs(ReadBuffer& buffer);
void WriteNextIDs(Buffer& buffer);
View
22 webadmin/ui.js
@@ -1092,14 +1092,20 @@ function createQuorumDiv(configState, quorum)
{
var nodeID = quorum["activeNodes"][i];
var shardServer = scaliendb.getShardServer(configState, nodeID);
+ var priority = 1;
+ for (var qp in shardServer["quorumPriorities"])
+ {
+ if (shardServer["quorumPriorities"][qp]["quorumID"] == quorum["quorumID"])
+ priority = shardServer["quorumPriorities"][qp]["priority"]
+ }
var quorumInfo = scaliendb.getQuorumInfo(configState, nodeID, quorum["quorumID"]);
- var infoText = "";
+ var infoText = " [prio = " + priority + ", ";
if (quorumInfo != null)
{
if (paxosID !== "unknown")
- infoText += " [" + paxosID + "]";
+ infoText += " repl = " + paxosID + "]";
else
- infoText += " [" + quorumInfo["paxosID"] + "]";
+ infoText += " repl = " + quorumInfo["paxosID"] + "]";
if (quorumInfo["isSendingCatchup"])
catchupText += "Shard server " + nodeID + " is sending catchup: " + scaliendb.util.humanBytes(quorumInfo["catchupBytesSent"]) + "/" + scaliendb.util.humanBytes(quorumInfo["catchupBytesTotal"]) + " (" + scaliendb.util.humanBytes(quorumInfo["catchupThroughput"]) + "/s)";
}
@@ -1122,10 +1128,16 @@ function createQuorumDiv(configState, quorum)
{
var nodeID = quorum["inactiveNodes"][i];
var shardServer = scaliendb.getShardServer(configState, nodeID);
+ var priority = 1;
+ for (var qp in shardServer["quorumPriorities"])
+ {
+ if (shardServer["quorumPriorities"][qp]["quorumID"] == quorum["quorumID"])
+ priority = shardServer["quorumPriorities"][qp]["priority"]
+ }
var quorumInfo = scaliendb.getQuorumInfo(configState, nodeID, quorum["quorumID"]);
- var infoText = "";
+ var infoText = " [prio = " + priority + ", ";
if (quorumInfo != null)
- infoText += " [" + quorumInfo["paxosID"] + "]";
+ infoText += " repl = " + quorumInfo["paxosID"] + "]";
if (shardServer["hasHeartbeat"] && primaryID != null)
html += ' <a class="no-line" style="color:black" title="Activate shard server" href="javascript:activateNode(' + quorum["quorumID"] + ", " + nodeID + ')"><span class="shardserver-number healthy">' + nodeID + infoText + ' (click to activate)</span></a> ';
else

0 comments on commit 793a3a8

Please sign in to comment.
Something went wrong with that request. Please try again.