Return-Path: X-Original-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EDC6B185A3 for ; Sun, 28 Jun 2015 17:39:29 +0000 (UTC) Received: (qmail 97455 invoked by uid 500); 28 Jun 2015 17:39:24 -0000 Delivered-To: apmail-hadoop-mapreduce-user-archive@hadoop.apache.org Received: (qmail 97344 invoked by uid 500); 28 Jun 2015 17:39:24 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 97334 invoked by uid 99); 28 Jun 2015 17:39:24 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 28 Jun 2015 17:39:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id A0E91180338 for ; Sun, 28 Jun 2015 17:39:23 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.193 X-Spam-Level: **** X-Spam-Status: No, score=4.193 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URI_HEX=1.313] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id 9fvRjHlzcA-x for ; Sun, 28 Jun 2015 17:39:17 +0000 (UTC) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com [209.85.215.41]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 672922122F for ; Sun, 28 Jun 2015 17:39:16 +0000 (UTC) Received: by lagh6 with SMTP id h6so30263062lag.2 for ; Sun, 28 Jun 2015 10:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=rBFm8cD2+ZyHGL1XPAr+89kxUjqZun821/8UhITAifc=; b=BdwJ4hV6Z+ynP5V3FDtjBqc+iJbNjuGD+kn47ZhN/bOmy7bCIE3GMMcHuP7B13n23s tv7UGkyhQSPIbYeXVKv3eIAL83R/b8HBd1gp4miyymoRsNEGZRbYoXAhtEBjhwWoMrql 0LXqUs1srk1pRiTejJLH2C56zJ/ZWhVZsKV6+e2YAfaAUnyrXNKiKK8AH6svIgrSE//8 1HOIddNRXrUz09q88Vh/XtQujxntM43sQpT3Uux4uM4Yqr/grmOTEYrmCjCaZH8GtMVd aMwCF+qFj3E+I8pcQW956S+JEMyIAyE5vhCsUxHvjYJvjfEzLCDDGgsGiaPDOEO3IQzI TD0g== MIME-Version: 1.0 X-Received: by 10.112.209.106 with SMTP id ml10mr10440826lbc.112.1435513155876; Sun, 28 Jun 2015 10:39:15 -0700 (PDT) Received: by 10.25.78.13 with HTTP; Sun, 28 Jun 2015 10:39:15 -0700 (PDT) In-Reply-To: References: Date: Sun, 28 Jun 2015 23:09:15 +0530 Message-ID: Subject: Re: Static variable in reducer From: Ravikant Dindokar To: user@hadoop.apache.org Content-Type: multipart/alternative; boundary=001a11c25ea0b9fe910519977373 --001a11c25ea0b9fe910519977373 Content-Type: text/plain; charset=UTF-8 Thanks a lot Shahab. On Sun, Jun 28, 2015 at 8:38 PM, Shahab Yunus wrote: > You asked a similar question earlier also so I will copy those comments > here with what I replied then: > > http://hadoop-common.472056.n3.nabble.com/how-to-assign-unique-ID-Long-Value-in-mapper-td4078062.html > Basically, to summarize, you shouldn't incorporate common sharable state > among reducers. You need to rethink your design. > > Moving on, if you still want to do this then in your scenario: If a > reducer fails (runs out of memory, hdd crashes etc. or in case of > speculative execution,) then it will be given a new attempt number with the > old task id when it is being recomputed/retried and your custom counter > variable (the static one) should be reinitialized (as it will be in a new > JVM). > > Regards, > Shahab > > On Sun, Jun 28, 2015 at 6:45 AM, Ravikant Dindokar < > ravikant.iisc@gmail.com> wrote: > >> Hi Hadoop user, >> >> I have graph data file in the form of edge list >> >> >> I want to assign each edge a unique ID. In the map function I emit >> (key,value) as (, ) >> >> In the reducer, for each value , I am using a combination of static count >> variable, and task id (context.getTaskAttemptID().getTaskID().getId()) to >> generate a unique ID. >> >> edgeId=(localcount <<16)|(taskId << 55); >> >> I am able to generate unique IDs. >> >> My question is if a reducer fails will this work? >> >> What exactly happens when a reducer fails and computed again? >> >> PFA source code for mapper & reducer. >> >> Thanks >> Ravikant >> > > --001a11c25ea0b9fe910519977373 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks a lot Shahab.
=
On Sun, Jun 28, 2015 at 8:38 PM, Shahab Yunu= s <shahab.yunus@gmail.com> wrote:
You asked a similar question earlier also so= I will copy those comments here with what I replied then:
http://hadoop-common.472056.n3= .nabble.com/how-to-assign-unique-ID-Long-Value-in-mapper-td4078062.html= Basically, to summarize, you shouldn't incorporate common sharable sta= te among reducers. You need to rethink your design.
Moving on, if you still want to do this then in your scenario: = If a reducer fails (runs out of memory, hdd crashes etc. or in case of spec= ulative execution,) then it will be given a new attempt number with the old= task id when it is being recomputed/retried and your custom counter variab= le (the static one) should be reinitialized (as it will be in a new JVM).

Regards,
Shahab

On Sun, Jun 28, 2015 at 6:45 AM, Ravikant Dindokar <ravikant.iisc@gmail.com> wrote:
Hi = Hadoop user,

I have graph data file in the form of edge list
<Source Vertex_id> <Sink Vertex_id>

I want= to assign each edge a unique ID. In the map function I emit (key,value) as= (<Source Vertex_id>, <Sink Vertex_id>)

In the red= ucer, for each value , I am using a combination of static count variable, a= nd task id (context.getTaskAttemptID().getTaskID().getId()) to generate a u= nique ID.

edgeId=3D(localcount <<16)|(taskId << 55);
I am able to generate unique IDs.

My question is if= a reducer fails will this work?=C2=A0

What exactly happens w= hen a reducer fails and computed again?

PFA source code f= or mapper & reducer.

Thanks
Ravikant


--001a11c25ea0b9fe910519977373--