[jira] [Commented] (AIRFLOW-2861) Need index on log table

2018-08-08 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/AIRFLOW-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16573530#comment-16573530
 ] 

ASF GitHub Bot commented on AIRFLOW-2861:
-

bolkedebruin closed pull request #3709: [AIRFLOW-2861] Added index on log table
URL: https://github.com/apache/incubator-airflow/pull/3709
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/migrations/versions/dd25f486b8ea_add_idx_log_dag.py 
b/airflow/migrations/versions/dd25f486b8ea_add_idx_log_dag.py
new file mode 100644
index 00..3249a2e058
--- /dev/null
+++ b/airflow/migrations/versions/dd25f486b8ea_add_idx_log_dag.py
@@ -0,0 +1,41 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+from alembic import op
+
+"""add idx_log_dag
+
+Revision ID: dd25f486b8ea
+Revises: 9635ae0956e7
+Create Date: 2018-08-07 06:41:41.028249
+
+"""
+
+# revision identifiers, used by Alembic.
+revision = 'dd25f486b8ea'
+down_revision = '9635ae0956e7'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+op.create_index('idx_log_dag', 'log', ['dag_id'], unique=False)
+
+
+def downgrade():
+op.drop_index('idx_log_dag', table_name='log')
diff --git a/airflow/models.py b/airflow/models.py
index 288bd4c937..c79220805c 100755
--- a/airflow/models.py
+++ b/airflow/models.py
@@ -2098,6 +2098,10 @@ class Log(Base):
 owner = Column(String(500))
 extra = Column(Text)
 
+__table_args__ = (
+Index('idx_log_dag', dag_id),
+)
+
 def __init__(self, event, task_instance, owner=None, extra=None, **kwargs):
 self.dttm = timezone.utcnow()
 self.event = event


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Need index on log table
> ---
>
> Key: AIRFLOW-2861
> URL: https://issues.apache.org/jira/browse/AIRFLOW-2861
> Project: Apache Airflow
>  Issue Type: Improvement
>  Components: database
>Affects Versions: 1.10.0
>Reporter: Vardan Gupta
>Assignee: Vardan Gupta
>Priority: Major
>
> Delete dag functionality is added in v1-10-stable, whose implementation 
> during the metadata cleanup 
> [part|https://github.com/apache/incubator-airflow/blob/dc78b9196723ca6724185231ccd6f5bbe8edcaf3/airflow/api/common/experimental/delete_dag.py#L48],
>  look for classes which has attribute named as dag_id and then formulate the 
> query on matching model and then delete from metadata, we've few numbers 
> where we've observed slowness especially in log table because it doesn't have 
> any single or multiple-column index. Creating an index would boost the 
> performance though insertion will be a bit slower. Since deletion will be a 
> sync call, would be good idea to create index.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AIRFLOW-2861) Need index on log table

2018-08-08 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/AIRFLOW-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16573531#comment-16573531
 ] 

ASF subversion and git services commented on AIRFLOW-2861:
--

Commit 6f7fe74b9ff6c2abae2764988c152af8bcc8e199 in incubator-airflow's branch 
refs/heads/master from [~vardan]
[ https://gitbox.apache.org/repos/asf?p=incubator-airflow.git;h=6f7fe74 ]

[AIRFLOW-2861] Add index on log table (#3709)



> Need index on log table
> ---
>
> Key: AIRFLOW-2861
> URL: https://issues.apache.org/jira/browse/AIRFLOW-2861
> Project: Apache Airflow
>  Issue Type: Improvement
>  Components: database
>Affects Versions: 1.10.0
>Reporter: Vardan Gupta
>Assignee: Vardan Gupta
>Priority: Major
>
> Delete dag functionality is added in v1-10-stable, whose implementation 
> during the metadata cleanup 
> [part|https://github.com/apache/incubator-airflow/blob/dc78b9196723ca6724185231ccd6f5bbe8edcaf3/airflow/api/common/experimental/delete_dag.py#L48],
>  look for classes which has attribute named as dag_id and then formulate the 
> query on matching model and then delete from metadata, we've few numbers 
> where we've observed slowness especially in log table because it doesn't have 
> any single or multiple-column index. Creating an index would boost the 
> performance though insertion will be a bit slower. Since deletion will be a 
> sync call, would be good idea to create index.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (AIRFLOW-2861) Need index on log table

2018-08-06 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/AIRFLOW-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16570098#comment-16570098
 ] 

ASF GitHub Bot commented on AIRFLOW-2861:
-

vardancse opened a new pull request #3709: [AIRFLOW-2861][Improvement] Added 
index on log table, will make delete dag optimized
URL: https://github.com/apache/incubator-airflow/pull/3709
 
 
   
   
   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [ ] My PR addresses the following [Airflow 
Jira](https://issues.apache.org/jira/browse/AIRFLOW/) issues and references 
them in the PR title. For example, "\[AIRFLOW-XXX\] My Airflow PR"
 - https://issues.apache.org/jira/browse/AIRFLOW-2861
 - In case you are fixing a typo in the documentation you can prepend your 
commit with \[AIRFLOW-XXX\], code changes always need a Jira issue.
   
   ### Description
   
   - [ ] Here are some details about my PR, including screenshots of any UI 
changes:
   Delete dag functionality is added in v1-10-stable, whose implementation 
during the metadata cleanup part, look for classes which has attribute named as 
dag_id and then formulate the query on matching model and then delete from 
metadata, we've few numbers where we've observed slowness especially in log 
table because it doesn't have any single or multiple-column index. Creating an 
index would boost the performance though insertion will be a bit slower. Since 
deletion will be a sync call, would be good idea to create index.
   
   ### Tests
   
   - [ ] My PR adds the following unit tests __OR__ does not need testing for 
this extremely good reason:
   
   ### Commits
   
   - [ ] My commits all reference Jira issues in their subject lines, and I 
have squashed multiple commits if they address the same issue. In addition, my 
commits follow the guidelines from "[How to write a good git commit 
message](http://chris.beams.io/posts/git-commit/)":
 1. Subject is separated from body by a blank line
 1. Subject is limited to 50 characters (not including Jira issue reference)
 1. Subject does not end with a period
 1. Subject uses the imperative mood ("add", not "adding")
 1. Body wraps at 72 characters
 1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [ ] In case of new functionality, my PR adds documentation that describes 
how to use it.
 - When adding new operators/hooks/sensors, the autoclass documentation 
generation needs to be added.
   
   ### Code Quality
   
   - [ ] Passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Need index on log table
> ---
>
> Key: AIRFLOW-2861
> URL: https://issues.apache.org/jira/browse/AIRFLOW-2861
> Project: Apache Airflow
>  Issue Type: Improvement
>  Components: database
>Affects Versions: 1.10.0
>Reporter: Vardan Gupta
>Assignee: Vardan Gupta
>Priority: Major
>
> Delete dag functionality is added in v1-10-stable, whose implementation 
> during the metadata cleanup 
> [part|https://github.com/apache/incubator-airflow/blob/dc78b9196723ca6724185231ccd6f5bbe8edcaf3/airflow/api/common/experimental/delete_dag.py#L48],
>  look for classes which has attribute named as dag_id and then formulate the 
> query on matching model and then delete from metadata, we've few numbers 
> where we've observed slowness especially in log table because it doesn't have 
> any single or multiple-column index. Creating an index would boost the 
> performance though insertion will be a bit slower. Since deletion will be a 
> sync call, would be good idea to create index.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)