what's extsort.* (8 - 11 MB) in MongoDB dbpath? Directory _tmp
-
03-10-2020 - |
题
I never saw this in my dbpath
and didn't found any explanation with a search engine.
We run MongoDB 3.2.8
# ls -alh; pwd
total 151M
drwxr-xr-x. 2 mongod mongod 4.0K Sep 12 22:18 .
drwxr-xr-x. 6 mongod mongod 12K Sep 12 22:16 ..
-rw-r--r--. 1 mongod mongod 8.0M Sep 12 21:54 extsort.0
-rw-r--r--. 1 mongod mongod 10M Sep 12 21:54 extsort.1
-rw-r--r--. 1 mongod mongod 7.9M Sep 12 22:02 extsort.10
-rw-r--r--. 1 mongod mongod 7.9M Sep 12 22:07 extsort.11
-rw-r--r--. 1 mongod mongod 9.9M Sep 12 22:07 extsort.12
-rw-r--r--. 1 mongod mongod 7.9M Sep 12 22:11 extsort.13
-rw-r--r--. 1 mongod mongod 9.9M Sep 12 22:12 extsort.14
-rw-r--r--. 1 mongod mongod 8.0M Sep 12 22:16 extsort.15
-rw-r--r--. 1 mongod mongod 11M Sep 12 22:18 extsort.16
-rw-r--r--. 1 mongod mongod 7.9M Sep 12 21:55 extsort.2
-rw-r--r--. 1 mongod mongod 9.9M Sep 12 21:55 extsort.3
-rw-r--r--. 1 mongod mongod 7.9M Sep 12 21:55 extsort.4
-rw-r--r--. 1 mongod mongod 9.8M Sep 12 21:55 extsort.5
-rw-r--r--. 1 mongod mongod 7.9M Sep 12 21:56 extsort.6
-rw-r--r--. 1 mongod mongod 11M Sep 12 21:57 extsort.7
-rw-r--r--. 1 mongod mongod 8.0M Sep 12 21:58 extsort.8
-rw-r--r--. 1 mongod mongod 9.9M Sep 12 22:01 extsort.9
/data/name-replicaset/name-replicaset_0/_tmp
解决方案
These files are used when the sort you are attempting in an aggregation exceeds the maximum allowed memory and you have allowDiskUse : true
specified.
The relevant pieces of the code are here (where the SortedFileWriter
is called) and here (where the extsorter.#
files are written to temp by SortedFileWriter
). Basically, this is the number of files required by MongoDB to perform the sorting that is being specified in your aggregations.
不隶属于 dba.stackexchange