summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVyacheslav Tyutyunkov <tve@softmotions.com>2017-03-17 14:35:28 +0700
committerVyacheslav Tyutyunkov <tve@softmotions.com>2017-03-17 14:35:28 +0700
commitf886930a0608cf62cfc4267baf1435da1ba6cc91 (patch)
treece96ff1d330ebfbe5cf704f22e5daf3a7c87deb0
parenta79909e7a45b4da4dfedc5097d7d37b8f25b3cbb (diff)
downloadejdb-f886930a0608cf62cfc4267baf1435da1ba6cc91.tar.gz
ejdb-f886930a0608cf62cfc4267baf1435da1ba6cc91.tar.bz2
ejdb-f886930a0608cf62cfc4267baf1435da1ba6cc91.zip
#174 - clearing TCENOREC status on coll creation
-rw-r--r--src/ejdb/tests/ejdbtest6.c22
-rw-r--r--src/tctdb/tctdb.c2
2 files changed, 23 insertions, 1 deletions
diff --git a/src/ejdb/tests/ejdbtest6.c b/src/ejdb/tests/ejdbtest6.c
index cdc8e79..56817ae 100644
--- a/src/ejdb/tests/ejdbtest6.c
+++ b/src/ejdb/tests/ejdbtest6.c
@@ -99,6 +99,25 @@ void subTestIssue182() {
bson_destroy(&b3);
}
+void testIssue174(void) {
+ EJDB *jb = ejdbnew();
+ CU_ASSERT_TRUE_FATAL(ejdbopen(jb, "dbt6", JBOWRITER | JBOCREAT | JBOTRUNC));
+ EJCOLL *coll1 = ejdbcreatecoll(jb, "issue174_1", NULL);
+ CU_ASSERT_EQUAL_FATAL(ejdbecode(jb), TCESUCCESS);
+ CU_ASSERT_PTR_NOT_NULL_FATAL(coll1);
+
+ EJCOLL *coll2 = ejdbcreatecoll(jb, "issue174_2", NULL);
+ CU_ASSERT_EQUAL_FATAL(ejdbecode(jb), TCESUCCESS);
+ CU_ASSERT_PTR_NOT_NULL_FATAL(coll2);
+
+ EJCOLL *coll3 = ejdbcreatecoll(jb, "issue174_3", NULL);
+ CU_ASSERT_EQUAL_FATAL(ejdbecode(jb), TCESUCCESS);
+ CU_ASSERT_PTR_NOT_NULL_FATAL(coll3);
+
+ ejdbclose(jb);
+ ejdbdel(jb);
+}
+
int init_suite(void) {
return 0;
}
@@ -125,7 +144,8 @@ int main() {
/* Add the tests to the suite */
if (
(NULL == CU_add_test(pSuite, "subTestIssue182", subTestIssue182)) ||
- (NULL == CU_add_test(pSuite, "testIssue182", testIssue182))
+ (NULL == CU_add_test(pSuite, "testIssue182", testIssue182)) ||
+ (NULL == CU_add_test(pSuite, "testIssue174", testIssue174))
) {
CU_cleanup_registry();
return CU_get_error();
diff --git a/src/tctdb/tctdb.c b/src/tctdb/tctdb.c
index d02afbd..859cb5d 100644
--- a/src/tctdb/tctdb.c
+++ b/src/tctdb/tctdb.c
@@ -2090,6 +2090,8 @@ static bool tctdbputimpl(TCTDB *tdb, const void *pkbuf, int pksiz, TCMAP *cols,
tcmapdel(ocols);
TCFREE(obuf);
} else {
+ // clear TCENOREC status
+ if (tctdbecode(tdb) == TCENOREC) tctdbsetecode(tdb, TCESUCCESS, __FILE__, __LINE__, __func__);
if (!tctdbidxput(tdb, pkbuf, pksiz, cols)) err = true;
int csiz;
char *cbuf = tcmapdump(cols, &csiz);