spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JoshRosen <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-12757] Add block-level read/write locks...
Date Tue, 23 Feb 2016 07:29:29 GMT
Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/10705#discussion_r53744366
  
    --- Diff: core/src/main/scala/org/apache/spark/storage/BlockInfoManager.scala ---
    @@ -0,0 +1,356 @@
    +/*
    + * 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.
    + */
    +
    +package org.apache.spark.storage
    +
    +import java.lang
    +import javax.annotation.concurrent.GuardedBy
    +
    +import scala.collection.JavaConverters._
    +import scala.collection.mutable
    +
    +import com.google.common.cache.{CacheBuilder, CacheLoader, LoadingCache}
    +import com.google.common.collect.ConcurrentHashMultiset
    +
    +import org.apache.spark.{Logging, TaskContext}
    +
    +
    +/**
    + * Tracks metadata for an individual block.
    + *
    + * @param level the block's storage level. This is the requested persistence level, not
the
    + *              effective storage level of the block (i.e. if this is MEMORY_AND_DISK,
then this
    + *              does not imply that the block is actually resident in memory).
    + * @param tellMaster whether state changes for this block should be reported to the master.
This
    + *                   is true for most blocks, but is false for broadcast blocks.
    + */
    +private[storage] class BlockInfo(val level: StorageLevel, val tellMaster: Boolean) {
    +
    +  /**
    +   * The size of the block (in bytes)
    +   */
    +  var size: Long = 0
    +
    +  /**
    +   * The number of times that this block has been locked for reading.
    +   */
    +  var readerCount: Int = 0
    +
    +  /**
    +   * The task attempt id of the task which currently holds the write lock for this block,
or -1
    +   * if this block is not locked for writing.
    +   */
    +  var writerTask: Long = -1
    +
    +  // Invariants:
    +  //     (writerTask != -1) implies (readerCount == 0)
    +  //     (readerCount != 0) implies (writerTask == -1)
    +  // TODO: add assertions around every method
    --- End diff --
    
    Good idea; done.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message