* Note that debian alpha packages should use versions like this:
* 2.0.34-0alpha0
*/
-#define SIRIDB_VERSION_PRE_RELEASE "-alpha-0"
+#define SIRIDB_VERSION_PRE_RELEASE "-alpha-1"
#ifndef NDEBUG
#define SIRIDB_VERSION_BUILD_RELEASE "+debug"
{
continue;
}
+ else if (series->tp == TP_STRING)
+ {
+ log_error("Unexpected buffer found for string series '%s'",
+ series->name);
+ continue;
+ }
series->buffer = siridb_points_new(max_len, series->tp);
if (series->buffer == NULL)
series_tp,
siridb->server->pool,
(const char *) qp_series_name.via.raw);
+
if (series != NULL)
{
/* add series to c-tree */
- if (ct_add(siridb->series, series->name, series) ||
- imap_add(siridb->series_map, series->id, series))
+ int rc = ct_add(siridb->series, series->name, series);
+
+ if (rc == CT_EXISTS)
+ {
+ /* Duplicate series found */
+ siridb_series_t * other = ct_get(
+ siridb->series,
+ series->name);
+
+ log_error(
+ "Series '%s' with ID %"PRIu32" has a duplicate "
+ "ID %"PRIu32", "
+ "(SiriDB will keep the highest ID)",
+ series->name,
+ series->id,
+ other->id);
+
+ if (other->id >= series->id)
+ {
+ siridb__series_free(series);
+ continue;
+ }
+
+ (void) ct_pop(siridb->series, series->name);
+ (void) imap_pop(siridb->series_map, other->id);
+
+ siridb__series_free(other);
+
+ rc = ct_add(siridb->series, series->name, series);
+ }
+
+ if(rc || imap_add(siridb->series_map, series->id, series))
{
+ log_critical("series cannot be added");
return -1;
}
}