summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-05-29 17:13:52 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2015-05-31 20:42:22 -0400
commitd412a6c1551a9c9e3b54a14455093cb72653b9a3 (patch)
tree41df1a18040949a7391023c826314ebb44f60a4a /src
parent8960f89c00dd0a1a49d5238ab658ed4f54300aa5 (diff)
downloadmongo-d412a6c1551a9c9e3b54a14455093cb72653b9a3.tar.gz
SERVER-18748 Move cursor response management under query
This change moves the cursor response generation logic to be under the query library. Also it removes the dependency and calls to replication coordinator.
Diffstat (limited to 'src')
-rw-r--r--src/mongo/client/SConscript2
-rw-r--r--src/mongo/client/remote_command_runner_impl.cpp2
-rw-r--r--src/mongo/db/SConscript1
-rw-r--r--src/mongo/db/commands/find_cmd.cpp2
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp2
-rw-r--r--src/mongo/db/commands/list_collections.cpp4
-rw-r--r--src/mongo/db/commands/list_indexes.cpp3
-rw-r--r--src/mongo/db/commands/parallel_collection_scan.cpp5
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp2
-rw-r--r--src/mongo/db/commands/repair_cursor.cpp4
-rw-r--r--src/mongo/db/query/SConscript9
-rw-r--r--src/mongo/db/query/cursor_responses.cpp (renamed from src/mongo/db/commands/cursor_responses.cpp)9
-rw-r--r--src/mongo/db/query/cursor_responses.h (renamed from src/mongo/db/commands/cursor_responses.h)0
-rw-r--r--src/mongo/s/commands/cluster_commands_common.cpp11
14 files changed, 28 insertions, 28 deletions
diff --git a/src/mongo/client/SConscript b/src/mongo/client/SConscript
index 94345dc9113..8e6f8ae84bd 100644
--- a/src/mongo/client/SConscript
+++ b/src/mongo/client/SConscript
@@ -109,7 +109,7 @@ env.Library(
LIBDEPS=[
'connection_pool',
'remote_command_runner',
- '$BUILD_DIR/mongo/db/query/getmore_request',
+ '$BUILD_DIR/mongo/db/query/getmore_request_response',
'$BUILD_DIR/mongo/db/query/lite_parsed_query',
]
)
diff --git a/src/mongo/client/remote_command_runner_impl.cpp b/src/mongo/client/remote_command_runner_impl.cpp
index 2a799eb3d7d..7da4364bcf1 100644
--- a/src/mongo/client/remote_command_runner_impl.cpp
+++ b/src/mongo/client/remote_command_runner_impl.cpp
@@ -31,8 +31,8 @@
#include "mongo/client/remote_command_runner_impl.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/cursor_responses.h"
#include "mongo/db/namespace_string.h"
+#include "mongo/db/query/cursor_responses.h"
#include "mongo/db/query/getmore_request.h"
#include "mongo/rpc/get_status_from_command_result.h"
#include "mongo/base/status_with.h"
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index da65f0978c2..f97420e5f44 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -520,7 +520,6 @@ serverOnlyFiles = [
"commands/count.cpp",
"commands/create_indexes.cpp",
"commands/current_op.cpp",
- "commands/cursor_responses.cpp",
"commands/dbhash.cpp",
"commands/distinct.cpp",
"commands/drop_indexes.cpp",
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index f40c7f5d915..371df966580 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -39,10 +39,10 @@
#include "mongo/db/client.h"
#include "mongo/db/clientcursor.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/cursor_responses.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/service_context.h"
+#include "mongo/db/query/cursor_responses.h"
#include "mongo/db/query/explain.h"
#include "mongo/db/query/find.h"
#include "mongo/db/query/get_executor.h"
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index 91dcffe3a4f..2fad5d8917b 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -39,12 +39,12 @@
#include "mongo/db/catalog/cursor_manager.h"
#include "mongo/db/clientcursor.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/cursor_responses.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/global_timestamp.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/service_context.h"
+#include "mongo/db/query/cursor_responses.h"
#include "mongo/db/query/find.h"
#include "mongo/db/query/getmore_request.h"
#include "mongo/db/stats/counters.h"
diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp
index b2a551610ac..7773b0f0eed 100644
--- a/src/mongo/db/commands/list_collections.cpp
+++ b/src/mongo/db/commands/list_collections.cpp
@@ -37,14 +37,12 @@
#include "mongo/db/catalog/cursor_manager.h"
#include "mongo/db/catalog/database.h"
#include "mongo/db/catalog/database_catalog_entry.h"
-#include "mongo/db/catalog/database_holder.h"
-#include "mongo/db/client.h"
#include "mongo/db/clientcursor.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/cursor_responses.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/queued_data_stage.h"
#include "mongo/db/exec/working_set.h"
+#include "mongo/db/query/cursor_responses.h"
#include "mongo/db/query/find_constants.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/storage_engine.h"
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index afd64b0a2a6..d84e605c21f 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -34,15 +34,14 @@
#include "mongo/db/catalog/collection_catalog_entry.h"
#include "mongo/db/catalog/cursor_manager.h"
#include "mongo/db/catalog/database.h"
-#include "mongo/db/client.h"
#include "mongo/db/clientcursor.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/cursor_responses.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/queued_data_stage.h"
#include "mongo/db/exec/working_set.h"
+#include "mongo/db/query/cursor_responses.h"
#include "mongo/db/query/find_constants.h"
#include "mongo/db/service_context.h"
#include "mongo/db/storage/storage_engine.h"
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp
index 68b0ecf987a..618e3306015 100644
--- a/src/mongo/db/commands/parallel_collection_scan.cpp
+++ b/src/mongo/db/commands/parallel_collection_scan.cpp
@@ -28,14 +28,15 @@
* it in the license file.
*/
+#include "mongo/platform/basic.h"
+
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/database.h"
-#include "mongo/db/client.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/cursor_responses.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/multi_iterator.h"
+#include "mongo/db/query/cursor_responses.h"
#include "mongo/util/touch_pages.h"
namespace mongo {
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index 813775afff8..792442914ed 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -38,7 +38,6 @@
#include "mongo/db/catalog/database.h"
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/cursor_responses.h"
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/pipeline_proxy.h"
@@ -50,6 +49,7 @@
#include "mongo/db/pipeline/expression_context.h"
#include "mongo/db/pipeline/pipeline.h"
#include "mongo/db/pipeline/pipeline_d.h"
+#include "mongo/db/query/cursor_responses.h"
#include "mongo/db/query/find_constants.h"
#include "mongo/db/query/get_executor.h"
#include "mongo/db/storage_options.h"
diff --git a/src/mongo/db/commands/repair_cursor.cpp b/src/mongo/db/commands/repair_cursor.cpp
index 81d16f9349b..966b196d64e 100644
--- a/src/mongo/db/commands/repair_cursor.cpp
+++ b/src/mongo/db/commands/repair_cursor.cpp
@@ -28,15 +28,17 @@
* it in the license file.
*/
+#include "mongo/platform/basic.h"
+
#include <memory>
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
-#include "mongo/db/commands/cursor_responses.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/multi_iterator.h"
+#include "mongo/db/query/cursor_responses.h"
namespace mongo {
diff --git a/src/mongo/db/query/SConscript b/src/mongo/db/query/SConscript
index 76fafe780b3..3b04914089e 100644
--- a/src/mongo/db/query/SConscript
+++ b/src/mongo/db/query/SConscript
@@ -99,12 +99,13 @@ env.Library(
)
env.Library(
- target="getmore_request",
+ target='getmore_request_response',
source=[
- "getmore_request.cpp"
+ 'cursor_responses.cpp',
+ 'getmore_request.cpp',
],
LIBDEPS=[
- "$BUILD_DIR/mongo/bson/bson",
+ '$BUILD_DIR/mongo/bson/bson',
],
)
@@ -114,7 +115,7 @@ env.CppUnitTest(
"getmore_request_test.cpp"
],
LIBDEPS=[
- "getmore_request",
+ "getmore_request_response",
],
)
diff --git a/src/mongo/db/commands/cursor_responses.cpp b/src/mongo/db/query/cursor_responses.cpp
index 3520f5e8164..1bd6be298e2 100644
--- a/src/mongo/db/commands/cursor_responses.cpp
+++ b/src/mongo/db/query/cursor_responses.cpp
@@ -26,10 +26,11 @@
* it in the license file.
*/
-#include "mongo/db/commands/cursor_responses.h"
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/query/cursor_responses.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/repl/replication_coordinator_global.h"
namespace mongo {
@@ -42,8 +43,6 @@ namespace mongo {
cursorObj.append("ns", cursorNamespace);
cursorObj.append("firstBatch", firstBatch);
cursorObj.done();
- // TODO(dannenberg): only append the replication info if it was requested
- repl::getGlobalReplicationCoordinator()->prepareCursorResponseInfo(builder);
}
void appendGetMoreResponseObject(long long cursorId,
@@ -55,8 +54,6 @@ namespace mongo {
cursorObj.append("ns", cursorNamespace);
cursorObj.append("nextBatch", nextBatch);
cursorObj.done();
- // TODO(dannenberg): only append the replication info if it was requested
- repl::getGlobalReplicationCoordinator()->prepareCursorResponseInfo(builder);
}
} // namespace mongo
diff --git a/src/mongo/db/commands/cursor_responses.h b/src/mongo/db/query/cursor_responses.h
index 2c9fed3b610..2c9fed3b610 100644
--- a/src/mongo/db/commands/cursor_responses.h
+++ b/src/mongo/db/query/cursor_responses.h
diff --git a/src/mongo/s/commands/cluster_commands_common.cpp b/src/mongo/s/commands/cluster_commands_common.cpp
index 04ee9173bf9..52afad182f5 100644
--- a/src/mongo/s/commands/cluster_commands_common.cpp
+++ b/src/mongo/s/commands/cluster_commands_common.cpp
@@ -31,6 +31,7 @@
#include "mongo/s/commands/cluster_commands_common.h"
#include "mongo/db/commands.h"
+#include "mongo/db/query/cursor_responses.h"
#include "mongo/s/cursors.h"
namespace mongo {
@@ -68,10 +69,12 @@ namespace mongo {
invariant(!status.isOK());
if (status == ErrorCodes::DatabaseNotFound) {
- result << "result" << BSONArray()
- << "cursor" << BSON("id" << 0LL <<
- "ns" << ns <<
- "firstBatch" << BSONArray());
+ // Old style reply
+ result << "result" << BSONArray();
+
+ // New (command) style reply
+ appendCursorResponseObject(0LL, ns, BSONArray(), &result);
+
return true;
}