Skip to content

Commit f1786f4

Browse files
sandraromanchenkosurbhat1595inelpandzicvorsel
authored
Release 0.5.0 (#100)
Co-authored-by: Surabhi Bhat <[email protected]> Co-authored-by: Inel Pandzic <[email protected]> Co-authored-by: Oleksandr Miroshnychenko <[email protected]>
1 parent face9c5 commit f1786f4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+496
-494
lines changed

.github/workflows/e2etests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ jobs:
4141
run: |
4242
make test-build
4343
44-
- name: Run Percona-MongoLink
44+
- name: Run PLM
4545
run: |
4646
echo "Starting project..."
47-
bin/pml_test \
47+
bin/plm_test \
4848
--source="mongodb://source:pass@rs00:30000" \
4949
--target="mongodb://target:pass@rs10:30100" \
5050
--reset-state --start --log-level debug &> server.log &
@@ -57,7 +57,7 @@ jobs:
5757
run: |
5858
export TEST_SOURCE_URI=mongodb://adm:pass@rs00:30000
5959
export TEST_TARGET_URI=mongodb://adm:pass@rs10:30100
60-
export TEST_MONGOLINK_URL=http://127.0.0.1:2242
60+
export TEST_PLM_URL=http://127.0.0.1:2242
6161
poetry run pytest
6262
6363
- name: Show server logs (on failure)

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ all: build
2020

2121
# Build production binary (optimized for runtime speed and size)
2222
build:
23-
go build $(BUILD_FLAGS) -o bin/pml .
23+
go build $(BUILD_FLAGS) -o bin/plm .
2424

2525
# Build test binary with race detection and debugging enabled
2626
test-build:
27-
go build $(TEST_BUILD_FLAGS) -o bin/pml_test .
27+
go build $(TEST_BUILD_FLAGS) -o bin/plm_test .
2828

2929
# Run tests with race detection
3030
test:

README.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Percona MongoLink
1+
# Percona Link for MongoDB
22

3-
Percona MongoLink is a tool for replicating data from a source MongoDB cluster to a target MongoDB cluster. It supports cloning data, replicating changes, and managing collections and indexes.
3+
Percona Link for MongoDB is a tool for replicating data from a source MongoDB cluster to a target MongoDB cluster. It supports cloning data, replicating changes, and managing collections and indexes.
44

55
## Features
66

@@ -24,8 +24,8 @@ Percona MongoLink is a tool for replicating data from a source MongoDB cluster t
2424
1. Clone the repository:
2525

2626
```sh
27-
git clone https://github.com/percona/percona-mongolink.git
28-
cd percona-mongolink
27+
git clone https://github.com/percona/percona-link-mongodb.git
28+
cd percona-link-mongodb
2929
```
3030

3131
2. Build the project using the Makefile:
@@ -34,30 +34,28 @@ Percona MongoLink is a tool for replicating data from a source MongoDB cluster t
3434
make build
3535
```
3636

37-
Alternatively, you can install MongoLink from the cloned repo using `go install`:
37+
Alternatively, you can install PLM from the cloned repo using `go install`:
3838

3939
```sh
4040
go install .
4141
```
4242

43-
> This will install `percona-mongolink` into your `GOBIN` directory. If `GOBIN` is included in your `PATH`, you can run MongoLink by typing `percona-mongolink` in your terminal.
43+
> This will install `plm` into your `GOBIN` directory. If `GOBIN` is included in your `PATH`, you can run Percona Link for MongoDB by typing `plm` in your terminal.
4444

4545
3. Run the server:
4646

4747
```sh
48-
bin/pml --source <source-mongodb-uri> --target <target-mongodb-uri>
48+
bin/plm --source <source-mongodb-uri> --target <target-mongodb-uri>
4949
```
5050

5151
Alternatively, you can use environment variables:
5252

5353
```sh
54-
export SOURCE_URI=<source-mongodb-uri>
55-
export TARGET_URI=<target-mongodb-uri>
56-
bin/pml --source $SOURCE_URI --target $TARGET_URI
54+
export PLM_SOURCE_URI=<source-mongodb-uri>
55+
export PLM_TARGET_URI=<target-mongodb-uri>
56+
bin/plm
5757
```
5858

59-
> Connections to the source and target must have `readPreference=primary` and `writeConcern=majority` explicitly or unset.
60-
6159
## Usage
6260

6361
### Starting the Replication
@@ -67,7 +65,7 @@ To start the replication process, you can either use the command-line interface
6765
#### Using Command-Line Interface
6866

6967
```sh
70-
bin/pml start
68+
bin/plm start
7169
```
7270

7371
#### Using HTTP API
@@ -86,7 +84,7 @@ To finalize the replication process, you can either use the command-line interfa
8684
#### Using Command-Line Interface
8785

8886
```sh
89-
bin/pml finalize
87+
bin/plm finalize
9088
```
9189

9290
#### Using HTTP API
@@ -102,7 +100,7 @@ To pause the replication process, you can either use the command-line interface
102100
#### Using Command-Line Interface
103101

104102
```sh
105-
bin/pml pause
103+
bin/plm pause
106104
```
107105

108106
#### Using HTTP API
@@ -118,7 +116,7 @@ To resume the replication process, you can either use the command-line interface
118116
#### Using Command-Line Interface
119117

120118
```sh
121-
bin/pml resume
119+
bin/plm resume
122120
```
123121

124122
#### Using HTTP API
@@ -134,7 +132,7 @@ To check the current status of the replication process, you can either use the c
134132
#### Using Command-Line Interface
135133

136134
```sh
137-
bin/pml status
135+
bin/plm status
138136
```
139137

140138
#### Using HTTP API
@@ -143,9 +141,9 @@ bin/pml status
143141
curl http://localhost:2242/status
144142
```
145143

146-
## MongoLink Options
144+
## PLM Options
147145

148-
When starting the MongoLink server, you can use the following options:
146+
When starting the PLM server, you can use the following options:
149147

150148
- `--port`: The port on which the server will listen (default: 2242)
151149
- `--source`: The MongoDB connection string for the source cluster
@@ -157,7 +155,7 @@ When starting the MongoLink server, you can use the following options:
157155
Example:
158156

159157
```sh
160-
bin/pml \
158+
bin/plm \
161159
--source <source-mongodb-uri> \
162160
--target <target-mongodb-uri> \
163161
--port 2242 \
@@ -188,7 +186,7 @@ Example:
188186
"message": "Cloned db_1.coll_1" }
189187
190188
{ "level": "info",
191-
"s": "mongolink",
189+
"s": "plm",
192190
"elapsed_secs": 0,
193191
"time": "2025-02-23 11:26:03.857",
194192
"message": "Change replication stopped at 1740335163.1740335163 source cluster time" }
@@ -261,7 +259,7 @@ Resumes the replication process.
261259
262260
#### Request Body
263261
264-
- `fromFailure` (optional): Allows PML to resume from failed state
262+
- `fromFailure` (optional): Allows PLM to resume from failed state
265263
266264
Example:
267265
@@ -284,7 +282,7 @@ Example:
284282
285283
### GET /status
286284
287-
The /status endpoint provides the current state of the MongoLink replication process, including its progress, lag, and event processing details.
285+
The /status endpoint provides the current state of the PLM replication process, including its progress, lag, and event processing details.
288286
289287
#### Response
290288
@@ -359,25 +357,25 @@ To run the tests, use the following command:
359357
poetry run pytest \
360358
--source-uri <source-mongodb-uri> \
361359
--target-uri <target-mongodb-uri> \
362-
--mongolink-url http://localhost:2242 \
363-
--mongolink-bin bin/pml_test
360+
--plm_url http://localhost:2242 \
361+
--plm-bin bin/plm_test
364362
```
365363
366364
Alternatively, you can use environment variables:
367365
368366
```sh
369367
export TEST_SOURCE_URI=<source-mongodb-uri>
370368
export TEST_TARGET_URI=<target-mongodb-uri>
371-
export TEST_MONGOLINK_URL=http://localhost:2242
372-
export TEST_MONGOLINK_BIN=bin/pml_test
369+
export TEST_PLM_URL=http://localhost:2242
370+
export TEST_PLM_BIN=bin/plm_test
373371
poetry run pytest
374372
```
375373
376-
> The `--mongolink-bin` flag or `TEST_MONGOLINK_BIN` environment variable specifies the path to the MongoLink binary. This allows the test suite to manage the MongoLink process, ensuring it starts and stops as needed during the tests. If neither the flag nor the environment variable is provided, you must run MongoLink externally before running the tests.
374+
> The `--plm-bin` flag or `TEST_PLM_BIN` environment variable specifies the path to the PLM binary. This allows the test suite to manage the PLM process, ensuring it starts and stops as needed during the tests. If neither the flag nor the environment variable is provided, you must run PLM externally before running the tests.
377375
378376
## Contributing
379377
380-
Contributions are welcome. Please open a [JIRA](https://perconadev.atlassian.net/jira/software/c/projects/PML/issues) issue describing the proposed change, then submit a pull request on GitHub.
378+
Contributions are welcome. Please open a [JIRA](https://perconadev.atlassian.net/jira/software/c/projects/PLM/issues) issue describing the proposed change, then submit a pull request on GitHub.
381379
382380
## License
383381

config/const.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const (
2020

2121
// MongoDB database and collection names.
2222
const (
23-
// MongoLinkDatabase is the name of the MongoDB database used by MongoLink.
24-
MongoLinkDatabase = "percona_mongolink"
23+
// PLMDatabase is the name of the MongoDB database used by PLM.
24+
PLMDatabase = "percona_link_mongodb"
2525
// RecoveryCollection is the name of the collection used for recovery data.
2626
RecoveryCollection = "checkpoints"
2727
// HeartbeatCollection is the name of the collection used for heartbeats.

config/values.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@ import (
1212

1313
// UseCollectionBulkWrite determines whether to use the Collection Bulk Write API
1414
// instead of the Client Bulk Write API (introduced in MongoDB v8.0).
15-
// Enabled when the PML_USE_COLLECTION_BULK_WRITE environment variable is set to "1".
15+
// Enabled when the PLM_USE_COLLECTION_BULK_WRITE environment variable is set to "1".
1616
func UseCollectionBulkWrite() bool {
17-
return os.Getenv("PML_USE_COLLECTION_BULK_WRITE") == "1"
17+
return os.Getenv("PLM_USE_COLLECTION_BULK_WRITE") == "1"
1818
}
1919

2020
// CloneNumParallelCollections returns the number of collections cloned in parallel
2121
// during the clone process. Default is 0.
2222
func CloneNumParallelCollections() int {
23-
numColl, _ := strconv.ParseInt(os.Getenv("PML_CLONE_NUM_PARALLEL_COLLECTIONS"), 10, 32)
23+
numColl, _ := strconv.ParseInt(os.Getenv("PLM_CLONE_NUM_PARALLEL_COLLECTIONS"), 10, 32)
2424

2525
return int(numColl)
2626
}
2727

2828
// CloneNumReadWorkers returns the number of read workers used during the clone. Default is 0.
2929
// Note: Workers are shared across all collections.
3030
func CloneNumReadWorkers() int {
31-
numReadWorker, _ := strconv.ParseInt(os.Getenv("PML_CLONE_NUM_READ_WORKERS"), 10, 32)
31+
numReadWorker, _ := strconv.ParseInt(os.Getenv("PLM_CLONE_NUM_READ_WORKERS"), 10, 32)
3232

3333
return int(numReadWorker)
3434
}
3535

3636
// CloneNumInsertWorkers returns the number of insert workers used during the clone. Default is 0.
3737
// Note: Workers are shared across all collections.
3838
func CloneNumInsertWorkers() int {
39-
numInsertWorker, _ := strconv.ParseInt(os.Getenv("PML_CLONE_NUM_INSERT_WORKERS"), 10, 32)
39+
numInsertWorker, _ := strconv.ParseInt(os.Getenv("PLM_CLONE_NUM_INSERT_WORKERS"), 10, 32)
4040

4141
return int(numInsertWorker)
4242
}
@@ -46,7 +46,7 @@ func CloneNumInsertWorkers() int {
4646
// operations by splitting the collection into multiple parallelizable units.
4747
// Zero or less enables auto size (per each collection). Default is [AutoCloneSegmentSize].
4848
func CloneSegmentSizeBytes() int64 {
49-
segmentSizeBytes, _ := humanize.ParseBytes(os.Getenv("PML_CLONE_SEGMENT_SIZE"))
49+
segmentSizeBytes, _ := humanize.ParseBytes(os.Getenv("PLM_CLONE_SEGMENT_SIZE"))
5050
if segmentSizeBytes == 0 {
5151
return AutoCloneSegmentSize
5252
}
@@ -56,16 +56,16 @@ func CloneSegmentSizeBytes() int64 {
5656

5757
// CloneReadBatchSizeBytes returns the read batch size in bytes used during the clone. Default is 0.
5858
func CloneReadBatchSizeBytes() int32 {
59-
batchSizeBytes, _ := humanize.ParseBytes(os.Getenv("PML_CLONE_READ_BATCH_SIZE"))
59+
batchSizeBytes, _ := humanize.ParseBytes(os.Getenv("PLM_CLONE_READ_BATCH_SIZE"))
6060

6161
return int32(min(batchSizeBytes, math.MaxInt32)) //nolint:gosec
6262
}
6363

6464
// UseTargetClientCompressors returns a list of enabled compressors (from "zstd", "zlib", "snappy")
6565
// for the target MongoDB client connection, as specified by the comma-separated environment
66-
// variable PML_DEV_TARGET_CLIENT_COMPRESSORS. If unset or empty, returns nil.
66+
// variable PLM_DEV_TARGET_CLIENT_COMPRESSORS. If unset or empty, returns nil.
6767
func UseTargetClientCompressors() []string {
68-
s := strings.TrimSpace(os.Getenv("PML_DEV_TARGET_CLIENT_COMPRESSORS"))
68+
s := strings.TrimSpace(os.Getenv("PLM_DEV_TARGET_CLIENT_COMPRESSORS"))
6969
if s == "" {
7070
return nil
7171
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/percona/percona-mongolink
1+
module github.com/percona/percona-link-mongodb
22

33
go 1.24
44

heartbeat.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ import (
88
"go.mongodb.org/mongo-driver/v2/mongo"
99
"go.mongodb.org/mongo-driver/v2/mongo/options"
1010

11-
"github.com/percona/percona-mongolink/config"
12-
"github.com/percona/percona-mongolink/errors"
13-
"github.com/percona/percona-mongolink/log"
11+
"github.com/percona/percona-link-mongodb/config"
12+
"github.com/percona/percona-link-mongodb/errors"
13+
"github.com/percona/percona-link-mongodb/log"
1414
)
1515

1616
var (
1717
errConcurrentProcess = errors.New("detected concurrent process")
1818
errStaleHeartbeat = errors.New("stale heartbeat")
1919
)
2020

21-
const heartbeatID = "mongolink"
21+
const heartbeatID = "plm"
2222

2323
type StopHeartbeat func(context.Context) error
2424

@@ -142,7 +142,7 @@ func doFirstHeartbeat(ctx context.Context, m *mongo.Client) (int64, error) {
142142

143143
currBeat := time.Now().Unix()
144144

145-
_, err := m.Database(config.MongoLinkDatabase).
145+
_, err := m.Database(config.PLMDatabase).
146146
Collection(config.HeartbeatCollection).
147147
InsertOne(timeoutCtx, bson.D{{"_id", heartbeatID}, {"time", currBeat}})
148148
if err == nil {
@@ -153,7 +153,7 @@ func doFirstHeartbeat(ctx context.Context, m *mongo.Client) (int64, error) {
153153
return 0, err //nolint:wrapcheck
154154
}
155155

156-
raw, err := m.Database(config.MongoLinkDatabase).
156+
raw, err := m.Database(config.PLMDatabase).
157157
Collection(config.HeartbeatCollection).
158158
FindOne(ctx, bson.D{{"_id", heartbeatID}}).
159159
Raw()
@@ -181,7 +181,7 @@ func doHeartbeat(ctx context.Context, m *mongo.Client, lastBeat int64) (int64, e
181181

182182
currBeat := time.Now().Unix()
183183

184-
raw, err := m.Database(config.MongoLinkDatabase).
184+
raw, err := m.Database(config.PLMDatabase).
185185
Collection(config.HeartbeatCollection).
186186
FindOneAndUpdate(timeoutCtx,
187187
bson.D{{"_id", heartbeatID}},
@@ -206,7 +206,7 @@ func doHeartbeat(ctx context.Context, m *mongo.Client, lastBeat int64) (int64, e
206206
}
207207

208208
func DeleteHeartbeat(ctx context.Context, m *mongo.Client) error {
209-
_, err := m.Database(config.MongoLinkDatabase).
209+
_, err := m.Database(config.PLMDatabase).
210210
Collection(config.HeartbeatCollection).
211211
DeleteOne(ctx, bson.D{{"_id", heartbeatID}})
212212

log/log.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Package log provides logging utilities for the MongoLink application.
1+
// Package log provides logging utilities for the PLM application.
22
package log
33

44
import (

0 commit comments

Comments
 (0)