Skip to content

Commit

Permalink
Merge pull request pentaho#1151 from lucboudreau/mondrian2674
Browse files Browse the repository at this point in the history
[MONDRIAN-2674] Better logging of late SQL queries for segments.
  • Loading branch information
tkafalas authored Aug 26, 2019
2 parents e1e7775 + e967bf0 commit 88efc17
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
// This software is subject to the terms of the Eclipse Public License v1.0
// Agreement, available at the following URL:
// http://www.eclipse.org/legal/epl-v10.html.
// You must accept the terms of that agreement to use this software.
//
// Copyright (c) 2019-2019 Hitachi Vantara.
// All Rights Reserved.
*/
package mondrian.rolap.cache;

import static org.mockito.Mockito.mock;

import mondrian.spi.SegmentBody;
import mondrian.spi.SegmentHeader;
import mondrian.test.FoodMartTestCase;

public class SegmentCacheIndexImplTest extends FoodMartTestCase {
public void testNoHeaderOnLoad() {
final SegmentCacheIndexImpl index =
new SegmentCacheIndexImpl(Thread.currentThread());

final SegmentHeader header = mock(SegmentHeader.class);
final SegmentBody body = mock(SegmentBody.class);

// This should not fail.
index.loadSucceeded(header, body);
}
}

//End SegmentCacheIndexImplTest.java
2 changes: 2 additions & 0 deletions mondrian/src/it/java/mondrian/test/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import mondrian.rolap.*;
import mondrian.rolap.agg.*;
import mondrian.rolap.aggmatcher.*;
import mondrian.rolap.cache.SegmentCacheIndexImplTest;
import mondrian.rolap.format.DefaultFormatterTest;
import mondrian.rolap.format.FormatterCreateContextTest;
import mondrian.rolap.format.FormatterFactoryTest;
Expand Down Expand Up @@ -178,6 +179,7 @@ public static Test suite() throws Exception {
addTest(suite, ScenarioTest.class);
addTest(suite, BasicQueryTest.class);
addTest(suite, SegmentCacheTest.class);
addTest(suite, SegmentCacheIndexImplTest.class);
addTest(suite, CVBasicTest.class, "suite");
addTest(suite, GrandTotalTest.class, "suite");
addTest(suite, HangerDimensionTest.class, "suite");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// http://www.eclipse.org/legal/epl-v10.html.
// You must accept the terms of that agreement to use this software.
//
// Copyright (c) 2002-2017 Hitachi Vantara.
// Copyright (c) 2002-2019 Hitachi Vantara.
// All Rights Reserved.
*/
package mondrian.rolap.cache;
Expand Down Expand Up @@ -267,8 +267,15 @@ public void loadSucceeded(SegmentHeader header, SegmentBody body) {
checkThread();

final HeaderInfo headerInfo = headerMap.get(header);
assert headerInfo != null
: "segment header " + header.getUniqueID() + " is missing";

if (headerInfo == null) {
LOGGER.trace(
"loadSucceeded: Discarding data for header "
+ header.getUniqueID()
+ ". Data arrived late.");
return;
}

if (!headerInfo.slot.isDone()) {
headerInfo.slot.put(body);
}
Expand Down

0 comments on commit 88efc17

Please sign in to comment.