Skip to content

Commit cb9e6c1

Browse files
committed
Revert "Merge branch 'alpha' into pr/8332"
This reverts commit a576f72, reversing changes made to d156f29.
1 parent a576f72 commit cb9e6c1

Some content is hidden

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

50 files changed

+5401
-26194
lines changed

.eslintrc.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
"node": true,
66
"es6": true
77
},
8-
"parser": "@babel/eslint-parser",
8+
"parser": "babel-eslint",
99
"plugins": [
1010
"flowtype"
1111
],
1212
"parserOptions": {
1313
"ecmaVersion": 6,
14-
"sourceType": "module",
15-
"requireConfigFile": false
14+
"sourceType": "module"
1615
},
1716
"rules": {
1817
"indent": ["error", 2, { "SwitchCase": 1 }],

.github/workflows/ci.yml

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: ci
22
on:
33
push:
4-
branches: [ release*, alpha, beta ]
4+
branches: [ release, alpha, beta ]
55
pull_request:
6-
branches: [ release*, alpha, beta ]
6+
branches: [ release, alpha, beta ]
77
env:
8-
NODE_VERSION: 19.3.0
8+
NODE_VERSION: 18.12.1
99
PARSE_SERVER_TEST_TIMEOUT: 20000
1010
jobs:
1111
check-code-analysis:
@@ -137,32 +137,32 @@ jobs:
137137
- name: Check NPM lock file version
138138
uses: mansona/npm-lockfile-version@v1
139139
with:
140-
version: 2
140+
version: 1
141141
check-mongo:
142142
strategy:
143143
matrix:
144144
include:
145145
- name: MongoDB 4.2, ReplicaSet
146146
MONGODB_VERSION: 4.2.19
147147
MONGODB_TOPOLOGY: replicaset
148-
NODE_VERSION: 19.3.0
148+
NODE_VERSION: 18.12.1
149149
- name: MongoDB 4.4, ReplicaSet
150150
MONGODB_VERSION: 4.4.13
151151
MONGODB_TOPOLOGY: replicaset
152-
NODE_VERSION: 19.3.0
152+
NODE_VERSION: 18.12.1
153153
- name: MongoDB 5, ReplicaSet
154154
MONGODB_VERSION: 5.3.2
155155
MONGODB_TOPOLOGY: replicaset
156-
NODE_VERSION: 19.3.0
156+
NODE_VERSION: 18.12.1
157157
- name: MongoDB 6, ReplicaSet
158158
MONGODB_VERSION: 6.0.2
159159
MONGODB_TOPOLOGY: replicaset
160-
NODE_VERSION: 19.3.0
160+
NODE_VERSION: 18.12.1
161161
- name: Redis Cache
162162
PARSE_SERVER_TEST_CACHE: redis
163163
MONGODB_VERSION: 4.4.13
164164
MONGODB_TOPOLOGY: standalone
165-
NODE_VERSION: 19.3.0
165+
NODE_VERSION: 18.12.1
166166
- name: Node 14
167167
MONGODB_VERSION: 4.4.13
168168
MONGODB_TOPOLOGY: standalone
@@ -171,10 +171,6 @@ jobs:
171171
MONGODB_VERSION: 4.4.13
172172
MONGODB_TOPOLOGY: standalone
173173
NODE_VERSION: 16.18.1
174-
- name: Node 18
175-
MONGODB_VERSION: 4.4.13
176-
MONGODB_TOPOLOGY: standalone
177-
NODE_VERSION: 18.12.1
178174
fail-fast: false
179175
name: ${{ matrix.name }}
180176
timeout-minutes: 15
@@ -193,9 +189,6 @@ jobs:
193189
steps:
194190
- name: Fix usage of insecure GitHub protocol
195191
run: sudo git config --system url."https://github".insteadOf "git://github"
196-
- name: Fix git protocol for Node 14
197-
if: ${{ startsWith(matrix.NODE_VERSION, '14.') }}
198-
run: sudo git config --system url."https://github".insteadOf "ssh://git@github"
199192
- uses: actions/checkout@v2
200193
- name: Use Node.js ${{ matrix.NODE_VERSION }}
201194
uses: actions/setup-node@v2
@@ -221,28 +214,28 @@ jobs:
221214
include:
222215
- name: PostgreSQL 11, PostGIS 3.0
223216
POSTGRES_IMAGE: postgis/postgis:11-3.0
224-
NODE_VERSION: 19.3.0
217+
NODE_VERSION: 18.12.1
225218
- name: PostgreSQL 11, PostGIS 3.1
226219
POSTGRES_IMAGE: postgis/postgis:11-3.1
227-
NODE_VERSION: 19.3.0
220+
NODE_VERSION: 18.12.1
228221
- name: PostgreSQL 11, PostGIS 3.2
229222
POSTGRES_IMAGE: postgis/postgis:11-3.2
230-
NODE_VERSION: 19.3.0
223+
NODE_VERSION: 18.12.1
231224
- name: PostgreSQL 11, PostGIS 3.3
232225
POSTGRES_IMAGE: postgis/postgis:11-3.3
233-
NODE_VERSION: 19.3.0
226+
NODE_VERSION: 18.12.1
234227
- name: PostgreSQL 12, PostGIS 3.3
235228
POSTGRES_IMAGE: postgis/postgis:12-3.3
236-
NODE_VERSION: 19.3.0
229+
NODE_VERSION: 18.12.1
237230
- name: PostgreSQL 13, PostGIS 3.3
238231
POSTGRES_IMAGE: postgis/postgis:13-3.3
239-
NODE_VERSION: 19.3.0
232+
NODE_VERSION: 18.12.1
240233
- name: PostgreSQL 14, PostGIS 3.3
241234
POSTGRES_IMAGE: postgis/postgis:14-3.3
242-
NODE_VERSION: 19.3.0
235+
NODE_VERSION: 18.12.1
243236
- name: PostgreSQL 15, PostGIS 3.3
244237
POSTGRES_IMAGE: postgis/postgis:15-3.3
245-
NODE_VERSION: 19.3.0
238+
NODE_VERSION: 18.12.1
246239
fail-fast: false
247240
name: ${{ matrix.name }}
248241
timeout-minutes: 15

2.3.0.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Upgrading Parse Server to version 2.3.0
2+
3+
Parse Server version 2.3.0 begins using unique indexes to ensure the User's username and email are unique. This is not a backwards incompatible change, but it may in some cases cause a significant performance regression until the index finishes building. Building the unique index before upgrading your Parse Server version will eliminate the performance impact, and is a recommended step before upgrading any app to Parse Server 2.3.0. New apps starting with version 2.3.0 do not need to take any steps before beginning their project.
4+
5+
If you are using MongoDB in Cluster or Replica Set mode, we recommend reading Mongo's [documentation on index building](https://docs.mongodb.com/v3.0/tutorial/build-indexes-on-replica-sets/) first. If you are not using these features, you can execute the following commands from the Mongo shell to build the unique index. You may also want to create a backup first.
6+
7+
```js
8+
// Select the database that your Parse App uses
9+
use parse;
10+
11+
// Select the collection your Parse App uses for users. For migrated apps, this probably includes a collectionPrefix.
12+
var coll = db['your_prefix:_User'];
13+
14+
// You can check if the indexes already exists by running coll.getIndexes()
15+
coll.getIndexes();
16+
17+
// The indexes you want should look like this. If they already exist, you can skip creating them.
18+
{
19+
"v" : 1,
20+
"unique" : true,
21+
"key" : {
22+
"username" : 1
23+
},
24+
"name" : "username_1",
25+
"ns" : "parse.your_prefix:_User",
26+
"background" : true,
27+
"sparse" : true
28+
}
29+
30+
{
31+
"v" : 1,
32+
"unique" : true,
33+
"key" : {
34+
"email" : 1
35+
},
36+
"name" : "email_1",
37+
"ns" : "parse.your_prefix:_User",
38+
"background" : true,
39+
"sparse" : true
40+
}
41+
42+
// Create the username index.
43+
// "background: true" is mandatory and avoids downtime while the index builds.
44+
// "sparse: true" is also mandatory because Parse Server uses sparse indexes.
45+
coll.ensureIndex({ username: 1 }, { background: true, unique: true, sparse: true });
46+
47+
// Create the email index.
48+
// "background: true" is still mandatory.
49+
// "sparse: true" is also mandatory both because Parse Server uses sparse indexes, and because email addresses are not required by the Parse API.
50+
coll.ensureIndex({ email: 1 }, { background: true, unique: true, sparse: true });
51+
```
52+
53+
There are some issues you may run into during this process:
54+
55+
## Mongo complains that the index already exists, but with different options
56+
57+
In this case, you will need to remove the incorrect index. If your app relies on the existence of the index in order to be performant, you can create a new index, with "-1" for the direction of the field, so that it counts as different options. Then, drop the conflicting index, and create the unique index.
58+
59+
## There is already non-unique data in the username or email field
60+
61+
This is possible if you have explicitly set some user's emails to null. If this is bogus data, and those null fields should be unset, you can unset the null emails with this command. If your app relies on the difference between null and unset emails, you will need to upgrade your app to treat null and unset emails the same before building the index and upgrading to Parse Server 2.3.0.
62+
63+
```js
64+
coll.update({ email: { $exists: true, $eq: null } }, { $unset: { email: '' } }, { multi: true })
65+
```
66+
67+
## There is already non-unique data in the username or email field, and it's not nulls
68+
69+
This is possible due to a race condition in previous versions of Parse Server. If you have this problem, it is unlikely that you have a lot of rows with duplicate data. We recommend you clean up the data manually, by removing or modifying the offending rows.
70+
71+
This command, can be used to find the duplicate data:
72+
73+
```js
74+
coll.aggregate([
75+
{$match: {"username": {"$ne": null}}},
76+
{$group: {_id: "$username", uniqueIds: {$addToSet: "$_id"}, count: {$sum: 1}}},
77+
{$match: {count: {"$gt": 1}}},
78+
{$project: {id: "$uniqueIds", username: "$_id", _id : 0} },
79+
{$unwind: "$id" },
80+
{$out: '_duplicates'} // Save the list of duplicates to a new, "_duplicates" collection. Remove this line to just output the list.
81+
], {allowDiskUse:true})
82+
```

0 commit comments

Comments
 (0)