Skip to content

Commit deb2032

Browse files
authored
PCSM-209: Rename PLM to PCSM (#140)
1 parent 40585cf commit deb2032

39 files changed

+394
-394
lines changed

.github/workflows/e2etests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
run: |
4949
export TEST_SOURCE_URI=mongodb://adm:pass@rs00:30000
5050
export TEST_TARGET_URI=mongodb://adm:pass@rs10:30100
51-
export TEST_PLM_URL=http://127.0.0.1:2242
52-
export TEST_PLM_BIN=./bin/plm_test
51+
export TEST_PCSM_URL=http://127.0.0.1:2242
52+
export TEST_PCSM_BIN=./bin/pcsm_test
5353
5454
poetry run pytest tests/test_collections.py tests/test_documents.py tests/test_indexes.py tests/test_selective.py tests/test_transactions.py
5555
@@ -98,8 +98,8 @@ jobs:
9898
run: |
9999
export TEST_SOURCE_URI=mongodb://adm:pass@src-mongos:27017
100100
export TEST_TARGET_URI=mongodb://adm:pass@tgt-mongos:29017
101-
export TEST_PLM_URL=http://127.0.0.1:2242
102-
export TEST_PLM_BIN=./bin/plm_test
101+
export TEST_PCSM_URL=http://127.0.0.1:2242
102+
export TEST_PCSM_BIN=./bin/pcsm_test
103103
104104
poetry run pytest
105105

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/plm .
23+
go build $(BUILD_FLAGS) -o bin/pcsm .
2424

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

2929
# Run tests with race detection
3030
test:

README.md

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

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.
3+
Percona ClusterSync 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 Link for MongoDB is a tool for replicating data from a source MongoDB cl
2424
1. Clone the repository:
2525

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

3131
2. Build the project using the Makefile:
@@ -34,26 +34,26 @@ Percona Link for MongoDB is a tool for replicating data from a source MongoDB cl
3434
make build
3535
```
3636

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

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

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.
43+
> This will install `pcsm` into your `GOBIN` directory. If `GOBIN` is included in your `PATH`, you can run Percona ClusterSync for MongoDB by typing `pcsm` in your terminal.
4444

4545
3. Run the server:
4646

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

5151
Alternatively, you can use environment variables:
5252

5353
```sh
54-
export PLM_SOURCE_URI=<source-mongodb-uri>
55-
export PLM_TARGET_URI=<target-mongodb-uri>
56-
bin/plm
54+
export PCSM_SOURCE_URI=<source-mongodb-uri>
55+
export PCSM_TARGET_URI=<target-mongodb-uri>
56+
bin/pcsm
5757
```
5858

5959
## Usage
@@ -65,7 +65,7 @@ To start the replication process, you can either use the command-line interface
6565
#### Using Command-Line Interface
6666

6767
```sh
68-
bin/plm start
68+
bin/pcsm start
6969
```
7070

7171
#### Using HTTP API
@@ -84,7 +84,7 @@ To finalize the replication process, you can either use the command-line interfa
8484
#### Using Command-Line Interface
8585

8686
```sh
87-
bin/plm finalize
87+
bin/pcsm finalize
8888
```
8989

9090
#### Using HTTP API
@@ -100,7 +100,7 @@ To pause the replication process, you can either use the command-line interface
100100
#### Using Command-Line Interface
101101

102102
```sh
103-
bin/plm pause
103+
bin/pcsm pause
104104
```
105105

106106
#### Using HTTP API
@@ -116,7 +116,7 @@ To resume the replication process, you can either use the command-line interface
116116
#### Using Command-Line Interface
117117

118118
```sh
119-
bin/plm resume
119+
bin/pcsm resume
120120
```
121121

122122
#### Using HTTP API
@@ -132,7 +132,7 @@ To check the current status of the replication process, you can either use the c
132132
#### Using Command-Line Interface
133133

134134
```sh
135-
bin/plm status
135+
bin/pcsm status
136136
```
137137

138138
#### Using HTTP API
@@ -141,9 +141,9 @@ bin/plm status
141141
curl http://localhost:2242/status
142142
```
143143

144-
## PLM Options
144+
## PCSM Options
145145

146-
When starting the PLM server, you can use the following options:
146+
When starting the PCSM server, you can use the following options:
147147

148148
- `--port`: The port on which the server will listen (default: 2242)
149149
- `--source`: The MongoDB connection string for the source cluster
@@ -155,7 +155,7 @@ When starting the PLM server, you can use the following options:
155155
Example:
156156

157157
```sh
158-
bin/plm \
158+
bin/pcsm \
159159
--source <source-mongodb-uri> \
160160
--target <target-mongodb-uri> \
161161
--port 2242 \
@@ -165,9 +165,9 @@ bin/plm \
165165

166166
## Environment Variables
167167

168-
- `PLM_SOURCE_URI`: MongoDB connection string for the source cluster.
169-
- `PLM_TARGET_URI`: MongoDB connection string for the target cluster.
170-
- `PLM_MONGODB_CLI_OPERATION_TIMEOUT`: Timeout for MongoDB client operations; accepts Go durations like `30s`, `2m`, `1h` (default: `5m`).
168+
- `PCSM_SOURCE_URI`: MongoDB connection string for the source cluster.
169+
- `PCSM_TARGET_URI`: MongoDB connection string for the target cluster.
170+
- `PCSM_MONGODB_CLI_OPERATION_TIMEOUT`: Timeout for MongoDB client operations; accepts Go durations like `30s`, `2m`, `1h` (default: `5m`).
171171

172172
## Log JSON Fields
173173

@@ -192,7 +192,7 @@ Example:
192192
"message": "Cloned db_1.coll_1" }
193193
194194
{ "level": "info",
195-
"s": "plm",
195+
"s": "pcsm",
196196
"elapsed_secs": 0,
197197
"time": "2025-02-23 11:26:03.857",
198198
"message": "Change replication stopped at 1740335163.1740335163 source cluster time" }
@@ -265,7 +265,7 @@ Resumes the replication process.
265265
266266
#### Request Body
267267
268-
- `fromFailure` (optional): Allows PLM to resume from failed state
268+
- `fromFailure` (optional): Allows PCSM to resume from failed state
269269
270270
Example:
271271
@@ -288,7 +288,7 @@ Example:
288288
289289
### GET /status
290290
291-
The /status endpoint provides the current state of the PLM replication process, including its progress, lag, and event processing details.
291+
The /status endpoint provides the current state of the PCSM replication process, including its progress, lag, and event processing details.
292292
293293
#### Response
294294
@@ -363,25 +363,25 @@ To run the tests, use the following command:
363363
poetry run pytest \
364364
--source-uri <source-mongodb-uri> \
365365
--target-uri <target-mongodb-uri> \
366-
--plm_url http://localhost:2242 \
367-
--plm-bin bin/plm_test
366+
--pcsm_url http://localhost:2242 \
367+
--pcsm-bin bin/pcsm_test
368368
```
369369
370370
Alternatively, you can use environment variables:
371371
372372
```sh
373373
export TEST_SOURCE_URI=<source-mongodb-uri>
374374
export TEST_TARGET_URI=<target-mongodb-uri>
375-
export TEST_PLM_URL=http://localhost:2242
376-
export TEST_PLM_BIN=bin/plm_test
375+
export TEST_PCSM_URL=http://localhost:2242
376+
export TEST_PCSM_BIN=bin/pcsm_test
377377
poetry run pytest
378378
```
379379
380-
> 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.
380+
> The `--pcsm-bin` flag or `TEST_PCSM_BIN` environment variable specifies the path to the PCSM binary. This allows the test suite to manage the PCSM process, ensuring it starts and stops as needed during the tests. If neither the flag nor the environment variable is provided, you must run PCSM externally before running the tests.
381381
382382
## Contributing
383383
384-
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.
384+
Contributions are welcome. Please open a [JIRA](https://perconadev.atlassian.net/jira/software/c/projects/PCSM/issues) issue describing the proposed change, then submit a pull request on GitHub.
385385
386386
## License
387387

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-
// PLMDatabase is the name of the MongoDB database used by PLM.
24-
PLMDatabase = "percona_link_mongodb"
23+
// PCSMDatabase is the name of the MongoDB database used by PCSM.
24+
PCSMDatabase = "percona_clustersync_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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@ import (
1313

1414
// UseCollectionBulkWrite determines whether to use the Collection Bulk Write API
1515
// instead of the Client Bulk Write API (introduced in MongoDB v8.0).
16-
// Enabled when the PLM_USE_COLLECTION_BULK_WRITE environment variable is set to "1".
16+
// Enabled when the PCSM_USE_COLLECTION_BULK_WRITE environment variable is set to "1".
1717
func UseCollectionBulkWrite() bool {
18-
return os.Getenv("PLM_USE_COLLECTION_BULK_WRITE") == "1"
18+
return os.Getenv("PCSM_USE_COLLECTION_BULK_WRITE") == "1"
1919
}
2020

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

2626
return int(numColl)
2727
}
2828

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

3434
return int(numReadWorker)
3535
}
3636

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

4242
return int(numInsertWorker)
4343
}
@@ -47,7 +47,7 @@ func CloneNumInsertWorkers() int {
4747
// operations by splitting the collection into multiple parallelizable units.
4848
// Zero or less enables auto size (per each collection). Default is [AutoCloneSegmentSize].
4949
func CloneSegmentSizeBytes() int64 {
50-
segmentSizeBytes, _ := humanize.ParseBytes(os.Getenv("PLM_CLONE_SEGMENT_SIZE"))
50+
segmentSizeBytes, _ := humanize.ParseBytes(os.Getenv("PCSM_CLONE_SEGMENT_SIZE"))
5151
if segmentSizeBytes == 0 {
5252
return AutoCloneSegmentSize
5353
}
@@ -57,16 +57,16 @@ func CloneSegmentSizeBytes() int64 {
5757

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

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

6565
// UseTargetClientCompressors returns a list of enabled compressors (from "zstd", "zlib", "snappy")
6666
// for the target MongoDB client connection, as specified by the comma-separated environment
67-
// variable PLM_DEV_TARGET_CLIENT_COMPRESSORS. If unset or empty, returns nil.
67+
// variable PCSM_DEV_TARGET_CLIENT_COMPRESSORS. If unset or empty, returns nil.
6868
func UseTargetClientCompressors() []string {
69-
s := strings.TrimSpace(os.Getenv("PLM_DEV_TARGET_CLIENT_COMPRESSORS"))
69+
s := strings.TrimSpace(os.Getenv("PCSM_DEV_TARGET_CLIENT_COMPRESSORS"))
7070
if s == "" {
7171
return nil
7272
}
@@ -85,11 +85,11 @@ func UseTargetClientCompressors() []string {
8585
}
8686

8787
// OperationMongoDBCliTimeout returns the effective timeout for MongoDB client operations.
88-
// If the environment variable `PLM_MONGODB_CLI_OPERATION_TIMEOUT` is set, it must be a valid
88+
// If the environment variable `PCSM_MONGODB_CLI_OPERATION_TIMEOUT` is set, it must be a valid
8989
// time duration string (e.g., "30s", "2m", "1h"). Otherwise, the
9090
// DefaultMongoDBCliOperationTimeout is used.
9191
func OperationMongoDBCliTimeout() time.Duration {
92-
if v := strings.TrimSpace(os.Getenv("PLM_MONGODB_CLI_OPERATION_TIMEOUT")); v != "" {
92+
if v := strings.TrimSpace(os.Getenv("PCSM_MONGODB_CLI_OPERATION_TIMEOUT")); v != "" {
9393
if d, err := time.ParseDuration(v); err == nil && d > 0 {
9494
return d
9595
}

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-link-mongodb
1+
module github.com/percona/percona-clustersync-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-link-mongodb/config"
12-
"github.com/percona/percona-link-mongodb/errors"
13-
"github.com/percona/percona-link-mongodb/log"
11+
"github.com/percona/percona-clustersync-mongodb/config"
12+
"github.com/percona/percona-clustersync-mongodb/errors"
13+
"github.com/percona/percona-clustersync-mongodb/log"
1414
)
1515

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

21-
const heartbeatID = "plm"
21+
const heartbeatID = "pcsm"
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.PLMDatabase).
145+
_, err := m.Database(config.PCSMDatabase).
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.PLMDatabase).
156+
raw, err := m.Database(config.PCSMDatabase).
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.PLMDatabase).
184+
raw, err := m.Database(config.PCSMDatabase).
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.PLMDatabase).
209+
_, err := m.Database(config.PCSMDatabase).
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 PLM application.
1+
// Package log provides logging utilities for the PCSM application.
22
package log
33

44
import (

0 commit comments

Comments
 (0)