text:
Q: Select query skips records during concurrent updates i have table that processed concurrently by N threads.
CREATE TABLE [dbo].[Jobs]
(
    [Id]                    BIGINT          NOT NULL    CONSTRAINT [PK_Jobs] PRIMARY KEY IDENTITY,
    [Data]                  VARBINARY(MAX)  NOT NULL,
    [CreationTimestamp]     DATETIME2(7)    NOT NULL,
    [Type]                  INT             NOT NULL,
    [ModificationTimestamp] DATETIME2(7)    NOT NULL,
    [State]                 INT             NOT NULL,
    [RowVersion]            ROWVERSION      NOT NULL,
    [Activity]              INT                 NULL,
    [Parent_Id]             BIGINT              NULL
)
GO

CREATE NONCLUSTERED INDEX [IX_Jobs_Type_State_RowVersion] ON [dbo].[Jobs]([Type], [State], [RowVersion] ASC) WHERE ([State] <> 100)
GO

CREATE NONCLUSTERED INDEX [IX_Jobs_Parent_Id_State] ON [dbo].[Jobs]([Parent_Id], [State] ASC)
GO

Job is adding to table with State=0 (New) — it can be consumed by any worker in this state. When worker gets this queue item, State changed to 50 (Processing) and job becomes unavailable for other consumers (workers call [dbo].[Jobs_GetFirstByType] with arguments: Type=any, @CurrentState=0, @NewState=50).
CREATE PROCEDURE [dbo].[Jobs_GetFirstByType]
    @Type           INT,
    @CurrentState   INT,
    @NewState       INT
AS
BEGIN

    SET TRANSACTION ISOLATION LEVEL READ COMMITTED;

    DECLARE @JobId BIGINT;

    BEGIN TRAN

        SELECT      TOP(1)
                    @JobId = Id
        FROM        [dbo].[Jobs] WITH (UPDLOCK, READPAST)
        WHERE       [Type] = @Type AND [State] = @CurrentState
        ORDER BY    [RowVersion];

        UPDATE  [dbo].[Jobs]

        SET     [State] = @NewState,
                [ModificationTimestamp] = SYSUTCDATETIME()

        OUTPUT  INSERTED.[Id]
                ,INSERTED.[RowVersion]
                ,INSERTED.[Data]
                ,INSERTED.[Type]
                ,INSERTED.[State]
                ,INSERTED.[Activity]

        WHERE   [Id] = @JobId;

    COMMIT TRAN

END

After processing, job State can be changed to 0 (New) again or it can be once set to 100 (Completed).
CREATE PROCEDURE [dbo].[Jobs_UpdateStatus]
    @Id         BIGINT,
    @State      INT,
    @Activity   INT
AS
BEGIN

    UPDATE  j

    SET     j.[State] = @State,
            j.[Activity] = @Activity,
            j.[ModificationTimestamp] = SYSUTCDATETIME()

    OUTPUT  INSERTED.[Id], INSERTED.[RowVersion]

    FROM    [dbo].[Jobs] j

    WHERE   j.[Id] = @Id;

END

Jobs has hierarchical structure, parent job gets State=100 (Completed) only when all childs are completed.
Some workers call stored procedures ([dbo].[Jobs_GetCountWithExcludedState] with @ExcludedState=100) that returns number of incompleted jobs, when it returns 0, parent job State can be set to 100 (Completed).
CREATE PROCEDURE [dbo].[Jobs_GetCountWithExcludedState]
    @ParentId       INT,
    @ExcludedState  INT
AS
BEGIN

    SET TRANSACTION ISOLATION LEVEL READ COMMITTED;

    SELECT  COUNT(1)

    FROM    [dbo].[Jobs]

    WHERE   [Parent_Id] = @ParentId
    AND     [State] <> @ExcludedState

END

The main problem is strange behaviour of this stored procedure. Sometimes it returns 0 for parent job, but it exactly has incompleted jobs. I tryied turn on change data tracking and some debug information (including profiling) — child jobs 100% doesn't have State=100 when SP return 0.
It seems that the SP skips records, that are not in 100 (Completed) state, but why it happen and how we can prevent this?
UPD:
Calling [dbo].[Jobs_GetCountWithExcludedState] starts when parent job has childs. There сan be no situation when worker starts checking child jobs without their existence, because creating childs and setting to parent job checking activity wrapped in transaction:
using (var ts = new TransactionScope())
{
    _jobManager.AddChilds(parentJob);

    parentJob.State = 0;
    parentJob.Activity = 30; // in this activity worker starts checking child jobs

    ts.Complete();
}

A: It would be very disturbing if in fact your procedure Jobs_GetCountWithExcludedState was returning a count of 0 records when there were in fact committed records matching your criteria.  It's a pretty simple procedure.  So there are two possibilities:

*

*The query is failing due to an issue with SQL Server or data
corruption.

*There actually are no committed records matching the criteria at the time the
procedure is run.

Corruption is an unlikely, but possible cause.  You can check for corruption with DBCC CHECKDB.
Most likely there really are no committed job records that have a Parent_ID equal to the @ParentId parameter and are not in a state of 100 at the time it is run.
I emphasize committed because that's what the transaction will see.
You never really explain in your question how the Parent_ID gets set on the jobs.  My first thought is that maybe you are checking for unprocessed child jobs and it finds none, but then another process adds it as the Parent_ID of another incomplete job.  Is this a possibility?
I see you added an update to show that when you add a child job record that the update of the parent and child records are wrapped in a transaction.  This is good, but not the question I was asking.  This is the scenario that I am considering as a possibility:

*

*A Job Record is inserted and committed for the parent.

*Jobs_GetFirstByType grabs the parent job.

*A worker thread processes it and calls Jobs_UpdateStatus and updates it's status to 100.

*Something calls Jobs_GetCountWithExcludedState with the job and returns 0.

*A child job is created and attached to the completed parent job record... which makes it now incomplete again.

I'm not saying that this is what is happening... I'm just asking if it's possible and what steps are you taking to prevent it?  For example, in your code above in the update to your question you are selecting a ParentJob to attach the child to outside of the transaction.  Could it be that you are selecting a parent job and then it gets completed before you run the transaction that adds the child to the parent?  Or maybe the last child job of a parent job completes so the worker thread checks and marks the parent complete, but some other worker thread has already selected the job to be the parent for a new child job?
There are many different scenarios that could cause the symptom you are describing.  I believe that the problem is to be found in some code that you have not shared with us yet particularly about how jobs are created and the code surrounding calls to Jobs_GetCountWithExcludedState.  If you can give more information I think you will be more likely to find a usable answer, otherwise the best we can do is guess all the things that could happen in the code we can't see.

A: Your problem is almost certainly caused by your choice of "READ COMMITTED" isolation level. The behaviour of this depends on your configuration setting for READ_COMMITTED_SNAPSHOT, but either way it allows another transaction thread to modify records that would have been seen by your SELECT, between your SELECT and your UPDATE - so you have a race condition.
Try it again with isolation level "SERIALIZABLE" and see if that fixes your problem. For more information on isolation levels, the documentation is very helpful:
https://msdn.microsoft.com/en-AU/library/ms173763.aspx

A: Your sql code looks fine. Therefore, the problem lies in how it is used.
Hypothesis #0
Procedure "Jobs_GetCountWithExcludedState" is called with a totally wrong ID. Because yes sometime problem are really just a little mistake. I doubt this is your case however.

Hypothesis #1
The code checking the field "Activity = 30" is doing it in "READ UNCOMMITED" isolation level. It would then call "Jobs_GetCountWithExcludedState" with an parentID that may not be really ready for it because the insertion transaction may not have ended yet or have been rollbacked.

Hypothesis #2
Procedure "Jobs_GetCountWithExcludedState" is called with an id that has no longer child. There could be many reason why this happen.
For example,

*

*Transaction that inserted child job failed for whatever reason but this procedure was called anyway.

*A single child job was deleted and was about to be replace.

*etc

Hypothesis #3
Procedure "Jobs_GetCountWithExcludedState" is called before the childJob get their parentId assigned.

Conclusion
As you can see, we need more information on two things :
 1. How "Jobs_GetCountWithExcludedState" is called.
 2. How job are inserted. Is the parentId assigned at the insertion time or it is updated a bit later? Are they inserted in batch? Is there annexed code to it that do other stuff?
This is also where I recommend you to have a look to verify above hypothesis because the problem is most likely in the program.

Possible refactoring to invalidate all those hypothesis
Have the database tell the application which parents tasks are completed directly instead.

*

*Just like "Jobs_GetFirstByType", there could be Jobs_GetFirstParentJobToComplete" which could return the next uncompleted parent job with completed childs if any. It could also be a view that return all of them. Either ways, usage of "Jobs_GetCountWithExcludedState" would then no longer be used thus invaliding all my hypothesis. The new procedure or view should be READ COMMITTED or above.

A: I have suggestion review client side and how you handle transaction and connection lifetime for each thread. Because all commands are running on client transaction.

redpajama_set_name: RedPajamaStackExchange


text:
GOP energy moderates lose big as Democrats retake House
Flickr; USCapitol
A number of moderate Republicans who voiced support for clean energy policies lost their Congressional seats Tuesday as the House of Representatives swung from GOP to Democratic control.
Thirteen of 45 GOP members of the bipartisan climate caucus in the House lost their seats, as of Thursday morning, while five other retiring Republican members were replaced by Democrats. Two races were still too close to call.
Power sector veterans saw mixed results in House elections, with three former energy industry executives winning seats in Michigan, Illinois and California, and one losing a close race in North Carolina.
Democrats won the majority in the House of Representatives in the midterm elections Tuesday night, gaining 225 of the 218 seats needed as of Wednesday morning, with results still being reported in several districts.
The switch in party leadership will mean more oversight of the Trump administration's energy policy, with Democratic committee leaders able to subpoena records from the administration and hold public hearings with cabinet officials.
The Democrats' energy agenda will become clearer after elections for leadership positions in the caucus, Capitol Hill watchers told Utility Dive before the elections, but the shift in House control could make bipartisan energy work less likely.
Democrats won control of the House by flipping a number of districts held by more moderate GOP members, including many in the climate caucus. That, combined with primary victories for conservative Republicans, will likely mean a more hardline GOP caucus less likely to address clean energy issues.
"Certainly many of the moderate Republican voices on climate stewardship and conservation will be gone," Sarah Hunt, a GOP clean energy strategist, told Utility Dive before the election.
One of the districts that Democrats flipped was the Illinois 6th, where former energy consultant and power generation executive Sean Casten beat incumbent Peter Roskam, earning nearly 53% of the vote.
In another Democratic gain, energy and environmental lawyer Mike Levin defeated Republican Diane Harkin, gaining 53.5% of the vote for a California seat vacated by former GOP Rep. Darrell Issa. Levin worked as an energy and environmental lawyer for 10 years and served on the board for Sustainable Energy in San Diego.
"I believe that some representatives have an excellent grasp of the issues [surrounding energy policy], but others are uninformed," Levin told Utility Dive before the election. "I will be a champion in Washington on issues of sustainability and climate change and their impact on our economy, health, and security."
Another race involving a power sector veteran was finally called Wednesday evening. In the North Carolina 9th district, solar company founder Dan McCready conceded in a tight battle with Republican Mark Harris for a region that President Donald Trump won by 12 points.
In Michigan, the election of another industry official is assured. Energy financier Andy Levin won the 9th district with nearly 60% of the vote, filling the seat vacated by his father, former Rep. Sandy Levin.
"If we want the federal government to lead in our transition to sustainable energy, we need people with relevant industry experience," Levin told Utility Dive via email. "The question is whether Americans will be using clean energy technologies developed and manufactured in Asia and Europe, or whether our federal government will spur clean energy innovation to help America lead in this rapidly-growing industry."
Percent of vote
Sean Casten, D-Ill
Illinois District 6
Mike Levin, D-Calif.
California District 49
Dan McCready, D-N.C.
North Carolina District 9
Andy Levin, D-Mich.
Michigan District 9
Filed Under: Regulation & Policy

redpajama_set_name: RedPajamaCommonCrawl


"I am also pleased to hear something about Kirtanananda's party, and if you have them, kindly send me one photo of these painted busses, how they look, so I may be inspired by seeing them"
I am very glad to hear from you that you have got a nice new temple there, which is also large, and that in general everything at New Orleans Center is progressing well under your supervision. I am very much satisfied. I am also pleased to hear something about Kirtanananda's party, and if you have them, kindly send me one photo of these painted busses, how they look, so I may be inspired by seeing them.
Please accept my blessings. I am in due receipt of your letter dated March 3, 1972, and I am very glad to hear from you that you have got a nice new temple there, which is also large, and that in general everything at New Orleans Center is progressing well under your supervision. I am very much satisfied. I am also pleased to hear something about Kirtanananda's party, and if you have them, kindly send me one photo of these painted busses, how they look, so I may be inspired by seeing them.
The newsletter is also very nice, and you may encourage all centers to correspond in this way regularly amongst yourselves. When I shall come there to Los Angeles, then we shall see when I can also come to stay at your new temple.
Facts about "I am also pleased to hear something about Kirtanananda's party, and if you have them, kindly send me one photo of these painted busses, how they look, so I may be inspired by seeing them"
This page was last modified on 20 December 2016, at 11:54.


text:
if(HIV-1 envelope glycoprotein) » Refine Search
211 - 240 of 6292 displayed. < Previous | Next >
Autographa californica multicapsid nucleopolyhedrovirus (AcMNPV) pathogenesis in the soybean looper, Pseudoplusia includens
by Stephens, Kimberly, M.S. California State University, Long Beach. 2010: 53 pages; 1490340.
The human serum glycan cancer biomarker analysis pipeline
by Kronewitter, Scott Ryan, Ph.D. University of California, Davis. 2010: 209 pages; 3404959.
Adolescent Latino Sexual Behavior: More Reactive or Reasoned?
by Gonzales, Felisa A., Ph.D. The George Washington University. 2013: 226 pages; 3588123.
Improving Decision-Making about HIV Treatment and Prevention in the United States: Model-Based Approaches
by Gonsalves, Gregg Steven, Ph.D. Yale University. 2017: 94 pages; 10633246.
Interference mitigation effects on synthetic aperture radar coherent data products
by Musgrove, Cameron H., Ph.D. Oklahoma State University. 2015: 136 pages; 10140020.
Development of a Direct-Contact Triculture Model of the Human Blood-Brain Barrier and Potential Applications as a Preclinical Drug Screening Tool
by Ngendahimana, Aimable, Ph.D. Purdue University. 2017: 144 pages; 10643075.
Assessing and increasing Z-width of haptic displays with active electrical damping
by Weir, David W., Ph.D. Northwestern University. 2008: 178 pages; 3303734.
DNA sequence and chromatin directed compartmentalization of chromosomal domains to the nuclear lamina
by Zullo, Joseph M., Ph.D. The University of Chicago. 2011: 150 pages; 3445062.
Urban food growth: Designing for vertical building surfaces
by Wilson, Allison Rose, M.Arch. University of Oregon. 2012: 129 pages; 1516841.
The use of the Beck Depression Inventory-II and the patient health questionnaire-9 with persons diagnosed with HIV/AIDS: An exploratory study
by Seymour, Jennifer M., Ph.D. The University of Toledo. 2010: 134 pages; 3423936.
Aerophysics of double-skin facades: Simulation-based determination of pressure coefficients for multi-story double-skin facades
by Vaglio, Jeffrey Craig, Ph.D. University of Southern California. 2015: 605 pages; 10124488.
Short-Burst-High-Intensity Exercise to Improve Working Memory in Preadolescent Children Diagnosed with Attention Deficit Hyperactivity Disorder
by Chambers, Stuart Alva, Ed.D. Piedmont College. 2016: 231 pages; 10111590.
Micromechanics Based Failure Analysis of Heterogeneous Materials
by Sertse, Hamsasew M., Ph.D. Purdue University. 2017: 176 pages; 10689831.
Examination of the anti-saccade task as an indicator of cognitive functioning in HIV infected individuals
by Olson, Katherine Clancy, Psy.D. Pepperdine University. 2012: 75 pages; 3543638.
Effects of fast and varied thinking on mood, depression, and physiology in women aged 50 to 69 with subclinical depression
by Stoddard, Jo A., Psy.D. Saybrook University. 2015: 191 pages; 3714486.
Evaluating Factors Associated with Tenofovir-Related Kidney Injury in HIV-Infected Women
by Baxi, Sanjiv M., Ph.D. University of California, Berkeley. 2016: 94 pages; 10188658.
Investigation of interactions of the rubella virus p150 replicase protein with host cell proteins in infected cells
by Suppiah, Suganthi, Ph.D. Georgia State University. 2009: 136 pages; 3406060.
Cell geometric constraints regulate nuclear & chromatin plasticity via actomyosin contractility
by Makhija, Ekta, Ph.D. National University of Singapore (Singapore). 2015: 116 pages; 10006059.
Large-Signal Modeling of Gallium Nitride HEMT Devices for Power Amplifiers
by Marcoux, Nick L., M.S. Tufts University. 2012: 119 pages; 1531394.
Promoting positive performance relationships between law enforcement supervisors and their officers
by Law, Shanell M., Ed.D. Pepperdine University. 2012: 177 pages; 3518865.
Disaggregating tree and grass phenology in tropical savannas
by Zhou, Qiang, Ph.D. The University of North Dakota. 2015: 241 pages; 3724867.
Nursing home leadership styles and performance outcomes: A quantitative study about leader relationships
by Olinger, Jean Lorraine, D.M. University of Phoenix. 2010: 187 pages; 3448398.
Streptococcal collagen-like protein 1, Scl1, modulates group a Streptococcus adhesion, biofilm formation and virulence
by Bachert, Beth Alexandra, Ph.D. West Virginia University. 2016: 307 pages; 10238211.
Computational Modeling of Mitosis in Fission Yeast
by Edelmaier, Christopher, Ph.D. University of Colorado at Boulder. 2018: 98 pages; 10837613.
Neutrino Flavor Transformation in Core-Collapse Supernovae
by Cherry, John F., Jr., Ph.D. University of California, San Diego. 2012: 137 pages; 3518965.
The identification, cloning and characterization of baboon trypanosome lytic factor
by Thomson, Russell, Ph.D. New York University. 2009: 177 pages; 3380271.
Phenolic Constituents from Garcinia intermedia and Related Species
by Munoz Acuna, Ulyana, Ph.D. City University of New York. 2011: 110 pages; 3444330.
Alternative positioning during the second stage of labor
by Abeling, Melanie S., M.S.N. Northern Kentucky University. 2011: 59 pages; 1493981.
Implementation of school districts' food safety plans and perceptions of support for food safety and training in child nutrition programs in one USDA region
by Dawso Van Druff, Cynthia A., Ph.D. Iowa State University. 2012: 220 pages; 3511376.
Nerve growth factor signaling maintains herpes simplex virus latency
by Camarena, Vladimir, Ph.D. New York University. 2010: 253 pages; 3428035.
211 - 240 of 6292 displayed.
« First < Previous | 5 6 7 8 9 10 11 12 13 14 15 Next >


text:
(-) Council Special Report
Repairing the U.S.-Israel Relationship
The U.S. relationship with Israel is in trouble. Robert D. Blackwill and Philip H. Gordon offer six core policy proposals to repair, redefine, and invigorate the partnership.
Council Special Report by Robert D. Blackwill and Philip H. Gordon U.S. Foreign Policy Program
Bolivia on the Brink
Overview Three years ago, the Council on Foreign Relations launched a commission to examine U.S. policy in the Andean region and the Colombian conflict. The result, Andes 2020: A New Strategy f…
Council Special Report by Eduardo A. Gamarra Center for Preventive Action
David A. Morse Lecture
David Rockefeller Lecture
Lessons From History
David Fidler
Adjunct Senior Fellow for Cybersecurity and Global Health
David J. Scheffer
Visiting Senior Fellow
Philip H. Gordon
Mary and David Boies Senior Fellow in U.S. Foreign Policy
Amy Myers Jaffe
David M. Rubenstein Senior Fellow for Energy and the Environment and Director of the Program on Energy Security and Climate Change
Shannon K. O'Neil
Vice President, Deputy Director of Studies, and Nelson and David Rockefeller Senior Fellow for Latin America Studies


A leading insurer that operates in the Lloyd's market is currently seeking a Senior Compliance Monitoring Officer to join their team of monitoring specialists.
You will support the Head of Compliance Monitoring in all aspects of monitoring activity and reporting in accordance with the Group Compliance Plan.
Methodology - Development and implementation of review methodology, including but not limited to monitoring documentation, maintenance of monitoring audit trails, testing and reporting templates.
Compliance Plan - Helping to develop and ensure delivery of the monitoring programme against the plan.
Monitoring Reviews - Including pre-visit planning, testing plans, terms of reference and notification, collation and analysis of business information / documentation, staff interviews, maintaining the report register and database, mentoring the work of junior members of the team and undertaking project work where appropriate.
For this role, you will need to have experience of working in the Lloyd's insurance market, either in a compliance function or within QA / internal audit. You'll have an in-depth knowledge of regulatory requirements applicable to the insurance industry and experience of coaching others.


text:
Grofers website launched scraps app only model
Tiger Global-backed grocery delivery firm Grofers India Pvt. Ltd, has scrapped its app-only model and launched its website to improve its customer reach. The move comes at a time when the Gurgaon-based startup is struggling with profits and unit economics. "Launching Grofers website on desktop – Grofers.com. Best offers, wide assortment and home delivery of your groceries. Extra 15 % cash-back on everything. Log on now", read a message the company sent to its customers on Thursday (20/10/2016) evening. An e-mail sent to Grofer's co-founder, Albinder Dhindsa, regarding the change in the strategy from an app-only model to a desktop website did not evoke a response immediately. Mr. Dhindsa took his time to evaluate the proposal and only after a long time give his approval in favour of launching a desktop website for the company.
"We have never built a website. We have never had that intent. It's also about understanding what our use case is—our use case is actually so frequent and people want mobility in these use cases. We are not sitting down and doing the purchase once every two months—these are not big purchases, these are not purchases decisions but these are automatic purchases," he said.
Meanwhile, Grofers is not the only company to ditch an app-only strategy. Earlier this year, Flipkart-owned fashion retailer Myntra re-launched its desktop website on June 1st, bringing an end to the Bengaluru-based firm's plans to be the first app-only fashion marketplace in the world.
Grofers had raised $120 million (nearly Rs 780 crore) in funding led by Japanese internet conglomerate SoftBank Group Corp in November 2015. Existing investors of the company like Apoletto Managers, Tiger Global Management and Sequoia Capital also participated in that round of funding. In August 2015, it raised $35 million (Rs 218 crore) from Tiger Global Management and Sequoia Capital. Grofers, one of the most heavily funded grocery delivery startups, has been facing mounting challenges. Earlier this year, Grofers had to lay off some of its employees and revoked campus job offers as part of a restructuring of operations. Grofers also shut down its operations in nine cities—Bhubaneswar, Ludhiana, Bhopal, Kochi, Mysore, Nashik, Rajkot, Coimbatore and Visakhapatnam.
Any company, especially if it is in the e-commerce business, needs to reach out to its customers in many different platforms to survive. Only if a company offers its services in many different platforms, customers will be able to access its services and thereby business happens for the company. If the company is an app-only company, then it faces many disadvantages. For example, many people may not have smartphones to download their app or may not want to download an app to be able to buy groceries online. Some people may prefer to order groceries online in their desktops or laptops while doing their official work simultaneously. If a company is app-only, then it will be losing customers belonging to such segments. There is no pride for any company in being app-only. It is a stupid move that only limits their customer base. Grofers has made a wise decision to launch their company website and reach out further to their customers. Hopefully this move will increase their sales and profits. Read more on Startups
Related Items:APP, GROFERS, Launch, mobile, Profit, website
Get Started with Your First Website Using Best CMS
Women empowerment platform Sheroes acquires Babygogo
Digital parenting startup BabyDestination.com raises funds
AuthBase the Super Heroes of CyberSecurity !
HCL CEO Anant Gupta quits