Skip to content
This repository was archived by the owner on Jan 29, 2022. It is now read-only.

Commit 5b25297

Browse files
author
Luke Lovett
committed
Run the 'splitVector' command on the same database from which we want the splits (HADOOP-238).
1 parent 2214f05 commit 5b25297

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

core/src/main/java/com/mongodb/hadoop/splitter/StandaloneMongoSplitter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public List<InputSplit> calculateSplits() throws SplitFailedException {
104104
boolean ok = true;
105105
try {
106106
data = inputCollection.getDB()
107-
.getSisterDB("admin")
107+
.getSisterDB(inputURI.getDatabase())
108108
.command(cmd, ReadPreference.primary());
109109
} catch (final MongoException e) { // 2.0 servers throw exceptions rather than info in a CommandResult
110110
data = null;
@@ -146,7 +146,8 @@ public List<InputSplit> calculateSplits() throws SplitFailedException {
146146
MongoClient shardClient = null;
147147
try {
148148
shardClient = new MongoClient(shardHost);
149-
data = shardClient.getDB("admin")
149+
data = shardClient
150+
.getDB(shardHost.getDatabase())
150151
.command(cmd, ReadPreference.primary());
151152
} catch (final Exception e) {
152153
LOG.error(e.getMessage(), e);

0 commit comments

Comments
 (0)