Changeset 2bdd297562b53dbee111cfefd2101bb9eb99d036
- Timestamp:
- 06/24/08 17:25:13
(5 years ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1214328313 +0000
- git-parent:
[42acb3f97cfb6da615fe7d1186a1e052eeec72fd]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1214328313 +0000
- Message:
fixes #35
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1f7257a |
r2bdd297 |
|
| 14 | 14 | #include <unistd.h> |
|---|
| 15 | 15 | #include <sys/ioctl.h> |
|---|
| | 16 | #define MAX_ROWS_AT_ONCE 1000 |
|---|
| | 17 | #define DEFAULT_SECONDS_BETWEEN_BATCHES 5 |
|---|
| 16 | 18 | |
|---|
| 17 | 19 | void |
|---|
| … | … | |
| 89 | 91 | while(1) { |
|---|
| 90 | 92 | jlog_id client_chkpt; |
|---|
| | 93 | int sleeptime = DEFAULT_SECONDS_BETWEEN_BATCHES; |
|---|
| 91 | 94 | jlog_get_checkpoint(jcl->jlog, ac->remote_cn, &jcl->chkpt); |
|---|
| 92 | 95 | jcl->count = jlog_ctx_read_interval(jcl->jlog, &jcl->start, &jcl->finish); |
|---|
| | 96 | if(jcl->count > MAX_ROWS_AT_ONCE) { |
|---|
| | 97 | /* Artificially set down the range to make the batches a bit easier |
|---|
| | 98 | * to handle on the stratcond/postgres end. |
|---|
| | 99 | * However, we must have more data, so drop the sleeptime to 0 |
|---|
| | 100 | */ |
|---|
| | 101 | jcl->count = MAX_ROWS_AT_ONCE; |
|---|
| | 102 | jcl->finish.marker = jcl->start.marker + jcl->count; |
|---|
| | 103 | sleeptime = 0; |
|---|
| | 104 | } |
|---|
| 93 | 105 | if(jcl->count > 0) { |
|---|
| 94 | 106 | if(noit_jlog_push(e, jcl)) { |
|---|
| … | … | |
| 119 | 131 | jlog_ctx_read_checkpoint(jcl->jlog, &jcl->chkpt); |
|---|
| 120 | 132 | } |
|---|
| 121 | | sleep(5); |
|---|
| | 133 | if(sleeptime) sleep(sleeptime); |
|---|
| 122 | 134 | } |
|---|
| 123 | 135 | |
|---|
| rcdec30d |
r2bdd297 |
|
| 162 | 162 | raddr, sizeof(raddr)); |
|---|
| 163 | 163 | break; |
|---|
| | 164 | default: |
|---|
| | 165 | noitL(noit_error, "remote address of family %d\n", r->sa_family); |
|---|
| 164 | 166 | } |
|---|
| 165 | 167 | |
|---|