Add missing error detection
If the file fails to seek to the correct position, the indexing should stop.
This commit is contained in:
@ -87,18 +87,22 @@ void avro_index_file(AVRO_INSTANCE *router, const char* filename)
|
|||||||
|
|
||||||
snprintf(sql, sizeof(sql), "SELECT position FROM "INDEX_TABLE_NAME
|
snprintf(sql, sizeof(sql), "SELECT position FROM "INDEX_TABLE_NAME
|
||||||
" WHERE filename=\"%s\";", name);
|
" WHERE filename=\"%s\";", name);
|
||||||
|
|
||||||
if (sqlite3_exec(router->sqlite_handle, sql, index_query_cb, &pos, &errmsg) != SQLITE_OK)
|
if (sqlite3_exec(router->sqlite_handle, sql, index_query_cb, &pos, &errmsg) != SQLITE_OK)
|
||||||
{
|
{
|
||||||
MXS_ERROR("Failed to read last indexed position of file '%s': %s",
|
MXS_ERROR("Failed to read last indexed position of file '%s': %s",
|
||||||
name, errmsg);
|
name, errmsg);
|
||||||
}
|
|
||||||
else if (pos > 0)
|
|
||||||
{
|
|
||||||
/** Continue from last position */
|
|
||||||
maxavro_record_set_pos(file, pos);
|
|
||||||
}
|
|
||||||
sqlite3_free(errmsg);
|
sqlite3_free(errmsg);
|
||||||
errmsg = NULL;
|
maxavro_file_close(file);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Continue from last position */
|
||||||
|
if (pos > 0 && !maxavro_record_set_pos(file, pos))
|
||||||
|
{
|
||||||
|
maxavro_file_close(file);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
gtid_pos_t prev_gtid = {0, 0, 0, 0, 0};
|
gtid_pos_t prev_gtid = {0, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user