[ARVADOS] updated: cac35f0e43192a790eee669f83c26c7d47ccbed4

git at public.curoverse.com git at public.curoverse.com
Tue Jan 6 11:11:35 EST 2015


Summary of changes:
 services/api/app/models/collection.rb                  |  2 +-
 .../db/migrate/20141208174653_collection_file_names.rb |  4 ++--
 services/api/db/structure.sql                          |  2 +-
 services/api/test/unit/collection_test.rb              | 18 ++++++++++++++++++
 4 files changed, 22 insertions(+), 4 deletions(-)

       via  cac35f0e43192a790eee669f83c26c7d47ccbed4 (commit)
      from  40bbccf9acf872cd610adeb317f06f5ba57504a0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit cac35f0e43192a790eee669f83c26c7d47ccbed4
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Tue Jan 6 10:48:26 2015 -0500

    4523: Add test to create collection with large manifest text. This test showed that the max size
    the file_names column can have for successful search indexing is 2^13. Hence, setting the column
    size to 2^12, so that there is enough room to accommodate slightly larger values for other columns.

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 2cbabc3..2017060 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -136,7 +136,7 @@ class Collection < ArvadosModel
           file_names << file_name if file_name != '.'
         end
       end
-      self.file_names = file_names.uniq.join(" ")[0,2**16]
+      self.file_names = file_names.uniq.join(" ")[0,2**12]
     end
     true
   end
diff --git a/services/api/db/migrate/20141208174653_collection_file_names.rb b/services/api/db/migrate/20141208174653_collection_file_names.rb
index 20c85a1..dc21584 100644
--- a/services/api/db/migrate/20141208174653_collection_file_names.rb
+++ b/services/api/db/migrate/20141208174653_collection_file_names.rb
@@ -2,7 +2,7 @@ class CollectionFileNames < ActiveRecord::Migration
   include CurrentApiClient
 
   def up
-    add_column :collections, :file_names, :string, :limit => 2**16
+    add_column :collections, :file_names, :string, :limit => 2**12
 
     act_as_system_user do
       Collection.all.each do |c|
@@ -13,7 +13,7 @@ class CollectionFileNames < ActiveRecord::Migration
             file_names << file_name if file_name != '.'
           end
 
-          c.file_names = file_names.uniq.join(" ")[0,2**16]
+          c.file_names = file_names.uniq.join(" ")[0,2**12]
           c.save!
         end
       end
diff --git a/services/api/db/structure.sql b/services/api/db/structure.sql
index 1659d90..047a901 100644
--- a/services/api/db/structure.sql
+++ b/services/api/db/structure.sql
@@ -170,7 +170,7 @@ CREATE TABLE collections (
     description character varying(524288),
     properties text,
     expires_at date,
-    file_names character varying(65536)
+    file_names character varying(4096)
 );
 
 
diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb
index 4a14ae8..1a5eee9 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -51,4 +51,22 @@ class CollectionTest < ActiveSupport::TestCase
     end
   end
 
+  test 'create collection with large manifest text and verify file_names' do
+    act_as_system_user do
+      manifest_text = ". d41d8cd98f00b204e9800998ecf8427e+0"
+      index = 0
+      while manifest_text.length < 2**15
+        manifest_text += ' ' + "0:0:foo#{index}.txt"
+        index += 1
+      end
+      manifest_text += "\n"
+
+      c = Collection.create(manifest_text: manifest_text)
+
+      assert c.valid?
+      created_file_names = c.file_names
+      assert created_file_names
+    end
+  end
+
 end

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list