Remove unnecessary locking
The lock didn't really protect anything but since it was not explicitly initialized, it caused a hang.
This commit is contained in:
@ -749,11 +749,9 @@ static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_sessio
|
|||||||
AvroSession *client = (AvroSession *) router_session;
|
AvroSession *client = (AvroSession *) router_session;
|
||||||
|
|
||||||
spinlock_acquire(&client->catch_lock);
|
spinlock_acquire(&client->catch_lock);
|
||||||
spinlock_acquire(&client->file_lock);
|
|
||||||
|
|
||||||
client->state = AVRO_CLIENT_UNREGISTERED;
|
client->state = AVRO_CLIENT_UNREGISTERED;
|
||||||
|
|
||||||
spinlock_release(&client->file_lock);
|
|
||||||
spinlock_release(&client->catch_lock);
|
spinlock_release(&client->catch_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -767,13 +767,11 @@ static bool avro_client_stream_data(AvroSession *client)
|
|||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
spinlock_acquire(&client->file_lock);
|
|
||||||
if (client->file_handle == NULL &&
|
if (client->file_handle == NULL &&
|
||||||
(client->file_handle = maxavro_file_open(filename)) == NULL)
|
(client->file_handle = maxavro_file_open(filename)) == NULL)
|
||||||
{
|
{
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
spinlock_release(&client->file_lock);
|
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
@ -909,7 +907,6 @@ static void rotate_avro_file(AvroSession *client, char *fullname)
|
|||||||
client->avro_binfile[len] = 0;
|
client->avro_binfile[len] = 0;
|
||||||
client->last_sent_pos = 0;
|
client->last_sent_pos = 0;
|
||||||
|
|
||||||
spinlock_acquire(&client->file_lock);
|
|
||||||
maxavro_file_close(client->file_handle);
|
maxavro_file_close(client->file_handle);
|
||||||
|
|
||||||
if ((client->file_handle = maxavro_file_open(fullname)) == NULL)
|
if ((client->file_handle = maxavro_file_open(fullname)) == NULL)
|
||||||
@ -921,8 +918,6 @@ static void rotate_avro_file(AvroSession *client, char *fullname)
|
|||||||
MXS_INFO("Rotated '%s'@'%s' to file: %s", client->dcb->user,
|
MXS_INFO("Rotated '%s'@'%s' to file: %s", client->dcb->user,
|
||||||
client->dcb->remote, fullname);
|
client->dcb->remote, fullname);
|
||||||
}
|
}
|
||||||
|
|
||||||
spinlock_release(&client->file_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -239,7 +239,6 @@ struct AvroSession
|
|||||||
enum avro_data_format format; /*< Stream JSON or Avro data */
|
enum avro_data_format format; /*< Stream JSON or Avro data */
|
||||||
char* uuid; /*< Client UUID */
|
char* uuid; /*< Client UUID */
|
||||||
SPINLOCK catch_lock; /*< Event catchup lock */
|
SPINLOCK catch_lock; /*< Event catchup lock */
|
||||||
SPINLOCK file_lock; /*< Protects rses_deleted */
|
|
||||||
Avro* router; /*< Pointer to the owning router */
|
Avro* router; /*< Pointer to the owning router */
|
||||||
MAXAVRO_FILE* file_handle; /*< Current open file handle */
|
MAXAVRO_FILE* file_handle; /*< Current open file handle */
|
||||||
uint64_t last_sent_pos; /*< The last record we sent */
|
uint64_t last_sent_pos; /*< The last record we sent */
|
||||||
|
|||||||
Reference in New Issue
Block a user