New issue
Advanced search Search tips

Issue 601158 link

Starred by 1 user

Issue metadata

Status: Verified
Owner: ----
Closed: Apr 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

test_importer should only be run in master scheduler

Project Member Reported by dshi@chromium.org, Apr 6 2016

Issue description

Currently it's in the deployment action of all afe servers. This is unnecessary and can cause a race condition when multiple afe servers are running test_importer at the same time, and run into a db issue:

Traceback (most recent call last):
  File "/usr/local/autotest/utils/test_importer.py", line 600, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/autotest/utils/test_importer.py", line 549, in main
    options.add_experimental)
  File "/usr/local/autotest/utils/test_importer.py", line 78, in update_all
    autotest_dir=autotest_dir)
  File "/usr/local/autotest/utils/test_importer.py", line 245, in update_tests_in_db
    add_label_dependencies(new_test)
  File "/usr/local/autotest/utils/test_importer.py", line 320, in add_label_dependencies
    subject='add dependency to %s' % test.name)
  File "/usr/local/autotest/utils/test_importer.py", line 414, in _log_or_execute
    func(*args)
  File "/usr/local/autotest/site-packages/django/db/models/fields/related.py", line 650, in add
    self._add_items(self.source_field_name, self.target_field_name, *objs)
  File "/usr/local/autotest/site-packages/django/db/models/fields/related.py", line 739, in _add_items
    for obj_id in new_ids
  File "/usr/local/autotest/site-packages/django/db/models/query.py", line 444, in bulk_create
    self._batched_insert(objs_without_pk, fields, batch_size)
  File "/usr/local/autotest/site-packages/django/db/models/query.py", line 902, in _batched_insert
    using=self.db)
  File "/usr/local/autotest/site-packages/django/db/models/manager.py", line 215, in _insert
    return insert_query(self.model, objs, fields, **kwargs)
  File "/usr/local/autotest/site-packages/django/db/models/query.py", line 1661, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/usr/local/autotest/site-packages/django/db/models/sql/compiler.py", line 937, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/autotest/site-packages/django/db/backends/mysql/base.py", line 122, in execute
    six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2])
  File "/usr/local/autotest/site-packages/django/db/backends/mysql/base.py", line 120, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/autotest/site-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/local/autotest/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
django.db.utils.IntegrityError: (1062, "Duplicate entry '74668-695' for key 'test_id'")


 

Comment 1 by dshi@chromium.org, Apr 6 2016

Minor update, test_importer runs in all schedulers not afe servers. We have a backup master scheduler, that's why it runs into such issue.

The action should only apply to primary master scheduler.
Project Member

Comment 2 by bugdroid1@chromium.org, Apr 7 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/autotest/+/cf27804b4594ee6d6deb26ca06d6a6448b446c2e

commit cf27804b4594ee6d6deb26ca06d6a6448b446c2e
Author: Dan Shi <dshi@google.com>
Date: Thu Apr 07 04:16:34 2016

[autotest] Skip some update commands in none primary server

BUG= chromium:601158 
TEST=run in a backup master scheduler

Change-Id: I553df57cc6a4b8ae9a1f8c31dbfc92e1ab006030
Reviewed-on: https://chromium-review.googlesource.com/337337
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Shuqian Zhao <shuqianz@chromium.org>

[modify] https://crrev.com/cf27804b4594ee6d6deb26ca06d6a6448b446c2e/site_utils/deploy_production_local.py

Comment 3 by dshi@chromium.org, Apr 10 2016

Status: Fixed (was: Available)

Comment 4 by benhenry@google.com, Apr 27 2016

Components: Infra>Client>ChromeOS
Labels: -Infra-ChromeOS
Status: Verified (was: Fixed)
Closing. please reopen if its not fixed.

Sign in to add a comment