Skip to content

Commit 0ddd98c

Browse files
authored
Merge branch 'main' into events
2 parents 6cb5a03 + ce4ac65 commit 0ddd98c

46 files changed

Lines changed: 586 additions & 332 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
API_PORT=5000
22
API_ADMIN_PORT=5001
33
WEB_PORT=3000
4-
TAG=0.27.0
4+
TAG=0.28.0

.github/workflows/headerchecker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Check for headers
3232
run: |
3333
ok=1
34-
readarray -t files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.all }}')"
34+
readarray -t files <<<"$(jq -r '.[]' <<<'${{ steps.files.outputs.added_modified }}')"
3535
for file in ${files[@]}; do
3636
if [[ ($file == *".java") ]]; then
3737
if ! grep -q Copyright "$file"; then

CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
11
# Changelog
22

3-
## [Unreleased](https://github.com/MarquezProject/marquez/compare/0.27.0...HEAD)
3+
## [Unreleased](https://github.com/MarquezProject/marquez/compare/0.28.0...HEAD)
4+
5+
## [0.28.0](https://github.com/MarquezProject/marquez/compare/0.27.0...0.28.0) - 2022-11-21
6+
7+
### Added
8+
9+
* Optimize current runs query for lineage API [`#2211`](https://github.com/MarquezProject/marquez/pull/2211) [@prachim-collab](https://github.com/prachim-collab)
10+
*Add a simpler, alternate `getCurrentRuns` query that gets only simple runs from the database without the additional data from tables such as `run_args`, `job_context`, `facets`, etc., which required extra table joins.*
11+
* Add Code Quality, DCO and Governance docs to project [`#2237`](https://github.com/MarquezProject/marquez/pull/2237) [`#2241`](https://github.com/MarquezProject/marquez/pull/2241) [@merobi-hub](https://github.com/MarquezProject/marquez/commits?author=merobi-hub)
12+
*Adds a number of standard governance and procedure docs to the project.*
13+
* Add possibility to soft-delete namespaces [`#2244`](https://github.com/MarquezProject/marquez/pull/2244) [@mobuchowski](https://github.com/mobuchowski)
14+
*Adds the ability to "hide" inactive namespaces. The namespaces are undeleted when a relevant OL event is received.*
15+
* Add search service proposal [`#2203`](https://github.com/MarquezProject/marquez/pull/2203) [@pawel-big-lebowski](https://github.com/pawel-big-lebowski)
16+
*Proposes using ElasticSearch as a pluggable search service to enhance the search feature in Marquez and adding the ability to turn it off, as well. Includes ideas about what should be indexed and the requirements for the interface.*
17+
18+
### Fixed
19+
20+
* Show facets even when dataset has no fields [`#2214`](https://github.com/MarquezProject/marquez/pull/2214) [@JDarDagran](https://github.com/JDarDagran)
21+
*Changes the logic in the `DatasetInfo` component to always show facets so that dataset facets are visible in the UI even if no dataset fields have been set.*
22+
* Appreciate column prefix when given for `ended_at` [`#2231`](https://github.com/MarquezProject/marquez/pull/2231) [@fm100](https://github.com/fm100)
23+
*The `ended_at` column was always null when querying if `columnPrefix` was given for the mapper. Now, `columnPrefix` is included when checking for column existence.*
24+
* Fix bug keeping jobs from being properly deleted [`#2244`](https://github.com/MarquezProject/marquez/pull/2244) [@mobuchowski](https://github.com/mobuchowski)
25+
*It wasn't possible to delete jobs created from events that had a `ParentRunFacet`. Now it's possible.*
26+
* Fix symlink table column length ['#2217'](https://github.com/MarquezProject/marquez/pull/2217) [@pawel-big-lebowski](https://github.com/pawel-big-lebowski)
27+
*The dataset's name column in the `dataset_symlinks` table was shorter than the column in the datasets table. Changes the existing V48 migration script to allow proper migration for users who did not upgrade yet, and adds an extra migration script to extend the column length for users who did upgrade but did not experience the issues.*
28+
429

530
## [0.27.0](https://github.com/MarquezProject/marquez/compare/0.26.0...0.27.0) - 2022-10-24
631

api/src/main/java/marquez/api/JobResource.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ public Response delete(
176176
.findJobByName(namespaceName.getValue(), jobName.getValue())
177177
.orElseThrow(() -> new JobNotFoundException(jobName));
178178

179-
jobService.delete(namespaceName.getValue(), jobName.getValue());
179+
// Should be simple name from `jobs_fqn`.
180+
jobService.delete(namespaceName.getValue(), job.getSimpleName());
180181
return Response.ok(job).build();
181182
}
182183

api/src/main/java/marquez/api/NamespaceResource.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import javax.validation.Valid;
1616
import javax.validation.constraints.Min;
1717
import javax.ws.rs.Consumes;
18+
import javax.ws.rs.DELETE;
1819
import javax.ws.rs.DefaultValue;
1920
import javax.ws.rs.GET;
2021
import javax.ws.rs.PUT;
@@ -77,6 +78,23 @@ public Response list(
7778
return Response.ok(new Namespaces(namespaces)).build();
7879
}
7980

81+
@Timed
82+
@ResponseMetered
83+
@ExceptionMetered
84+
@DELETE
85+
@Path("/namespaces/{namespace}")
86+
@Produces(APPLICATION_JSON)
87+
public Response delete(@PathParam("namespace") NamespaceName name) {
88+
final Namespace namespace =
89+
namespaceService
90+
.findBy(name.getValue())
91+
.orElseThrow(() -> new NamespaceNotFoundException(name));
92+
datasetService.deleteByNamespaceName(namespace.getName().getValue());
93+
jobService.deleteByNamespaceName(namespace.getName().getValue());
94+
namespaceService.delete(namespace.getName().getValue());
95+
return Response.ok(namespace).build();
96+
}
97+
8098
@Value
8199
static class Namespaces {
82100
@NonNull

api/src/main/java/marquez/db/Columns.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ private Columns() {}
5555
public static final String DATASET_NAME = "dataset_name";
5656
public static final String FACETS = "facets";
5757
public static final String TAGS = "tags";
58+
public static final String IS_HIDDEN = "is_hidden";
5859

5960
/* NAMESPACE ROW COLUMNS */
6061
public static final String CURRENT_OWNER_NAME = "current_owner_name";
@@ -197,6 +198,14 @@ public static boolean booleanOrDefault(
197198
return results.getBoolean(column);
198199
}
199200

201+
public static boolean booleanOrThrow(final ResultSet results, final String column)
202+
throws SQLException {
203+
if (results.getObject(column) == null) {
204+
throw new IllegalArgumentException();
205+
}
206+
return results.getBoolean(column);
207+
}
208+
200209
public static int intOrThrow(final ResultSet results, final String column) throws SQLException {
201210
if (results.getObject(column) == null) {
202211
throw new IllegalArgumentException();

api/src/main/java/marquez/db/DatasetDao.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,24 @@ DatasetRow upsert(
292292
String name,
293293
String physicalName);
294294

295+
@SqlUpdate(
296+
"""
297+
UPDATE datasets d
298+
SET is_hidden = true
299+
FROM namespaces n
300+
WHERE n.uuid=d.namespace_uuid
301+
AND n.name=:namespaceName
302+
""")
303+
void deleteByNamespaceName(String namespaceName);
304+
295305
@SqlQuery(
296306
"""
297-
UPDATE datasets
298-
SET is_hidden = true
299-
FROM dataset_symlinks, namespaces
300-
WHERE dataset_symlinks.dataset_uuid = datasets.uuid
301-
AND namespaces.uuid = dataset_symlinks.namespace_uuid
302-
AND namespaces.name=:namespaceName AND dataset_symlinks.name=:name
303-
RETURNING *
307+
UPDATE datasets d
308+
SET is_hidden = true
309+
FROM namespaces n
310+
WHERE n.uuid = d.namespace_uuid
311+
AND n.name=:namespaceName AND d.name=:name
312+
RETURNING *
304313
""")
305314
Optional<DatasetRow> delete(String namespaceName, String name);
306315

api/src/main/java/marquez/db/JobDao.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,16 @@ SELECT run_uuid, JSON_AGG(e.facets) AS facets
8888
""")
8989
void delete(String namespaceName, String name);
9090

91+
@SqlUpdate(
92+
"""
93+
UPDATE jobs
94+
SET is_hidden = true
95+
FROM namespaces n
96+
WHERE jobs.namespace_uuid = n.uuid
97+
AND n.name = :namespaceName
98+
""")
99+
void deleteByNamespaceName(String namespaceName);
100+
91101
default Optional<Job> findWithRun(String namespaceName, String jobName) {
92102
Optional<Job> job = findJobByName(namespaceName, jobName);
93103
job.ifPresent(

api/src/main/java/marquez/db/NamespaceDao.java

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,20 @@ default Namespace upsertNamespaceMeta(
7878
@SqlQuery("SELECT * FROM namespaces ORDER BY name LIMIT :limit OFFSET :offset")
7979
List<Namespace> findAll(int limit, int offset);
8080

81+
@SqlQuery("UPDATE namespaces SET is_hidden=false WHERE name = :name RETURNING *")
82+
NamespaceRow undelete(String name);
83+
84+
@SqlUpdate("UPDATE namespaces SET is_hidden=true WHERE name = :name")
85+
void delete(String name);
86+
8187
default NamespaceRow upsertNamespaceRow(
8288
UUID uuid, Instant now, String name, String currentOwnerName) {
8389
doUpsertNamespaceRow(uuid, now, name, currentOwnerName);
84-
return findNamespaceByName(name).orElseThrow();
90+
NamespaceRow namespaceRow = findNamespaceByName(name).orElseThrow();
91+
if (namespaceRow.getIsHidden()) {
92+
namespaceRow = undelete(namespaceRow.getName());
93+
}
94+
return namespaceRow;
8595
}
8696

8797
/**
@@ -99,40 +109,47 @@ default NamespaceRow upsertNamespaceRow(
99109
* @param currentOwnerName
100110
*/
101111
@SqlUpdate(
102-
"INSERT INTO namespaces ( "
103-
+ "uuid, "
104-
+ "created_at, "
105-
+ "updated_at, "
106-
+ "name, "
107-
+ "current_owner_name "
108-
+ ") VALUES ("
109-
+ ":uuid, "
110-
+ ":now, "
111-
+ ":now, "
112-
+ ":name, "
113-
+ ":currentOwnerName) "
114-
+ "ON CONFLICT(name) DO NOTHING")
112+
"""
113+
INSERT INTO namespaces (
114+
uuid,
115+
created_at,
116+
updated_at,
117+
name,
118+
current_owner_name
119+
) VALUES (
120+
:uuid,
121+
:now,
122+
:now,
123+
:name,
124+
:currentOwnerName)
125+
ON CONFLICT(name) DO NOTHING
126+
""")
115127
void doUpsertNamespaceRow(UUID uuid, Instant now, String name, String currentOwnerName);
116128

117129
@SqlQuery(
118-
"INSERT INTO namespaces ( "
119-
+ "uuid, "
120-
+ "created_at, "
121-
+ "updated_at, "
122-
+ "name, "
123-
+ "current_owner_name, "
124-
+ "description "
125-
+ ") VALUES ("
126-
+ ":uuid, "
127-
+ ":now, "
128-
+ ":now, "
129-
+ ":name, "
130-
+ ":currentOwnerName, "
131-
+ ":description "
132-
+ ") ON CONFLICT(name) DO "
133-
+ "UPDATE SET "
134-
+ "updated_at = EXCLUDED.updated_at "
135-
+ "RETURNING *")
130+
"""
131+
INSERT INTO namespaces (
132+
uuid,
133+
created_at,
134+
updated_at,
135+
name,
136+
current_owner_name,
137+
description,
138+
is_hidden
139+
) VALUES (
140+
:uuid,
141+
:now,
142+
:now,
143+
:name,
144+
:currentOwnerName,
145+
:description,
146+
false
147+
) ON CONFLICT(name) DO
148+
UPDATE SET
149+
updated_at = EXCLUDED.updated_at,
150+
is_hidden = false
151+
RETURNING *
152+
""")
136153
NamespaceRow upsertNamespaceRow(
137154
UUID uuid, Instant now, String name, String currentOwnerName, String description);
138155

api/src/main/java/marquez/db/mappers/NamespaceMapper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package marquez.db.mappers;
77

8+
import static marquez.db.Columns.booleanOrThrow;
89
import static marquez.db.Columns.stringOrNull;
910
import static marquez.db.Columns.stringOrThrow;
1011
import static marquez.db.Columns.timestampOrThrow;
@@ -28,6 +29,7 @@ public Namespace map(@NonNull ResultSet results, @NonNull StatementContext conte
2829
timestampOrThrow(results, Columns.CREATED_AT),
2930
timestampOrThrow(results, Columns.UPDATED_AT),
3031
OwnerName.of(stringOrThrow(results, Columns.CURRENT_OWNER_NAME)),
31-
stringOrNull(results, Columns.DESCRIPTION));
32+
stringOrNull(results, Columns.DESCRIPTION),
33+
booleanOrThrow(results, Columns.IS_HIDDEN));
3234
}
3335
}

0 commit comments

Comments
 (0)