Skip to content

Commit

Permalink
Debugs for Node/link creation/deletion. Warning/trace in parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkarwa committed Jan 10, 2014
1 parent 6093b0e commit a294f75
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/ifmap/ifmap_link_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "db/db_graph.h"
#include "db/db_table_partition.h"
#include "ifmap/ifmap_link.h"
#include "ifmap/ifmap_log.h"
#include "ifmap/ifmap_log_types.h"

using namespace std;

Expand Down Expand Up @@ -48,6 +50,7 @@ void IFMapLinkTable::AddLink(DBGraphBase::edge_descriptor edge,
}
link->SetProperties(left, right, metadata, sequence_number, origin);
graph_->SetEdgeProperty(link);
IFMAP_DEBUG(IFMapLinkOperation, "Creating", link->ToString());
}

IFMapLink *IFMapLinkTable::FindLink(DBGraphBase::edge_descriptor edge) {
Expand All @@ -61,6 +64,7 @@ IFMapLink *IFMapLinkTable::FindLink(DBGraphBase::edge_descriptor edge) {

void IFMapLinkTable::DeleteLink(DBGraphEdge *edge) {
IFMapLink *link = static_cast<IFMapLink *>(edge);
IFMAP_DEBUG(IFMapLinkOperation, "Deleting", link->ToString());
link->set_last_change_at_to_now();
link->ClearNodes();
DBTablePartition *partition =
Expand Down
30 changes: 30 additions & 0 deletions src/ifmap/ifmap_log.sandesh
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,21 @@ systemlog sandesh IFMapClientSendInfo {
6: string client_name (key="ObjectVRouter")
}

systemlog sandesh IFMapNodeOperation {
1: string op
2: string node_name
}

systemlog sandesh IFMapLinkOperation {
1: string op
2: string node_name
}

systemlog sandesh IFMapXmlLoadError {
1: string message
2: u32 length
}

trace sandesh JoinVertexTrace {
1: "JoinVertex:"
2: string vertex_name
Expand Down Expand Up @@ -357,3 +372,18 @@ trace sandesh IFMapXmppVmSubUnsubTrace {
3: string vm_name
}

trace sandesh IFMapNodeOperationTrace {
1: string op
2: string node_name
}

trace sandesh IFMapLinkOperationTrace {
1: string op
2: string node_name
}

trace sandesh IFMapXmlLoadErrorTrace {
1: string message
2: u32 length
}

7 changes: 5 additions & 2 deletions src/ifmap/ifmap_server_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include "ifmap/ifmap_server_parser.h"

#include <pugixml/pugixml.hpp>
#include "base/logging.h"
#include "db/db.h"
#include "ifmap/ifmap_server_table.h"
#include "ifmap/ifmap_log.h"
#include "ifmap/ifmap_log_types.h"

using namespace std;
using namespace pugi;
Expand Down Expand Up @@ -217,7 +218,7 @@ void IFMapServerParser::Receive(DB *db, const char *data, size_t length,
xml_document xdoc;
pugi::xml_parse_result result = xdoc.load_buffer(data, length);
if (!result) {
LOG(WARN, "Unable to load XML document");
IFMAP_WARN(IFMapXmlLoadError, "Unable to load XML document", length);
return;
}

Expand All @@ -235,6 +236,8 @@ void IFMapServerParser::Receive(DB *db, const char *data, size_t length,
IFMapTable *table = IFMapTable::FindTable(db, key->id_type);
if (table != NULL) {
table->Enqueue(req.get());
} else {
IFMAP_TRACE(IFMapTblNotFoundTrace, "Cant find table", key->id_type);
}
}
}
3 changes: 3 additions & 0 deletions src/ifmap/ifmap_server_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ IFMapNode *IFMapServerTable::EntryLocate(RequestKey *request, bool *changep) {
if (node->IsDeleted()) {
node->ClearDelete();
graph_->AddNode(node);
IFMAP_DEBUG(IFMapNodeOperation, "Re-creating", node->ToString());
*changep = true;
}
return node;
Expand All @@ -85,6 +86,7 @@ IFMapNode *IFMapServerTable::EntryLocate(RequestKey *request, bool *changep) {
static_cast<DBTablePartition *>(GetTablePartition(0));
partition->Add(node);
graph_->AddNode(node);
IFMAP_DEBUG(IFMapNodeOperation, "Creating", node->ToString());
return node;
}

Expand Down Expand Up @@ -143,6 +145,7 @@ std::string IFMapServerTable::LinkAttrKey(IFMapNode *first, IFMapNode *second) {
}

void IFMapServerTable::DeleteNode(IFMapNode *node) {
IFMAP_DEBUG(IFMapNodeOperation, "Deleting", node->ToString());
DBTablePartition *partition =
static_cast<DBTablePartition *>(GetTablePartition(0));
graph_->RemoveNode(node);
Expand Down

0 comments on commit a294f75

Please sign in to comment.