Skip to content

Commit

Permalink
remove the -c and -n flags that control log compaction
Browse files Browse the repository at this point in the history
Log compaction should not be switched off.
Manuals were fixed to mention those flags as having no effect.

Fixed beanstalkd#552
  • Loading branch information
Yury Smolsky authored Aug 31, 2019
1 parent bd16d36 commit fae6722
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 78 deletions.
1 change: 0 additions & 1 deletion dat.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ struct Wal {
int wantsync;
int64 syncrate;
int64 lastsync;
int nocomp; // disable binlog compaction?
};
int waldirlock(Wal*);
void walinit(Wal*, Job *list);
Expand Down
24 changes: 9 additions & 15 deletions doc/beanstalkd.1
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ When started, \fBbeanstalkd\fR opens a socket (or uses a file descriptor provide
Use a binlog to keep jobs on persistent storage in directory \fIpath\fR\. Upon startup, \fBbeanstalkd\fR will recover any binlog that is present in \fIpath\fR, then, during normal operation, append new jobs and changes in state to the binlog\.
.
.TP
\fB\-c\fR
Perform online, incremental compaction of binlog files\. Negates \fB\-n\fR\. This is the default behavior\.
.
.IP
(Do not use this option, except to negate \fB\-n\fR\. Both \fB\-c\fR and \fB\-n\fR will likely be removed in a future \fBbeanstalkd\fR release\.)
.
.TP
\fB\-f\fR \fIms\fR
Call fsync(2) at most once every \fIms\fR milliseconds\. Larger values for \fIms\fR reduce disk activity and improve speed at the cost of safety\. A power failure could result in the loss of up to \fIms\fR milliseconds of history\.
.
Expand Down Expand Up @@ -63,13 +56,6 @@ When \fIaddr\fR starts with "unix:", the unprefixed value of it will be used as
(Option \fB\-l\fR has no effect if sd\-daemon(5) socket activation is being used\. See also \fIENVIRONMENT\fR\.)
.
.TP
\fB\-n\fR
Turn off binlog compaction, negating \fB\-c\fR\.
.
.IP
(Do not use this option\. Both \fB\-c\fR and \fB\-n\fR will likely be removed in a future \fBbeanstalkd\fR release\.)
.
.TP
\fB\-p\fR \fIport\fR
Listen on TCP port \fIport\fR (default is 11300)\.
.
Expand Down Expand Up @@ -99,6 +85,14 @@ Print the version string and exit\.
\fB\-z\fR \fIbytes\fR
The maximum size in bytes of a job\.
.
.TP
\fB\-c\fR
This flag has no effect\. It is kept for historical compatibility only\.
.
.TP
\fB\-n\fR
This flag has no effect\. It is kept for historical compatibility only\.
.
.SH "ENVIRONMENT"
.
.TP
Expand All @@ -115,4 +109,4 @@ Files \fBREADME\fR and \fBdoc/protocol\.txt\fR in the \fBbeanstalkd\fR distribut
\fIhttps://beanstalkd\.github\.io/\fR
.
.SH "AUTHOR"
\fBBeanstalkd\fR is written and maintained by Keith Rarick with the help of many others\.
\fBBeanstalkd\fR is written by Keith Rarick and maintained by the community at \fIhttps://github\.com/beanstalkd/beanstalkd/issues\fR
15 changes: 4 additions & 11 deletions doc/beanstalkd.1.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 8 additions & 15 deletions doc/beanstalkd.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ and format of the `beanstalkd` protocol.
in <path>, then, during normal operation, append new jobs and
changes in state to the binlog.

* `-c`:
Perform online, incremental compaction of binlog files. Negates
`-n`. This is the default behavior.

(Do not use this option, except to negate `-n`. Both `-c` and `-n`
will likely be removed in a future `beanstalkd` release.)

* `-f` <ms>:
Call fsync(2) at most once every <ms> milliseconds. Larger values
for <ms> reduce disk activity and improve speed at the cost of
Expand Down Expand Up @@ -66,12 +59,6 @@ and format of the `beanstalkd` protocol.
(Option `-l` has no effect if sd-daemon(5) socket activation is
being used. See also [ENVIRONMENT][].)

* `-n`:
Turn off binlog compaction, negating `-c`.

(Do not use this option. Both `-c` and `-n` will likely be removed
in a future `beanstalkd` release.)

* `-p` <port>:
Listen on TCP port <port> (default is 11300).

Expand All @@ -96,6 +83,12 @@ and format of the `beanstalkd` protocol.
* `-z` <bytes>:
The maximum size in bytes of a job.

* `-c`:
This flag has no effect. It is kept for historical compatibility only.

* `-n`:
This flag has no effect. It is kept for historical compatibility only.

## ENVIRONMENT

* `LISTEN_PID`, `LISTEN_FDS`:
Expand All @@ -113,5 +106,5 @@ distribution.

## AUTHOR

`Beanstalkd` is written and maintained by Keith Rarick with the help
of many others.
`Beanstalkd` is written by Keith Rarick and maintained by the community at
<https://github.com/beanstalkd/beanstalkd/issues>
32 changes: 3 additions & 29 deletions testutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ cttest_opt_none()
assert(srv.addr == NULL);
assert(job_data_size_limit == JOB_DATA_SIZE_LIMIT_DEFAULT);
assert(srv.wal.filesize == Filesizedef);
assert(srv.wal.nocomp == 0);
assert(srv.wal.wantsync == 0);
assert(srv.user == NULL);
assert(srv.wal.dir == NULL);
Expand Down Expand Up @@ -129,31 +128,6 @@ cttest_opts()
assert(srv.wal.filesize == 1234);
}

void
cttest_optc()
{
char *args[] = {
"-n",
"-c",
NULL,
};

optparse(&srv, args);
assert(srv.wal.nocomp == 0);
}

void
cttest_optn()
{
char *args[] = {
"-n",
NULL,
};

optparse(&srv, args);
assert(srv.wal.nocomp == 1);
}

void
cttest_optf()
{
Expand Down Expand Up @@ -243,15 +217,15 @@ cttest_optVVV()
}

void
cttest_optVnVu()
cttest_optVFVu()
{
char *args[] = {
"-VnVukr",
"-VFVukr",
NULL,
};

optparse(&srv, args);
assert(verbose == 2);
assert(srv.wal.nocomp == 1);
assert(srv.wal.wantsync == 0);
assert(strcmp(srv.user, "kr") == 0);
}
6 changes: 2 additions & 4 deletions util.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ usage(int code)
" -z BYTES set the maximum job size in bytes (default is %d, max allowed is %d)\n"
" -s BYTES set the size of each write-ahead log file (default is %d)\n"
" (will be rounded up to a multiple of 4096 bytes)\n"
" -c compact the binlog (default)\n"
" -n do not compact the binlog\n"
" -v show version information\n"
" -V increase verbosity\n"
" -h show this help\n",
Expand Down Expand Up @@ -176,10 +174,10 @@ optparse(Server *s, char **argv)
s->wal.filesize = parse_size_t(EARGF(flagusage("-s")));
break;
case 'c':
s->wal.nocomp = 0;
warnx("-c flag was removed. binlog is always compacted.");
break;
case 'n':
s->wal.nocomp = 1;
warnx("-n flag was removed. binlog is always compacted.");
break;
case 'f':
ms = (int64)parse_size_t(EARGF(flagusage("-f")));
Expand Down
4 changes: 1 addition & 3 deletions walg.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ void
walmaint(Wal *w)
{
if (w->use) {
if (!w->nocomp) {
walcompact(w);
}
walcompact(w);
walsync(w);
}
}
Expand Down

0 comments on commit fae6722

Please sign in to comment.