I’ve been spinning why wheels on this issue for a ...
# troubleshooting
n
I’ve been spinning why wheels on this issue for a few hours now so I figure it’s time to phone a friend We have a new table that needs loading via meltano, so I did what I normally do and add it in
meltano.yml
, run a
meltano elt
to make sure things load properly, then add it to the scheduled
meltano elt
command in prod that corresponds to our desired scheduling for updates to the new table. We’re using airflow with directly configured jobs to run these commands (each with a different
state_id
to distinguish them). This all works fine, so I let it run for a few days. Then I noticed that jobs being triggered by airflow were running fine, but not actually updating the table. Further investigation revealed that the new table had not gotten added to the job’s state JSON, which seemed odd. Grepping in the corresponding
tap.properties.json
also indicated that new table wasn’t listed there either. I know that running
meltano etl
should automatically trigger discovery and updating of
tap.properties.json
but somehow that doesn’t seem to be happening here? More oddly, everything continues to work just fine when I spin up a local version of the stack (via docker compose) and run the exact same command. There’s gotta be something different about production that’s not updating the tap properties correctly, but I can’t think of what it might be. Has anyone else ever run into this kind of thing or have any ideas?
One other path I explored for a while is related to discovery.yml: I’m getting the same error described here when I try to run any pipeline, but it doesn’t seem like this should be a barrier to tap properties getting updated? https://github.com/meltano/meltano/issues/6128
I should also add, pipelines for existing tables/data sources continue to run just fine everywhere, I assume because they’re already included in
tap.properties.json
I have also tried manually editing the state json stored in the meltano DB to include an entry for the new table. I’m not a big fan of this approach because of the potential for screwing something up, but I’ve used it to resolve odd problems in the past. Unfortunately, it does not appear to have made a difference
c
Sounds like the cached catalog is what's causing your issue in Prod. What I normally do to wipe the cached catalog is to run a re-install of the tap https://github.com/meltano/meltano/issues/2856
n
ah, thanks for the pointer to that issue @christoph! I had a feeling something like this might be at play, but haven’t yet tried tinkering with the catalog yet. I’ll do some exploring along these lines and report back
Interestingly, I’d have expected the cached catalogs to be stored in
.meltano/cache
, but I’m not seeing them in there. I suspect this is because we’re running
meltano elt
in discovery mode (that is, I’ve not ever needed to pre-generate catalogs as part of a separate step - I’m almost positive meltano is making them on the fly)
I suppose it’s possible there’s something going wrong during the discovery process? I am also seeing the error described here, but had initially not considered a connection between these two seemingly separate issues https://github.com/meltano/meltano/pull/6543
Last thing I’ll note here for now is that both our local and prod meltano stacks are containerized + managed via docker compose. Everything is installed fresh when we rebuild our meltano container, so if the issue really is a stuck catalog cache, theoretically a rebuild of the container and deploy should resolve the issue. Since its 9pm ET and I’d like to avoid any shenanigans that would prevent me from sleeping tonight, I’m going to hold off on said deploy until tomorrow 🙂
Welp, I rebuilt the container (which reinstalls all the taps as part of the build) and deployed, but that doesn’t appear to have solved things unfortunately. Clarifying question for you @christoph whenever you get a chance: am I correct in thinking that
meltano install
is the command you’re using to reinstall the taps when you ran into this before?
(I have another hypothesis I’m going to work on in parallel, but knowing that answer will help me rule out the possibility that I haven’t implemented your suggestion correctly)
c
am I correct in thinking that
meltano install
is the command you’re using to reinstall the taps when you ran into this before?
Yup. That's how I currently wipe the cached catalog for any tap that might dynamically change its streams in the catalog based on changes in the source.
It's important to note though that I use
meltano install --clean
thereby forcing a reinstall of an existing tap
n
Ah! Good to know, I didn't do that and will give that a shot. Thanks!
c
What is the tap that you are using btw? A public tap from the hub, or a custom tap?
n
It's pipelinewise-tap-mysql, but it's a fork
Though we've been happily using that for almost 2 years and haven't run into this issue before
c
pipelinewise-tap-mysql, but it's a fork
I'm using that myself and actually have found it to be very reliable. I'll try and do a reproduction of the catalog caching issue using that tap ...
d
@nick_hamlin Does the new table show up when you run
meltano select tap-mysql --list
inside the container? Or
meltano select tap-mysql --list --all
?
n
ok, a few observations around `meltano select tap-mysql --list`: 1. When I run this command (and others) both locally and in prod, there’s a few minute long delay when nothing is apparently happening before I get the error about
discovery.yml
described here: https://meltano.slack.com/archives/C01TCRBBJD7/p1659995696908979 2. Running that command on our meltano image running on a local docker stack returns results that include the new table I’ve been trying to add. This is what I’d have expected, since I’m able to load results into it when running locally. 3. Running that command on the same image running in prod does NOT return results for the new table (which sorta also makes sense since that’s where it’s not working). What’s mystifying to me is why those two would be different when they’re using the same image. That implies to me that is has something to do with data stored in the underlying meltano database, since (I think?) that’s the only thing that’s capable of persisting data and is different between the two?
Another potentially useful datapoint: the new table does show up in the json payload stored in the
runs
table for the job that should run it (this is presumably leftover from my earlier troubleshooting attempts where I manually added it in there)
d
@nick_hamlin That discovery error was fixed in 2.5.0, are you able to update? What you’re describing does sound like a catalog caching issue, but I’m not aware of any caching there that would get baked into the Docker image 😕 On the prod env where
meltano select tap-mysql --list --all
doesn’t include the new table, does
meltano invoke tap-mysql --discover
have it? That just runs discovery mode directly, skipping any possible caching
n
I’ve updated the image to 2.4.0, but haven’t yet tried 2.5.0 - I can definitely give that a shot though. I’ll also see what happens with that second command, but this has also given me another idea of what might be happening to test. I’m wondering if the prod user doesn’t have explicit access to the new table but my local user does? I’ve got a ping into DevOps to take a look on that front too
well, the mystery is solved! A few months back DevOps changed the default permissions for the meltano user such that new tables have to have explicit opt in. Since this user could access some tables in the underlying DB but not the new one,
meltano select
and
meltano elt
commands didn’t totally fail, but instead silently skipped over the new table. Similarly, the catalog wasn’t getting updated to include the new table because that table wasn’t being returned during discovery. Fortunately, the easy fix here is to tweak those permissions and now everything runs just fine! It does make me wonder if there might be an opportunity for meltano to return more expressive errors in the future in situations where a data source is indicated in
meltano.yml
but for which the user doesn’t actually have access permissions? Happy to share more details/ideas if helpful on that front. In the meantime, many thanks to everyone who has weighed in on this thread with support!
(side note: I still need to test updating to 2.5, but that’s a task for next week)
d
@nick_hamlin Can you file an issue for that suggestion please?
n
sure can!
c
It does make me wonder if there might be an opportunity for meltano to
return more expressive errors in the future in situations where a data
source is indicated in
meltano.yml
but for which the user doesn’t actually have access permissions?
It certainly sounds like an interesting feature. Especially as the behaviour you experienced probably violates the principle of least surprise.
d
where a data source is indicated in
meltano.yml
but for which the user doesn’t actually have access permissions?
Does this mean that you had the table explicitly listed in the
select
rule, not just as
*.*
? I think it’d make sense to warn the user “this rule didn’t match any streams, make sure you don’t have a typo or that the stream exists (or you have access)
n
Yep, that’s exactly right - we have all tables for that tap explicitly listed (some additionally have specific columns enumerated, while others follow the format
database-table.*
)
slightly delayed, but issue is submitted: https://github.com/meltano/meltano/issues/6698