added error tracing to help on bug #106

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16498 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2006-02-22 22:57:50 +00:00
parent 2e298fb603
commit 866d738a05
3 changed files with 14 additions and 10 deletions
@@ -826,7 +826,7 @@ BPlusTree::InsertDuplicate(Transaction &transaction, CachedNode &cached,
bplustree_node *newDuplicate; bplustree_node *newDuplicate;
status = cachedDuplicate.Allocate(transaction, &newDuplicate, &offset); status = cachedDuplicate.Allocate(transaction, &newDuplicate, &offset);
if (status < B_OK) if (status < B_OK)
return status; RETURN_ERROR(status);
// copy the array from the fragment node to the duplicate node // copy the array from the fragment node to the duplicate node
// and free the old entry (by zero'ing all values) // and free the old entry (by zero'ing all values)
@@ -884,7 +884,7 @@ BPlusTree::InsertDuplicate(Transaction &transaction, CachedNode &cached,
bplustree_node *newDuplicate; bplustree_node *newDuplicate;
status = cachedDuplicate.Allocate(transaction, &newDuplicate, &offset); status = cachedDuplicate.Allocate(transaction, &newDuplicate, &offset);
if (status < B_OK) if (status < B_OK)
return status; RETURN_ERROR(status);
// link the two nodes together // link the two nodes together
writableDuplicate->right_link = HOST_ENDIAN_TO_BFS_INT64(offset); writableDuplicate->right_link = HOST_ENDIAN_TO_BFS_INT64(offset);
@@ -906,7 +906,7 @@ BPlusTree::InsertDuplicate(Transaction &transaction, CachedNode &cached,
&offset, &fragment, &fragmentIndex) != B_OK) { &offset, &fragment, &fragmentIndex) != B_OK) {
// allocate a new duplicate fragment node // allocate a new duplicate fragment node
if ((status = cachedDuplicate.Allocate(transaction, &fragment, &offset)) < B_OK) if ((status = cachedDuplicate.Allocate(transaction, &fragment, &offset)) < B_OK)
return status; RETURN_ERROR(status);
memset(fragment, 0, fNodeSize); memset(fragment, 0, fNodeSize);
} }
@@ -1233,9 +1233,13 @@ BPlusTree::Insert(Transaction &transaction, const uint8 *key, uint16 keyLength,
// is this a duplicate entry? // is this a duplicate entry?
if (status == B_OK) { if (status == B_OK) {
if (fAllowDuplicates) if (fAllowDuplicates) {
return InsertDuplicate(transaction, cached, node, nodeAndKey.keyIndex, value); status = InsertDuplicate(transaction, cached, node, nodeAndKey.keyIndex, value);
if (status != B_OK)
RETURN_ERROR(status);
return B_OK;
}
RETURN_ERROR(B_NAME_IN_USE); RETURN_ERROR(B_NAME_IN_USE);
} }
} }
@@ -255,7 +255,7 @@ Index::Update(Transaction &transaction, const char *name, int32 type, const uint
BPlusTree *tree; BPlusTree *tree;
if ((status = Node()->GetTree(&tree)) < B_OK) if ((status = Node()->GetTree(&tree)) < B_OK)
return status; status;
// remove the old key from the tree // remove the old key from the tree
@@ -265,7 +265,7 @@ Index::Update(Transaction &transaction, const char *name, int32 type, const uint
// That's not nice, but should be no reason to let the whole thing fail // That's not nice, but should be no reason to let the whole thing fail
INFORM(("Could not find value in index \"%s\"!\n", name)); INFORM(("Could not find value in index \"%s\"!\n", name));
} else if (status < B_OK) } else if (status < B_OK)
return status; status;
} }
// add the new key to the tree // add the new key to the tree
@@ -273,7 +273,7 @@ Index::Update(Transaction &transaction, const char *name, int32 type, const uint
if (newKey != NULL) if (newKey != NULL)
status = tree->Insert(transaction, (const uint8 *)newKey, newLength, inode->ID()); status = tree->Insert(transaction, (const uint8 *)newKey, newLength, inode->ID());
return status; RETURN_ERROR(status);
} }
@@ -2258,7 +2258,7 @@ Inode::Create(Transaction &transaction, Inode *parent, const char *name, int32 m
else if (parent != NULL && (mode & S_ATTR_DIR) != 0) else if (parent != NULL && (mode & S_ATTR_DIR) != 0)
parent->Node().attributes.SetTo(0, 0, 0); parent->Node().attributes.SetTo(0, 0, 0);
return status; RETURN_ERROR(status);
} }
} }