You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/11/24 16:21:21 UTC

incubator-ponymail git commit: Oops, the mid is needed for the bulk insert

Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 9d674225f -> 185319149


Oops, the mid is needed for the bulk insert


Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/18531914
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/18531914
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/18531914

Branch: refs/heads/master
Commit: 185319149b4367faada1408e2779ed4106b8823a
Parents: 9d67422
Author: Sebb <se...@apache.org>
Authored: Thu Nov 24 16:21:03 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Thu Nov 24 16:21:03 2016 +0000

----------------------------------------------------------------------
 tools/import-mbox.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/18531914/tools/import-mbox.py
----------------------------------------------------------------------
diff --git a/tools/import-mbox.py b/tools/import-mbox.py
index acb89a9..3cfa251 100755
--- a/tools/import-mbox.py
+++ b/tools/import-mbox.py
@@ -123,12 +123,15 @@ class BulkThread(Thread):
         i = 0
         for entry in self.json:
             js = entry
+            mid = js['mid']
+            if self.dtype == 'mbox_source':
+                del js['mid']
             js_arr.append({
                 '_op_type': 'index',
                 '_consistency': self.wc,
                 '_index': dbname,
                 '_type': self.dtype,
-                '_id': js['mid'],
+                '_id': mid,
                 'doc': js,
                 '_source': js
             })
@@ -292,6 +295,7 @@ class SlurpThread(Thread):
                     try: # temporary hack to try and find an encoding issue
                         # needs to be replaced by proper exception handling
                         json_source = {
+                            'mid': json['mid'], # needed for bulk-insert only, not needed in database
                             'message-id': json['message-id'],
                             'source': message.as_string()
                         }