Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trackrdrd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
trackrdrd
Commits
f106e07f
Commit
f106e07f
authored
Apr 30, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename config param maxdone as max.records
parent
d7cba52b
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
33 additions
and
33 deletions
+33
-33
config.c
src/config.c
+5
-5
data.c
src/data.c
+5
-5
monitor.c
src/monitor.c
+1
-1
spmcq.c
src/spmcq.c
+1
-1
regress.sh
src/test/regress.sh
+1
-1
test.conf
src/test/test.conf
+1
-1
test_config.c
src/test/test_config.c
+1
-1
test_data.c
src/test/test_data.c
+6
-6
test_spmcq.c
src/test/test_spmcq.c
+3
-3
test_worker.c
src/test/test_worker.c
+3
-3
trackrdrd_001.conf
src/test/trackrdrd_001.conf
+1
-1
trackrdrd_002.conf
src/test/trackrdrd_002.conf
+1
-1
trackrdrd_003.conf
src/test/trackrdrd_003.conf
+1
-1
trackrdrd_010.conf
src/test/trackrdrd_010.conf
+1
-1
trackrdrd.h
src/trackrdrd.h
+2
-2
No files found.
src/config.c
View file @
f106e07f
...
...
@@ -128,14 +128,14 @@ CONF_Add(const char *lval, const char *rval)
confUnsigned
(
"thread.restarts"
,
thread_restarts
);
confUnsigned
(
"monitor.interval"
,
monitor_interval
);
if
(
strcmp
(
lval
,
"max
done
"
)
==
0
)
{
if
(
strcmp
(
lval
,
"max
.records
"
)
==
0
)
{
unsigned
int
i
;
int
err
=
conf_getUnsignedInt
(
rval
,
&
i
);
if
(
err
!=
0
)
return
err
;
config
.
max
done
=
i
;
config
.
max
_records
=
i
;
if
(
!
qlen_configured
)
config
.
qlen_goal
=
config
.
max
done
>>
1
;
config
.
qlen_goal
=
config
.
max
_records
>>
1
;
return
(
0
);
}
...
...
@@ -206,7 +206,7 @@ CONF_Init(void)
config
.
syslog_facility
=
LOG_LOCAL0
;
config
.
monitor_interval
=
30
;
config
.
monitor_workers
=
false
;
config
.
max
done
=
DEF_MAXDONE
;
config
.
max
_records
=
DEF_MAX_RECORDS
;
config
.
maxdata
=
DEF_MAXDATA
;
config
.
maxkeylen
=
DEF_MAXKEYLEN
;
config
.
qlen_goal
=
DEF_QLEN_GOAL
;
...
...
@@ -257,7 +257,7 @@ CONF_Dump(int level)
confdump
(
level
,
"monitor.interval = %u"
,
config
.
monitor_interval
);
confdump
(
level
,
"monitor.workers = %s"
,
config
.
monitor_workers
?
"true"
:
"false"
);
confdump
(
level
,
"max
done = %u"
,
config
.
maxdone
);
confdump
(
level
,
"max
.records = %u"
,
config
.
max_records
);
confdump
(
level
,
"maxdata = %u"
,
config
.
maxdata
);
confdump
(
level
,
"maxkeylen = %u"
,
config
.
maxkeylen
);
confdump
(
level
,
"qlen.goal = %u"
,
config
.
qlen_goal
);
...
...
src/data.c
View file @
f106e07f
...
...
@@ -73,11 +73,11 @@ DATA_Init(void)
* we want enough space to accomodate all open and done records
*
*/
entrytbl
=
(
dataentry
*
)
calloc
(
config
.
max
done
,
sizeof
(
dataentry
));
entrytbl
=
(
dataentry
*
)
calloc
(
config
.
max
_records
,
sizeof
(
dataentry
));
if
(
entrytbl
==
NULL
)
return
(
errno
);
buf
=
(
char
*
)
calloc
(
config
.
max
done
,
bufsize
);
buf
=
(
char
*
)
calloc
(
config
.
max
_records
,
bufsize
);
if
(
buf
==
NULL
)
{
free
(
entrytbl
);
return
(
errno
);
...
...
@@ -88,14 +88,14 @@ DATA_Init(void)
global_nfree
=
0
;
for
(
unsigned
i
=
0
;
i
<
config
.
max
done
;
i
++
)
{
for
(
unsigned
i
=
0
;
i
<
config
.
max
_records
;
i
++
)
{
entrytbl
[
i
].
magic
=
DATA_MAGIC
;
entrytbl
[
i
].
data
=
&
buf
[
i
*
bufsize
];
entrytbl
[
i
].
key
=
&
buf
[(
i
*
bufsize
)
+
config
.
maxdata
];
VSTAILQ_INSERT_TAIL
(
&
freehead
,
&
entrytbl
[
i
],
freelist
);
global_nfree
++
;
}
assert
(
global_nfree
==
config
.
max
done
);
assert
(
global_nfree
==
config
.
max
_records
);
assert
(
VSTAILQ_FIRST
(
&
freehead
));
atexit
(
data_Cleanup
);
...
...
@@ -152,7 +152,7 @@ DATA_Return_Freelist(struct freehead_s *returned, unsigned nreturned)
void
DATA_Dump
(
void
)
{
for
(
int
i
=
0
;
i
<
config
.
max
done
;
i
++
)
{
for
(
int
i
=
0
;
i
<
config
.
max
_records
;
i
++
)
{
dataentry
*
entry
=
&
entrytbl
[
i
];
if
(
!
OCCUPIED
(
entry
))
...
...
src/monitor.c
View file @
f106e07f
...
...
@@ -63,7 +63,7 @@ log_output(void)
LOG_Log
(
LOG_INFO
,
"Data table: len=%u occ=%u occ_hi=%u occ_hi_this=%u "
"global_free=%u"
,
config
.
max
done
,
occ
,
occ_hi
,
occ_hi_this
,
global_nfree
);
config
.
max
_records
,
occ
,
occ_hi
,
occ_hi_this
,
global_nfree
);
/* Eliminate the dependency of trackrdrd.o for unit tests */
#ifndef TEST_DRIVER
...
...
src/spmcq.c
View file @
f106e07f
...
...
@@ -82,7 +82,7 @@ SPMCQ_Enq(dataentry *ptr)
{
AZ
(
pthread_mutex_lock
(
&
spmcq_lock
));
#if 0
assert(enqs - deqs < config.max
done
);
assert(enqs - deqs < config.max
_records
);
#endif
enqs
++
;
VSTAILQ_INSERT_TAIL
(
&
enq_head
,
ptr
,
spmcq
);
...
...
src/test/regress.sh
View file @
f106e07f
...
...
@@ -21,7 +21,7 @@ CMD="../trackrdrd -D -f varnish.binlog -l - -d -c test.conf"
# the user running it
CKSUM
=
$(
$CMD
|
sed
-e
's/\(initializing\) \(.*\)/\1/'
|
sed
-e
's/\(Running as\) \([a-zA-Z0-9]*\)$/\1/'
|
grep
-v
'Not running as root'
|
cksum
)
if
[
"
$CKSUM
"
!=
'
2726228080 249605
'
]
;
then
if
[
"
$CKSUM
"
!=
'
3569206281 249613
'
]
;
then
echo
"ERROR: Regression test incorrect log cksum:
$CKSUM
"
exit
1
fi
...
...
src/test/test.conf
View file @
f106e07f
...
...
@@ -2,7 +2,7 @@
log
.
file
= /
tmp
/
trackrdrd
.
log
pid
.
file
=
trackrdrd
.
pid
maxdata
=
4096
max
done
=
1024
max
.
records
=
1024
monitor
.
interval
=
0
nworkers
=
1
mq
.
module
= ../
mq
/
file
/.
libs
/
libtrackrdr
-
file
.
so
...
...
src/test/test_config.c
View file @
f106e07f
...
...
@@ -72,7 +72,7 @@ getConfigContent(void)
confdump
(
"syslog.facility = %s"
,
config
.
syslog_facility_name
);
confdump
(
"monitor.interval = %u"
,
config
.
monitor_interval
);
confdump
(
"monitor.workers = %s"
,
config
.
monitor_workers
?
"true"
:
"false"
);
confdump
(
"max
done = %u"
,
config
.
maxdone
);
confdump
(
"max
.records = %u"
,
config
.
max_records
);
confdump
(
"maxdata = %u"
,
config
.
maxdata
);
confdump
(
"maxkeylen = %u"
,
config
.
maxkeylen
);
confdump
(
"qlen.goal = %u"
,
config
.
qlen_goal
);
...
...
src/test/test_data.c
View file @
f106e07f
...
...
@@ -51,13 +51,13 @@ static char
printf
(
"... testing data table initialization
\n
"
);
config
.
max
done
=
DEF_MAXDONE
;
config
.
max
_records
=
DEF_MAX_RECORDS
;
config
.
maxdata
=
DEF_MAXDATA
;
config
.
maxkeylen
=
DEF_MAXKEYLEN
;
err
=
DATA_Init
();
VMASSERT
(
err
==
0
,
"DATA_Init: %s"
,
strerror
(
err
));
for
(
int
i
=
0
;
i
<
config
.
max
done
;
i
++
)
{
for
(
int
i
=
0
;
i
<
config
.
max
_records
;
i
++
)
{
MCHECK_OBJ_NOTNULL
(
&
entrytbl
[
i
],
DATA_MAGIC
);
MASSERT
(
!
OCCUPIED
(
&
entrytbl
[
i
]));
MAZ
(
entrytbl
[
i
].
hasdata
);
...
...
@@ -80,7 +80,7 @@ static const char
printf
(
"... testing data write and read
\n
"
);
for
(
int
i
=
0
;
i
<
config
.
max
done
;
i
++
)
{
for
(
int
i
=
0
;
i
<
config
.
max
_records
;
i
++
)
{
memset
(
entrytbl
[
i
].
data
,
'd'
,
DEF_MAXDATA
);
memset
(
entrytbl
[
i
].
key
,
'k'
,
DEF_MAXKEYLEN
);
}
...
...
@@ -88,7 +88,7 @@ static const char
memset
(
data
,
'd'
,
DEF_MAXDATA
);
memset
(
key
,
'k'
,
DEF_MAXKEYLEN
);
for
(
int
i
=
0
;
i
<
config
.
max
done
;
i
++
)
{
for
(
int
i
=
0
;
i
<
config
.
max
_records
;
i
++
)
{
MASSERT
(
memcmp
(
entrytbl
[
i
].
data
,
data
,
DEF_MAXDATA
)
==
0
);
MASSERT
(
memcmp
(
entrytbl
[
i
].
key
,
key
,
DEF_MAXKEYLEN
)
==
0
);
}
...
...
@@ -103,7 +103,7 @@ static const char
nfree
=
DATA_Take_Freelist
(
&
local_freehead
);
MASSERT
(
nfree
==
config
.
max
done
);
MASSERT
(
nfree
==
config
.
max
_records
);
MASSERT0
(
!
VSTAILQ_EMPTY
(
&
local_freehead
),
"Local freelist empty after take"
);
...
...
@@ -127,7 +127,7 @@ static const char
MASSERT0
(
VSTAILQ_EMPTY
(
&
local_freehead
),
"Local freelist non-empty after return"
);
MASSERT
(
global_nfree
==
DEF_MAX
DONE
);
MASSERT
(
global_nfree
==
DEF_MAX
_RECORDS
);
MASSERT0
(
!
VSTAILQ_EMPTY
(
&
freehead
),
"Global free list empty after take"
);
...
...
src/test/test_spmcq.c
View file @
f106e07f
...
...
@@ -44,7 +44,7 @@
#define NCON 10
#define TABLE_SIZE (DEF_MAX
DONE
)
#define TABLE_SIZE (DEF_MAX
_RECORDS
)
int
run
;
...
...
@@ -81,7 +81,7 @@ static void
srand48
(
time
(
NULL
));
unsigned
xid
=
(
unsigned
int
)
lrand48
();
for
(
int
i
=
0
;
i
<
config
.
max
done
;
i
++
)
{
for
(
int
i
=
0
;
i
<
config
.
max
_records
;
i
++
)
{
entries
[
i
].
xid
=
xid
;
debug_print
(
"Producer: enqueue %d (xid = %u)
\n
"
,
++
enqs
,
xid
);
SPMCQ_Enq
(
&
entries
[
i
]);
...
...
@@ -170,7 +170,7 @@ static char
return
(
errmsg
);
}
config
.
max
done
=
DEF_MAXDONE
;
config
.
max
_records
=
DEF_MAX_RECORDS
;
err
=
SPMCQ_Init
();
sprintf
(
errmsg
,
"SPMCQ_Init: %s"
,
strerror
(
err
));
mu_assert
(
errmsg
,
err
==
0
);
...
...
src/test/test_worker.c
View file @
f106e07f
...
...
@@ -100,7 +100,7 @@ static char
printf
(
"... testing worker initialization
\n
"
);
config
.
max
done
=
DEF_MAXDONE
;
config
.
max
_records
=
DEF_MAX_RECORDS
;
config
.
maxdata
=
DEF_MAXDATA
;
config
.
maxkeylen
=
DEF_MAXKEYLEN
;
config
.
nworkers
=
NWORKERS
;
...
...
@@ -142,7 +142,7 @@ static const char
VMASSERT
(
wrk_running
==
NWORKERS
,
"%d of %d worker threads running"
,
wrk_running
,
NWORKERS
);
for
(
int
i
=
0
;
i
<
config
.
max
done
;
i
++
)
{
for
(
int
i
=
0
;
i
<
config
.
max
_records
;
i
++
)
{
entry
=
&
entrytbl
[
i
];
MCHECK_OBJ_NOTNULL
(
entry
,
DATA_MAGIC
);
entry
->
xid
=
xid
;
...
...
@@ -162,7 +162,7 @@ static const char
* Verify DATA_Reset() by checking that all data entry fields are in
* empty states after worker threads are shut down.
*/
for
(
int
i
=
0
;
i
<
config
.
max
done
;
i
++
)
{
for
(
int
i
=
0
;
i
<
config
.
max
_records
;
i
++
)
{
entry
=
&
entrytbl
[
i
];
MCHECK_OBJ_NOTNULL
(
entry
,
DATA_MAGIC
);
MASSERT
(
!
OCCUPIED
(
entry
));
...
...
src/test/trackrdrd_001.conf
View file @
f106e07f
...
...
@@ -5,7 +5,7 @@ varnish.bindump =
syslog
.
facility
=
LOCAL5
monitor
.
interval
=
30
monitor
.
workers
=
true
max
done
=
10000
max
.
records
=
10000
maxdata
=
8192
maxkeylen
=
126
qlen
.
goal
=
4990
...
...
src/test/trackrdrd_002.conf
View file @
f106e07f
...
...
@@ -5,7 +5,7 @@ varnish.bindump =
syslog
.
facility
=
LOCAL5
monitor
.
interval
=
300
monitor
.
workers
=
false
max
done
=
10001
max
.
records
=
10001
maxdata
=
1024
maxkeylen
=
124
qlen
.
goal
=
4991
...
...
src/test/trackrdrd_003.conf
View file @
f106e07f
...
...
@@ -5,7 +5,7 @@ varnish.bindump =
syslog
.
facility
=
LOCAL5
monitor
.
interval
=
10000000
monitor
.
workers
=
true
max
done
=
10001
max
.
records
=
10001
maxdata
=
1024
maxkeylen
=
124
qlen
.
goal
=
4991
...
...
src/test/trackrdrd_010.conf
View file @
f106e07f
...
...
@@ -5,7 +5,7 @@ varnish.bindump =
syslog
.
facility
=
LOCAL5
monitor
.
interval
=
10000000
monitor
.
workers
=
true
max
done
=
10001
max
.
records
=
10001
maxdata
=
1024
maxkeylen
=
124
qlen
.
goal
=
4991
...
...
src/trackrdrd.h
View file @
f106e07f
...
...
@@ -176,8 +176,8 @@ struct config {
unsigned
monitor_interval
;
unsigned
monitor_workers
;
unsigned
max
done
;
/* max number of records in *_DONE state
*/
#define DEF_MAX
DONE
1024
unsigned
max
_records
;
/* max number of buffered records
*/
#define DEF_MAX
_RECORDS
1024
unsigned
maxdata
;
/* size of char data buffer */
#define DEF_MAXDATA 1024
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment