[ARVADOS] updated: 6722b420effcab24dffd9b47fa277f8830bd4cca

Git user git at public.curoverse.com
Thu Mar 23 15:19:49 EDT 2017


Summary of changes:
 apps/workbench/app/views/work_units/_show_child.html.erb   |  4 ++--
 .../crunch2-slurm/install-compute-node.html.textile.liquid |  6 ++----
 sdk/cli/arvados-cli.gemspec                                |  2 +-
 sdk/cli/test/test_arv-collection-create.rb                 |  1 +
 sdk/python/tests/run_test_server.py                        | 14 ++++++++++++--
 sdk/python/tests/test_arv_keepdocker.py                    |  6 +++---
 services/api/app/models/log.rb                             |  2 +-
 services/api/config/application.default.yml                | 11 ++++++-----
 services/api/test/unit/log_test.rb                         | 14 +++++++++++---
 9 files changed, 39 insertions(+), 21 deletions(-)

       via  6722b420effcab24dffd9b47fa277f8830bd4cca (commit)
       via  262d1e44ddaf3f014423a4acf96a3a6200279820 (commit)
       via  b50e323ec94e9c7355c6f1c5b93f488540d08ec3 (commit)
       via  49510014c88646ef4320b137240966ba8f6d5108 (commit)
       via  5689f1de6e1a263237303b73013dcebb4ad77e1f (commit)
       via  2fd606b328508babad9af6c0a30c159568b525c2 (commit)
       via  8b278cdd80f8969a954a2c789281f8f63195e894 (commit)
       via  f8084a54742def1915c9f4be290f9076033af152 (commit)
       via  9c99316ba4a62ab15b383a8e3b2ec6f4d7165a3e (commit)
       via  99ee47018fcb7cff2adc9184e2063eeba9d55798 (commit)
      from  37e995fb7423b2b353c599e2a1b00bda7c29ee6f (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 6722b420effcab24dffd9b47fa277f8830bd4cca
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Mar 23 15:18:51 2017 -0400

    11065: Update comments.

diff --git a/services/api/config/application.default.yml b/services/api/config/application.default.yml
index fbecc96..5241cb4 100644
--- a/services/api/config/application.default.yml
+++ b/services/api/config/application.default.yml
@@ -232,10 +232,12 @@ common:
   # crunchstat logs from the logs table.
   clean_container_log_rows_after: <%= 30.days %>
 
-  # Time to keep audit logs (a row in the log table added each time an
-  # Arvados object is created, modified, or deleted) in the PostgreSQL
-  # database. Currently, websocket event notifications rely on audit
-  # logs, so this should not be set lower than 600 (5 minutes).
+  # Time to keep audit logs, in seconds. (An audit log is a row added
+  # to the "logs" table in the PostgreSQL database each time an
+  # Arvados object is created, modified, or deleted.)
+  #
+  # Currently, websocket event notifications rely on audit logs, so
+  # this should not be set lower than 600 (5 minutes).
   max_audit_log_age: 1209600
 
   # Maximum number of log rows to delete in a single SQL transaction.
@@ -480,4 +482,3 @@ test:
   websocket_address: <% if ENV['ARVADOS_TEST_EXPERIMENTAL_WS'] %>"wss://0.0.0.0:<%= ENV['ARVADOS_TEST_WSS_PORT'] %>/websocket"<% else %>false<% end %>
   trash_sweep_interval: -1
   docker_image_formats: ["v1"]
-  max_audit_log_delete_batch: 0
diff --git a/services/api/test/unit/log_test.rb b/services/api/test/unit/log_test.rb
index 370bec1..7376876 100644
--- a/services/api/test/unit/log_test.rb
+++ b/services/api/test/unit/log_test.rb
@@ -323,6 +323,8 @@ class LogTest < ActiveSupport::TestCase
     Log.unscoped.where('event_type in (?)', %w(create update destroy delete))
   end
 
+  # Default settings should not delete anything -- some sites rely on
+  # the original "keep everything forever" behavior.
   test 'retain old audit logs with default settings' do
     assert_no_logs_deleted do
       AuditLogs.delete_old(
@@ -331,20 +333,26 @@ class LogTest < ActiveSupport::TestCase
     end
   end
 
-  test 'retain old audit logs with batch=0' do
+  # Batch size 0 should retain all logs -- even if max_age is very
+  # short, and even if the default settings (and associated test) have
+  # changed.
+  test 'retain old audit logs with max_audit_log_delete_batch=0' do
     assert_no_logs_deleted do
       AuditLogs.delete_old(max_age: 1, max_batch: 0)
     end
   end
 
+  # We recommend a more conservative age of 5 minutes for production,
+  # but 3 minutes suits our test data better (and is test-worthy in
+  # that it's expected to work correctly in production).
   test 'delete old audit logs with production settings' do
     initial_log_count = Log.unscoped.all.count
     AuditLogs.delete_old(max_age: 180, max_batch: 100000)
     assert_operator remaining_audit_logs.count, :<, initial_log_count
   end
 
-  test 'delete old audit logs in multiple batches' do
-    AuditLogs.delete_old(max_age: 0, max_batch: 2)
+  test 'delete all audit logs in multiple batches' do
+    AuditLogs.delete_old(max_age: 0.00001, max_batch: 2)
     assert_equal [], remaining_audit_logs.collect(&:uuid)
   end
 

commit 262d1e44ddaf3f014423a4acf96a3a6200279820
Merge: 8b278cd b50e323
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Mar 22 15:30:52 2017 -0400

    11065: Merge branch 'master' into 11065-rotate-logs


commit 8b278cdd80f8969a954a2c789281f8f63195e894
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Mar 22 10:18:43 2017 -0400

    11065: Defer audit log cleanup until after_commit.

diff --git a/services/api/app/models/log.rb b/services/api/app/models/log.rb
index 8c57e10..eedf06a 100644
--- a/services/api/app/models/log.rb
+++ b/services/api/app/models/log.rb
@@ -7,7 +7,7 @@ class Log < ArvadosModel
   serialize :properties, Hash
   before_validation :set_default_event_at
   after_save :send_notify
-  after_save { AuditLogs.tidy_in_background }
+  after_commit { AuditLogs.tidy_in_background }
 
   api_accessible :user, extend: :common do |t|
     t.add :id

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list