It's a history lesson Democrats hope they don't need to learn again on Tuesday.

In an episode they still rue, California Democrats in 2012 failed to win a spot on the November ballot in a key House race, essentially surrendering the seat to Republicans without a fight. The culprit was "candidate clutter" — four Democrats running in the primary, spreading out the party's vote and allowing the two Republicans on the ballot to claim the top spots and advance to the general election. (Two years later, Democrats did get their signals straight and won the seat, which Rep. Pete Aguilar continues to occupy.)

On Tuesday, the big question is whether candidate clutter will again cost Democrats in California, this time potentially jeopardizing their House takeover math. Of the seven districts that Republicans hold but that Hillary Clinton carried, three of them feature at least the potential for Democrats to be "locked out" of the general election race in November.

That's because before they can get to worrying about the fall, Democrats must first clear a tricky hurdle on Tuesday: Making the ballot.

Advancing to November is not a given with California's top-two "jungle" primary system, in which all candidates, regardless of party label, are listed on the same primary ballot, with the two leaders then moving on to the general election. The system has been in place for nearly a decade and it has generally produced fall match-ups between one Democrat and one Republican — but not always.

And for Democrats seeking to win back the House this November, there's no target more ripe than the state of California.

A total of seven Republicans — half of the state's entire GOP delegation — represent districts that Clinton carried over Donald Trump in the 2016 election. Simply flip these seats this November and Democrats will be nearly a third of the way to the 23 pick-ups they need across the country in order to take the House.

The good news for Democrats is that the steps they've been taking to ensure they're represented on the November ballot — pressuring some candidates to drop out and spending money to foment chaos on the Republican side — may be working. The consensus now is that they're likely to avoid lockouts in the three districts where they are most vulnerable. But the possibility remains, and figures to be the main source of suspense on Tuesday night.

Here’s a closer look at the three districts in question:

CA-39 (Orange, San Bernardino, Los Angeles Counties). 2016 presidential result: Clinton +8

This is an open seat, with long-serving Republican Rep. Ed Royce retiring. Republicans now privately say it is their best shot for locking out Democrats from the November ballot. While there are a half dozen Republicans on the ballot, the GOP's hope is that its voters' support will be heavily concentrated among two of them, Young Kim and Shawn Nelson, and that an ill-defined Democratic field that features at least four candidates with significant bases of support will ensure that no individual Democrat makes the top two. Republicans also hope that a local battle — a recall effort against a Democratic state senator who supported last year's state gas tax hike — will spike turnout on the GOP side.

CA-48 (Orange County). 2016 presidential result: Clinton +2

Republicans were once bullish on their chances of creating a lockout here, but that optimism has been waning.

The assumption is that the longtime incumbent, GOP Rep. Dana Rohrabacher, will make the fall ballot, and for a while Republicans believed that Scott Baugh, a Rohrabacher ally-turned-antagonist with his own local base, might claim the second spot. But Democrats have spent heavily to thwart Baugh, and it may be having an impact.

Meanwhile, Democrats have moved late to rally support for Harley Rouda, a businessman and former Republican, against Hans Keirstead, a scientist who had initially attracted the interest of party leaders. Three other Democrats have dropped out of the race, and two of them have endorsed Rouda, but all of their names will still appear on the ballot, potentially wasting votes Democrats can't afford to lose.

CA-49 (San Diego, Orange Counties). 2016 presidential result: Clinton +7

This is an open seat, with GOP Rep. Darrell Issa declining to run again after a very close call in '16. Republicans have the more crowded field here, but they are increasingly confident that one of their candidates, Diane Harkey, has broken away from the rest of the pack.

A poll over the weekend showed Harkey running in first place, more than doubling the support of her nearest foe. If this poll holds up, it could be a mixed blessing for Republicans, since the better Harkey does, the less likely it becomes that a second Republican can attract enough support to make the November ballot.

Rocky Chavez, a Republican assemblyman, initially seemed poised to make the top two in this race, but Democrats have since targeted him aggressively. Still, the Democratic field is large enough — four candidates with significant bases of support — that a disaster for the party on Tuesday is not out of the question.

If Democrats can clear Tuesday's hurdle in these districts — and assuming there are no unforeseen stunners elsewhere — then they will emerge with seven juicy fall pickup opportunities in California.

Which would mean the battle for control of the House could last late into the night this November. And actually, the way they count votes in California, it could last a lot longer than that.