| 55 | } |
| 56 | |
| 57 | void Build(int n) { |
| 58 | std::string key_space, value_space; |
| 59 | WriteBatch batch; |
| 60 | for (int i = 0; i < n; i++) { |
| 61 | // if ((i % 100) == 0) fprintf(stderr, "@ %d of %d\n", i, n); |
| 62 | Slice key = Key(i, &key_space); |
| 63 | batch.Clear(); |
| 64 | batch.Put(key, Value(i, &value_space)); |
| 65 | WriteOptions options; |
| 66 | // Corrupt() doesn't work without this sync on windows; stat reports 0 for |
| 67 | // the file size. |
| 68 | if (i == n - 1) { |
| 69 | options.sync = true; |
| 70 | } |
| 71 | ASSERT_OK(db_->Write(options, &batch)); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | void Check(int min_expected, int max_expected) { |
| 76 | int next_expected = 0; |