3541 John David Duncan 2011-09-23
Attempt to fix compiler & linker issues with ndb/memcache/unit/test_workqueue
Remove workitem.base.is_sync
modified:
storage/ndb/memcache/include/workitem.h
storage/ndb/memcache/src/TableSpec.cc
storage/ndb/memcache/src/ndb_worker.cc
storage/ndb/memcache/src/workitem.c
storage/ndb/memcache/unit/CMakeLists.txt
storage/ndb/memcache/unit/test_workqueue.c
3540 John David Duncan 2011-09-22
Fix for bad free() in TableSpec destructor.
modified:
storage/ndb/memcache/sandbox.sh.in
storage/ndb/memcache/src/TableSpec.cc
=== modified file 'storage/ndb/memcache/include/workitem.h'
--- a/storage/ndb/memcache/include/workitem.h 2011-09-12 10:05:07 +0000
+++ b/storage/ndb/memcache/include/workitem.h 2011-09-23 18:29:30 +0000
@@ -45,7 +45,7 @@ typedef struct workitem {
unsigned verb : 4; /*! READ, DELETE, ADD, STORE, etc. */
unsigned math_incr : 1; /*! incr, or decr ? */
unsigned math_create : 1; /*! create record if not existing */
- unsigned is_sync : 1; /*! is the user waiting for a response? */
+ unsigned _unused_1 : 1; /*! (formerly was is_sync) */
unsigned has_value : 1; /*! are we able to use a no-copy value? */
unsigned retries : 3; /*! how many times this job has been retried */
unsigned complete : 1; /*! is this operation finished? */
=== modified file 'storage/ndb/memcache/src/TableSpec.cc'
--- a/storage/ndb/memcache/src/TableSpec.cc 2011-09-23 01:44:59 +0000
+++ b/storage/ndb/memcache/src/TableSpec.cc 2011-09-23 18:29:30 +0000
@@ -125,6 +125,7 @@ TableSpec::TableSpec(const TableSpec &t)
value_columns[i] = strdup(t.value_columns[i]);
must_free.all_val_cols = 1;
}
+ must_free.first_key = must_free.first_val = 0;
}
=== modified file 'storage/ndb/memcache/src/ndb_worker.cc'
--- a/storage/ndb/memcache/src/ndb_worker.cc 2011-09-22 18:27:10 +0000
+++ b/storage/ndb/memcache/src/ndb_worker.cc 2011-09-23 18:29:30 +0000
@@ -576,22 +576,10 @@ void DB_callback(int result, NdbTransact
assert("How did we get here?" == 0);
}
- tx->close();
-
- // If this was a synchronous call, the server is waiting for us
- if(wqitem->base.is_sync) {
- wqitem->status = return_status;
- pipeline->engine->server.cookie->store_engine_specific(wqitem->cookie, wqitem);
- pipeline->scheduler->yield(wqitem);
- }
- else {
- /* The workitem was allocated back in the engine thread; if used in a
- callback, it would be freed there, too. But we must free it here.
- */
- pipeline->engine->server.cookie->store_engine_specific(wqitem->cookie, wqitem->previous);
- pipeline->scheduler->io_completed(wqitem);
- workitem_free(wqitem);
- }
+ tx->close();
+ wqitem->status = return_status;
+ pipeline->engine->server.cookie->store_engine_specific(wqitem->cookie, wqitem);
+ pipeline->scheduler->yield(wqitem);
}
@@ -766,18 +754,9 @@ void incr_callback(int result, NdbTransa
tx->close();
- if(wqitem->base.is_sync) {
- wqitem->status = return_status;
- pipeline->engine->server.cookie->store_engine_specific(wqitem->cookie, wqitem);
- pipeline->scheduler->yield(wqitem);
- }
- else {
- /* The workitem was allocated back in the engine thread; if used in a
- callback, it would be freed there, too. But we must free it here. */
- pipeline->engine->server.cookie->store_engine_specific(wqitem->cookie, wqitem->previous);
- pipeline->scheduler->io_completed(wqitem);
- workitem_free(wqitem);
- }
+ wqitem->status = return_status;
+ pipeline->engine->server.cookie->store_engine_specific(wqitem->cookie, wqitem);
+ pipeline->scheduler->yield(wqitem);
}
=== modified file 'storage/ndb/memcache/src/workitem.c'
--- a/storage/ndb/memcache/src/workitem.c 2011-09-22 18:27:10 +0000
+++ b/storage/ndb/memcache/src/workitem.c 2011-09-23 18:29:30 +0000
@@ -64,7 +64,6 @@ void workitem__initialize(workitem *item
memset(item, 0, sizeof(workitem)); /* zero out the item */
item->base.nkey = nkey;
item->base.verb = verb;
- item->base.is_sync = 1;
item->base.has_value = 0;
item->base.retries = 0;
item->base.complete = 0;
=== modified file 'storage/ndb/memcache/unit/CMakeLists.txt'
--- a/storage/ndb/memcache/unit/CMakeLists.txt 2011-09-12 10:05:07 +0000
+++ b/storage/ndb/memcache/unit/CMakeLists.txt 2011-09-23 18:29:30 +0000
@@ -15,8 +15,7 @@ set(UNIT_SOURCE_FILES
add_executable(run_unit_tests ${UNIT_SOURCE_FILES})
target_link_libraries(run_unit_tests ndbmemcache)
-add_executable(test_workqueue test_workqueue.c)
-target_link_libraries(test_workqueue ndbmemcache)
+add_executable(test_workqueue test_workqueue.c ../src/workqueue.c)
# Tests which can run without a cluster:
=== modified file 'storage/ndb/memcache/unit/test_workqueue.c'
--- a/storage/ndb/memcache/unit/test_workqueue.c 2011-09-22 19:01:58 +0000
+++ b/storage/ndb/memcache/unit/test_workqueue.c 2011-09-23 18:29:30 +0000
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <assert.h>
#include <time.h>
-#include <sys/types.h>
#include "workqueue.h"
#include <ndbmemcache_config.h>
@@ -140,7 +139,7 @@ int run_test(struct threadinfo *params)
void * producer_thread(void *arg) {
long long total_sleep = 0;
- useconds_t slp = 0;
+ int slp = 0;
size_t i = 1;
int n_ints;
int sample_interval = 1000;
@@ -189,7 +188,7 @@ void * producer_thread(void *arg) {
void * consumer_thread(void *arg) {
- useconds_t slp = 0;
+ int slp = 0;
long long total_sleep = 0;
size_t i;
size_t last_i = 0;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.5-cluster branch (john.duncan:3540 to 3541) | John David Duncan | 24 Sep |